lib/regextest/front/parser.y in regextest-0.1.5 vs lib/regextest/front/parser.y in regextest-0.1.6
- old
+ new
@@ -60,10 +60,11 @@
| LEX_BACK_REFER {BackRefer.new(:LEX_BACK_REFER, val[0])}
| LEX_CODE_LITERAL {TLetter.new(:LEX_CODE_LITERAL, val[0])}
| LEX_NAMED_REFER {BackRefer.new(:LEX_NAMED_REFER, val[0])}
| LEX_NAMED_GENERATE {BackRefer.new(:LEX_NAMED_GENERATE, 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])}
| LEX_SIMPLIFIED_CLASS {TLetter.new(:LEX_SIMPLIFIED_CLASS, val[0])}
| LEX_UNICODE_CLASS {TLetter.new(:LEX_UNICODE_CLASS, val[0])}
@@ -75,11 +76,11 @@
| LEX_ANC_STRING_BEGIN {Anchor.new(:LEX_ANC_STRING_BEGIN, val[0])}
| LEX_ANC_STRING_END {Anchor.new(:LEX_ANC_STRING_END, val[0])}
| LEX_ANC_STRING_END2 {Anchor.new(:LEX_ANC_STRING_END2, val[0])}
| LEX_ANC_LOOK_BEHIND2 {Anchor.new(:LEX_ANC_LOOK_BEHIND2, val[0])}
| LEX_ANC_MATCH_START {Anchor.new(:LEX_ANC_MATCH_START, val[0])}
- | LEX_SPECIAL_LETTER {TLetter.new(:LEX_SPECIAL_LETTER, val[0])}
+ | LEX_SPECIAL_LETTER {SpecialLetter.new(val[0])}
| LEX_MINUS {TLetter.new(:LEX_CHAR, val[0])} # no special meaning at basic mode
| LEX_AND_AND {TLetter.new(:LEX_AND_AND, val[0])}
| LEX_SPACE {TLetter.new(:LEX_SPACE, val[0])}
| LEX_SIMPLE_ESCAPE {TLetter.new(:LEX_SIMPLE_ESCAPE, val[0])}
| LEX_SHARP {TLetter.new(:LEX_CHAR, val[0])} # no special meaning at basic mode
@@ -154,24 +155,26 @@
| LEX_ANC_STRING_BEGIN {Anchor.new(:LEX_ANC_STRING_BEGIN, val[0])}
| LEX_ANC_STRING_END {Anchor.new(:LEX_ANC_STRING_END, val[0])}
| LEX_ANC_STRING_END2 {Anchor.new(:LEX_ANC_STRING_END2, val[0])}
| LEX_ANC_LOOK_BEHIND2 {Anchor.new(:LEX_ANC_LOOK_BEHIND2, val[0])}
| LEX_ANC_MATCH_START {Anchor.new(:LEX_ANC_MATCH_START, val[0])}
- | LEX_SPECIAL_LETTER {TLetter.new(:LEX_SPECIAL_LETTER, val[0])}
+ | LEX_SPECIAL_LETTER {SpecialLetter.new(val[0])}
| LEX_MINUS {TLetter.new(:LEX_CHAR, val[0])}
| LEX_AND_AND {TLetter.new(:LEX_AND_AND, val[0])}
| LEX_NEW_LINE {TEmpty.new} # ignore new line at extended mode
| LEX_SPACE {TEmpty.new} # ignore spaces at extended mode
| LEX_SIMPLE_ESCAPE {TLetter.new(:LEX_SIMPLE_ESCAPE, val[0])}
| LEX_ANY_LETTER {TLetter.new(:LEX_ANY_LETTER, val[0])}
| LEX_SHARP reg_comment_ex {TEmpty.new}
# comment of extended mode
- reg_comment_ex: LEX_NEW_LINE # end of the comment
+ reg_comment_ex:
+ | LEX_NEW_LINE # end of the comment
| LEX_CHAR reg_comment_ex
| LEX_OCTET reg_comment_ex
| LEX_BACK_REFER reg_comment_ex
+ | LEX_SPECIAL_LETTER reg_comment_ex
| LEX_CODE_LITERAL reg_comment_ex
| LEX_NAMED_REFER reg_comment_ex
| LEX_NAMED_GENERATE reg_comment_ex
| LEX_CONTROL_LETTER reg_comment_ex
| LEX_META_LETTER reg_comment_ex
@@ -215,10 +218,11 @@
require 'regextest/front/repeatable' # parser class for a repeatable elements
require 'regextest/front/sequence' # parser class for a sequence of elements
require 'regextest/front/bracket' # parser class for a character class (bracket)
require 'regextest/front/anchor' # parser class for a anchor
require 'regextest/front/back-refer' # parser class for a back reference
+require 'regextest/front/special-letter' # parser class for a special letter
require 'regextest/front/bracket-parser' # bracket parser
---- inner
# modules for sharing procedures with bracket parser
include Regextest::Front::Empty
@@ -229,9 +233,10 @@
include Regextest::Front::Repeatable
include Regextest::Front::Sequence
include Regextest::Front::Bracket
include Regextest::Front::Anchor
include Regextest::Front::BackRefer
+include Regextest::Front::SpecialLetter
# execute to parse
def parse(lex_words, options)
@options = options