1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
2014-03-17 Kaz Kylheku <kaz@kylheku.com>
* awkreg.awk (driver): fix references to nonexistent variable ir;
should be ok.
2014-03-17 Kaz Kylheku <kaz@kylheku.com>
* awkreg.awk (eat_bracket_exp, eat_regex): Remove unnecessary
statement-terminating semicolons.
2014-03-17 Kaz Kylheku <kaz@kylheku.com>
* awkreg-grammar.txt: New file. Taken from my original Usenet
posting in comp.lang.awk.
2014-03-17 Kaz Kylheku <kaz@kylheku.com>
Fix in {m,n} syntax.
The issue is that the parser partially consumes broken {m,n}
syntax. The eat_rep_notation function must backtrack fully,
and its caller must detect it has done so.
Improved driver code.
* awkreg.awk (dbg): New function, handy for debugging.
Prints its argument, and then returns it.
(match_and_eat_else): New function. Similar to match_and_eat,
except that if there si no match, it returns the new third
argument, rather than the rejected string itself.
This simplifies the expression of some backtracking logic.
(eat_rep_notation): If any of the notation doesn't match,
then backtrack all the way and return the original input unconsumed.
For this, a new local variable o ("original") retains the input.
(eat_factor): When matching a parenthesized regex, if matching closing
parens after the regex fails, then backtrack all the way,
returning the whole factor unconsumed.
(regex_check): New function: contains most of the logic of
the original is_regex. Basically it is like eat_regex, but with support
for ^ and $.
(is_regex): Basically now just reports whether regex_check fully
consumes the string or not.
(driver): The driver action is improved, showing the non-matching
suffix of the regex.
|