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

Unified Diff: tools/lexer_generator/rule_parser.py

Issue 66313005: Experimental parser: better escaping (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 | « tools/lexer_generator/regex_lexer.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/rule_parser.py
diff --git a/tools/lexer_generator/rule_parser.py b/tools/lexer_generator/rule_parser.py
index 046806fd0e4f36461f2b66485540fd8609222365..86f62d641012c6384030495579c189738b00619b 100644
--- a/tools/lexer_generator/rule_parser.py
+++ b/tools/lexer_generator/rule_parser.py
@@ -150,8 +150,9 @@ class RuleParser:
def p_regex_string_literal(self, p):
'regex_string_literal : STRING'
+ string = p[1][1:-1]
escape_char = lambda string, char: string.replace(char, "\\" + char)
- string = reduce(escape_char, "\+?*|.[](){}", p[1][1:-1])
+ string = reduce(escape_char, "+?*|.[](){}", string).replace("\\\"", "\"")
p[0] = RegexParser.parse(string)
def p_regex(self, p):
« no previous file with comments | « tools/lexer_generator/regex_lexer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698