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

Side by Side 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 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/lexer/lexer-shell.cc ('k') | test/lexer/cornercases/octals.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 the V8 project authors. All rights reserved. 1 # Copyright 2013 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 14 matching lines...) Expand all
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 line_terminator = [:line_terminator:]; 28 line_terminator = [:line_terminator:];
29 identifier_start = [$_:letter:]; 29 identifier_start = [$_:letter:];
30 identifier_char = [:identifier_start::identifier_part_not_letter:]; 30 identifier_char = [:identifier_start::identifier_part_not_letter:];
31 digit = [0-9]; 31 digit = [0-9];
32 hex_digit = [0-9a-fA-F]; 32 hex_digit = [0-9a-fA-F];
33 single_escape_char = ['"\\bfnrtv]; 33 single_escape_char = ['"\\bfnrtv];
34 maybe_exponent = /([eE][\-+]?[:digit:]+)?/; 34 maybe_exponent = /([eE][\-+]?[:digit:]+)?/;
35 octal_number = /0[0-7]+/;
35 number = 36 number =
36 /0[xX][:hex_digit:]+/ | ( 37 /0[xX][:hex_digit:]+/ | (
37 /\.[:digit:]+/ maybe_exponent | 38 /\.[:digit:]+/ maybe_exponent |
38 /[:digit:]+(\.[:digit:]*)?/ maybe_exponent ); 39 /[:digit:]+(\.[:digit:]*)?/ maybe_exponent );
39 harmony_number = "0"[bBoO][:digit:]+; 40 harmony_number = "0"[bBoO][:digit:]+;
40 line_terminator_sequence = /[:line_terminator:]|\r\n/; 41 line_terminator_sequence = /[:line_terminator:]|\r\n/;
41 eos = [:eos:]; 42 eos = [:eos:];
42 43
43 # grammar is 44 # grammar is
44 # regex <action_on_state_entry|action_on_match|transition> 45 # regex <action_on_state_entry|action_on_match|transition>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ">>>" <|token(SHR)|> 90 ">>>" <|token(SHR)|>
90 "<<=" <|token(ASSIGN_SHL)|> 91 "<<=" <|token(ASSIGN_SHL)|>
91 ">>=" <|token(ASSIGN_SAR)|> 92 ">>=" <|token(ASSIGN_SAR)|>
92 "<=" <|token(LTE)|> 93 "<=" <|token(LTE)|>
93 ">=" <|token(GTE)|> 94 ">=" <|token(GTE)|>
94 "<<" <|token(SHL)|> 95 "<<" <|token(SHL)|>
95 ">>" <|token(SAR)|> 96 ">>" <|token(SAR)|>
96 "<" <|token(LT)|> 97 "<" <|token(LT)|>
97 ">" <|token(GT)|> 98 ">" <|token(GT)|>
98 99
100 octal_number <|octal_number|>
99 number <|token(NUMBER)|> 101 number <|token(NUMBER)|>
100 number identifier_char <|token(ILLEGAL)|> 102 number identifier_char <|token(ILLEGAL)|>
101 number "\\" <|token(ILLEGAL)|> 103 number "\\" <|token(ILLEGAL)|>
102 104
103 harmony_number <|harmony_token(numeric_literals, NUMBER, ILLEGA L)|> 105 harmony_number <|harmony_token(numeric_literals, NUMBER, ILLEGA L)|>
104 harmony_number identifier_char <|token(ILLEGAL)|> 106 harmony_number identifier_char <|token(ILLEGAL)|>
105 harmony_number "\\" <|token(ILLEGAL)|> 107 harmony_number "\\" <|token(ILLEGAL)|>
106 108
107 "(" <|token(LPAREN)|> 109 "(" <|token(LPAREN)|>
108 ")" <|token(RPAREN)|> 110 ")" <|token(RPAREN)|>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 next_.has_escapes = true; 194 next_.has_escapes = true;
193 }|token(IDENTIFIER)|Identifier> 195 }|token(IDENTIFIER)|Identifier>
194 196
195 eos <|terminate|> 197 eos <|terminate|>
196 default_action <do_token_and_go_forward(ILLEGAL)> 198 default_action <do_token_and_go_forward(ILLEGAL)>
197 199
198 <<DoubleQuoteString>> 200 <<DoubleQuoteString>>
199 "\\" line_terminator_sequence <||continue> 201 "\\" line_terminator_sequence <||continue>
200 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue> 202 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue>
201 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue> 203 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue>
202 /\\[^xu:line_terminator:]/ <set_has_escapes||continue> 204 /\\[1-7]/ <octal_inside_string||continue>
205 /\\[0-7]{2,3}/ <octal_inside_string||continue>
206 /\\[^xu1-7:line_terminator:]/ <set_has_escapes||continue>
203 "\\" <|token(ILLEGAL)|> 207 "\\" <|token(ILLEGAL)|>
204 line_terminator <|token(ILLEGAL)|> 208 line_terminator <|token(ILLEGAL)|>
205 "\"" <|token(STRING)|> 209 "\"" <|token(STRING)|>
206 eos <|terminate_illegal|> 210 eos <|terminate_illegal|>
207 catch_all <||continue> 211 catch_all <||continue>
208 212
209 <<SingleQuoteString>> 213 <<SingleQuoteString>>
210 # TODO subgraph for '\' 214 # TODO subgraph for '\'
211 "\\" line_terminator_sequence <||continue> 215 "\\" line_terminator_sequence <||continue>
212 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue> 216 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue>
213 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue> 217 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue>
214 /\\[^xu:line_terminator:]/ <set_has_escapes||continue> 218 /\\[1-7]/ <octal_inside_string||continue>
219 /\\[0-7]{2,3}/ <octal_inside_string||continue>
220 /\\[^xu1-7:line_terminator:]/ <set_has_escapes||continue>
215 "\\" <|token(ILLEGAL)|> 221 "\\" <|token(ILLEGAL)|>
216 line_terminator <|token(ILLEGAL)|> 222 line_terminator <|token(ILLEGAL)|>
217 "'" <|token(STRING)|> 223 "'" <|token(STRING)|>
218 eos <|terminate_illegal|> 224 eos <|terminate_illegal|>
219 catch_all <||continue> 225 catch_all <||continue>
220 226
221 <<Identifier>> 227 <<Identifier>>
222 identifier_char <|token(IDENTIFIER)|continue> 228 identifier_char <|token(IDENTIFIER)|continue>
223 /\\u[:hex_digit:]{4}/ <{ 229 /\\u[:hex_digit:]{4}/ <{
224 if (V8_UNLIKELY(!ValidIdentifierPart())) { 230 if (V8_UNLIKELY(!ValidIdentifierPart())) {
225 goto default_action; 231 goto default_action;
226 } 232 }
227 next_.has_escapes = true; 233 next_.has_escapes = true;
228 }|token(IDENTIFIER)|continue> 234 }|token(IDENTIFIER)|continue>
229 235
230 <<SingleLineComment>> 236 <<SingleLineComment>>
231 line_terminator <|line_terminator|> 237 line_terminator <|line_terminator|>
232 eos <|skip_and_terminate|> 238 eos <|skip_and_terminate|>
233 catch_all <||continue> 239 catch_all <||continue>
234 240
235 <<MultiLineComment>> 241 <<MultiLineComment>>
236 /\*+\// <|skip|> 242 /\*+\// <|skip|>
237 # TODO find a way to generate the below rule 243 # TODO find a way to generate the below rule
238 /\*+[^\/*]/ <||continue> 244 /\*+[^\/*]/ <||continue>
239 line_terminator <line_terminator||continue> 245 line_terminator <line_terminator||continue>
240 eos <|terminate_illegal|> 246 eos <|terminate_illegal|>
241 catch_all <||continue> 247 catch_all <||continue>
OLDNEW
« 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