diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-03-17 13:58:15 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-03-17 13:58:15 -0700 |
commit | 0939842565ce316ee621af170b01de552b347359 (patch) | |
tree | 6b79519222432bfda5b0d285965b5ee6fd44ccfc | |
parent | 958fdaa0731b22ac051caae2c9730b1d660149c7 (diff) | |
download | unix-cruft-0939842565ce316ee621af170b01de552b347359.tar.gz unix-cruft-0939842565ce316ee621af170b01de552b347359.tar.bz2 unix-cruft-0939842565ce316ee621af170b01de552b347359.zip |
Reject reversed ranges like [z-a].
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | awkreg.awk | 7 |
2 files changed, 11 insertions, 2 deletions
@@ -1,5 +1,11 @@ 2014-03-17 Kaz Kylheku <kaz@kylheku.com> + * 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 <kaz@kylheku.com> + * awkreg.awk (driver): fix references to nonexistent variable ir; should be ok. @@ -97,7 +97,7 @@ function eat_class(c) function eat_bracket_exp(e, #local - f, o) + f, o, x, y) { o = e e = eat_char(e) @@ -115,6 +115,7 @@ function eat_bracket_exp(e, continue } + x = substr(e, 1, 1); f = eat_bchar(e) if (f == e) @@ -123,8 +124,10 @@ function eat_bracket_exp(e, if (matches(e, "-")) { e = eat_char(e) + y = substr(e, 1, 1); f = eat_bchar(e) - if (f == e) + + if (x > y || f == e) return o e = f } |