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

Unified Diff: src/lexer/lexer_py.re

Issue 91833002: Experimental scanner: keeping track of octal numbers octal escapes. (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 | « src/lexer/lexer-shell.cc ('k') | test/lexer/cornercases/octals.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lexer/lexer_py.re
diff --git a/src/lexer/lexer_py.re b/src/lexer/lexer_py.re
index f347fe6df4d117771177328c07252ba35e5574f4..df03fe7c758da990205bcd7ca61e11882da946a8 100644
--- a/src/lexer/lexer_py.re
+++ b/src/lexer/lexer_py.re
@@ -32,6 +32,7 @@ digit = [0-9];
hex_digit = [0-9a-fA-F];
single_escape_char = ['"\\bfnrtv];
maybe_exponent = /([eE][\-+]?[:digit:]+)?/;
+octal_number = /0[0-7]+/;
number =
/0[xX][:hex_digit:]+/ | (
/\.[:digit:]+/ maybe_exponent |
@@ -96,6 +97,7 @@ eos = [:eos:];
"<" <|token(LT)|>
">" <|token(GT)|>
+octal_number <|octal_number|>
number <|token(NUMBER)|>
number identifier_char <|token(ILLEGAL)|>
number "\\" <|token(ILLEGAL)|>
@@ -199,7 +201,9 @@ default_action <do_token_and_go_forward(ILLEGAL)>
"\\" line_terminator_sequence <||continue>
/\\[x][:hex_digit:]{2}/ <set_has_escapes||continue>
/\\[u][:hex_digit:]{4}/ <set_has_escapes||continue>
-/\\[^xu:line_terminator:]/ <set_has_escapes||continue>
+/\\[1-7]/ <octal_inside_string||continue>
+/\\[0-7]{2,3}/ <octal_inside_string||continue>
+/\\[^xu1-7:line_terminator:]/ <set_has_escapes||continue>
"\\" <|token(ILLEGAL)|>
line_terminator <|token(ILLEGAL)|>
"\"" <|token(STRING)|>
@@ -211,7 +215,9 @@ catch_all <||continue>
"\\" line_terminator_sequence <||continue>
/\\[x][:hex_digit:]{2}/ <set_has_escapes||continue>
/\\[u][:hex_digit:]{4}/ <set_has_escapes||continue>
-/\\[^xu:line_terminator:]/ <set_has_escapes||continue>
+/\\[1-7]/ <octal_inside_string||continue>
+/\\[0-7]{2,3}/ <octal_inside_string||continue>
+/\\[^xu1-7:line_terminator:]/ <set_has_escapes||continue>
"\\" <|token(ILLEGAL)|>
line_terminator <|token(ILLEGAL)|>
"'" <|token(STRING)|>
« no previous file with comments | « src/lexer/lexer-shell.cc ('k') | test/lexer/cornercases/octals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698