Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Unified Diff: tools/lexer_generator/regex_lexer.py

Issue 59263003: Experimental lexer generator: parse \000 etc. inside char classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: . Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/lexer_generator/regex_parser.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/regex_lexer.py
diff --git a/tools/lexer_generator/regex_lexer.py b/tools/lexer_generator/regex_lexer.py
index 55c3bda94192668f6c085c55e5561103b680f5d2..8fb80b5d16cd71c207ab8eb1070996fdf5b7741f 100644
--- a/tools/lexer_generator/regex_lexer.py
+++ b/tools/lexer_generator/regex_lexer.py
@@ -53,6 +53,7 @@ class RegexLexer:
'RANGE',
'NOT',
'CLASS_LITERAL',
+ 'CLASS_LITERAL_AS_OCTAL',
'CHARACTER_CLASS',
)
@@ -93,13 +94,17 @@ class RegexLexer:
t_class_NOT = '\^'
t_class_CHARACTER_CLASS = r':\w+:'
+ def t_class_CLASS_LITERAL_AS_OCTAL(self, t):
+ r'\\\d+'
+ return t
+
def t_class_ESCAPED_CLASS_LITERAL(self, t):
r'\\\^|\\-|\\\[|\\\]|\\\:|\\\w'
t.type = 'CLASS_LITERAL'
t.value = t.value[1:]
return t
- t_class_CLASS_LITERAL = r'[\w $_+]' # fix this
+ t_class_CLASS_LITERAL = r'[\w $_+]'
def t_REPEAT_BEGIN(self, t):
r'\{'
« no previous file with comments | « no previous file | tools/lexer_generator/regex_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698