First work on using a Lexesis lexer in the regex parser

This commit is contained in:
Robin Jadoul 2016-05-29 21:06:15 +02:00
parent 2864ba5a43
commit 3fd362bf2d
2 changed files with 38 additions and 3 deletions

View File

@ -158,9 +158,6 @@ namespace lxs {
case ']':
case '?':
case '.':
case '\'':
case '"':
case '-':
break;
case 'n':
c = '\n'; break;

38
src/regexLexer.lxs Normal file
View File

@ -0,0 +1,38 @@
CHAR_CLASS = \[^?\]?-?([^]-]-[^]-]|[^]-])+-?\]|\[^?(-|\]|\]-)\]
#All the escape sequences
TAB = \\t
NEWLINE = \\n
CARRIAGE_RETURN = \\r
BACKSPACE = \\b
SPACE = \\s|\s
BELL = \\a
FORMFEED = \\f
VTAB = \\v
BACKSLASH = \\\\
ESCAPED_STAR = \\\*
ESCAPED_PLUS = \\\+
ESCAPED_PIPE = \\\|
ESCAPED_LPAREN = \\\(
ESCAPED_RPAREN = \\\)
ESCAPED_LBRACKET = \\\[
ESCAPED_RBRACKET = \\\]
ESCAPED_QUESTIONMARK = \\\?
ESCAPED_DOT = \\\.
# The special chars
DOT = \.
STAR = \*
PLUS = \+
QUESTIONMARK = \?
PIPE = \|
LPAREN = \(
RPAREN = \)
# Anything other than these is valid
# It cannot be ] or [, since those should be handled by CHAR_CLASS
# If it is a \, it is an invalid escape sequence
CHAR = [^][\]
ERROR = .