From 0939842565ce316ee621af170b01de552b347359 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 17 Mar 2014 13:58:15 -0700 Subject: Reject reversed ranges like [z-a]. --- ChangeLog | 6 ++++++ awkreg.awk | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f98cba..7a8e7e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +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; diff --git a/awkreg.awk b/awkreg.awk index 52c8353..043d44a 100644 --- a/awkreg.awk +++ b/awkreg.awk @@ -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 } -- cgit v1.2.3