lib/regextest/front/bracket-parser.y in regextest-0.1.5 vs lib/regextest/front/bracket-parser.y in regextest-0.1.6
- old
+ new
@@ -26,10 +26,12 @@
{val[0].add(val[1])}
# a element (a letter, a character class, a range or another bracket)
brc_elm: brc_lt1 LEX_MINUS brc_lt1
{TRange.new(val[0], val[2])}
+ | brc_lt1 LEX_MINUS # [a-&&] pattern
+ {CharClass.new(val[0]).add(TLetter.new(:LEX_CHAR, val[1]))}
| brc_lt1
{val[0]}
| brc_lt2
{val[0]}
| reg_bracket
@@ -46,17 +48,18 @@
| LEX_OCTET {TLetter.new(:LEX_OCTET, val[0])}
| LEX_SIMPLE_ESCAPE {TLetter.new(:LEX_SIMPLE_ESCAPE, val[0])}
| LEX_MINUS {TLetter.new(:LEX_CHAR, val[0])} # minus as a first letter
| LEX_CODE_LITERAL {TLetter.new(:LEX_CODE_LITERAL, val[0])}
| LEX_CONTROL_LETTER {TLetter.new(:LEX_CONTROL_LETTER, val[0])}
+ | LEX_META_CONTROL_LETTER {TLetter.new(:LEX_META_CONTROL_LETTER, val[0])}
| LEX_META_LETTER {TLetter.new(:LEX_CONTROL_LETTER, val[0])}
| LEX_ESCAPED_LETTER {TLetter.new(:LEX_ESCAPED_LETTER, val[0])}
| LEX_UNICODE {TLetter.new(:LEX_UNICODE, val[0])}
# a character class
brc_lt2: LEX_POSIX_CHAR_CLASS {TLetter.new(:LEX_POSIX_CHAR_CLASS, val[0])}
| LEX_SIMPLIFIED_CLASS {TLetter.new(:LEX_SIMPLIFIED_CLASS, val[0])}
- | LEX_UNICODE_CLASS {TLetter.new(:LEX_UNICODE_CLASS, val[0])}
+ | LEX_UNICODE_CLASS {TLetter.new(:LEX_UNICODE_CLASS_BRACKET, val[0])}
| LEX_SPECIAL_LETTER {TLetter.new(:LEX_SPECIAL_LETTER, val[0])}
| LEX_SPACE {TLetter.new(:LEX_SPACE, val[0])}
end