newsText Extractor TXR - News

 
 

Txr 039 is out.

Item posted by Kaz Kylheku <kkylheku> on Mon 10 Oct 2011 04:32:24 PM UTC.

Txr now runs on Cygwin.

Some significant bugs are fixed, including a spectacular bug in function calling that dates back to 2009.

There are a bunch of new features.

- @(skip) has a :greedy keyword, which extends its usefulness
- @(trailer) and @(skip) work horizontally now too
- collection directives have new keywords to control what
  variables are collected and a minimum and maximum number
  of times to collect.
- new @(eol) directive matches end of line explicitly.

You can do useful things like

  @(collect :mintimes 3 :vars (a b (c "foo")))

which means collect at least three times (or else fail), and only the variables a, b and c are collected. For any successful collect iteration, if a binding for c is not produced, then a binding of "foo" is substituted.

Match last three white-space-delimited tokens in a line:

  @(skip :greedy) @a @b @c

Match trailing context in a line. Collect space-delimited tokens into a, which are not followed by a number. Then collect the rest.

  query:
  @(coll :gap 0)@a @(trailer)@/[^0-9]/@(end)@rest

  input:
  a b c 1 2 3

  output:
  a[0]="a"
  a[1]="b"
  rest="c 1 2 3"

Grab the first and last character of the line:

  @{first 1}@(skip :greedy)@{last 1}

Cheers ...

Back to the top

Powered by Savane 3.14-8aba.
Corresponding source code