2014-03-17 Kaz Kylheku * awkreg.awk (eat_bracket_exp): Capture the endpoint characters of a range into the variables x and y, and use these to assert that the lower endpoint is not lexicographically above the upper endpoint. 2014-03-17 Kaz Kylheku * awkreg.awk (driver): fix references to nonexistent variable ir; should be ok. 2014-03-17 Kaz Kylheku * awkreg.awk (eat_bracket_exp, eat_regex): Remove unnecessary statement-terminating semicolons. 2014-03-17 Kaz Kylheku * awkreg-grammar.txt: New file. Taken from my original Usenet posting in comp.lang.awk. 2014-03-17 Kaz Kylheku 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.