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

Side by Side Diff: src/lexer/lexer_py.re

Issue 135053003: Experimental parser: remove inline code from lexer rules (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 11 months 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 | « no previous file | tools/lexer_generator/code_generator.jinja » ('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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 /0[xX][:hex_digit:]+/ | ( 47 /0[xX][:hex_digit:]+/ | (
48 /\.[:digit:]+/ maybe_exponent | 48 /\.[:digit:]+/ maybe_exponent |
49 non_octal_whole_part /(\.[:digit:]*)?/ maybe_exponent ); 49 non_octal_whole_part /(\.[:digit:]*)?/ maybe_exponent );
50 harmony_number = "0"[bBoO][:digit:]+; 50 harmony_number = "0"[bBoO][:digit:]+;
51 line_terminator_sequence = /[:line_terminator:]|(\r\n|\n\r)/; 51 line_terminator_sequence = /[:line_terminator:]|(\r\n|\n\r)/;
52 eos = [:eos:]; 52 eos = [:eos:];
53 53
54 # grammar is 54 # grammar is
55 # regex <action_on_state_entry|action_on_match|transition> 55 # regex <action_on_state_entry|action_on_match|transition>
56 # 56 #
57 # actions can be c code enclosed in {} or identifiers to be passed to codegen 57 # actions are identifiers to be passed to codegen
58 # transition must be 'continue' or the name of a subgraph 58 # transition must be 'continue' or the name of a subgraph
59 59
60 <<default>> 60 <<default>>
61 61
62 "|=" <|token(ASSIGN_BIT_OR)|> 62 "|=" <|token(ASSIGN_BIT_OR)|>
63 "^=" <|token(ASSIGN_BIT_XOR)|> 63 "^=" <|token(ASSIGN_BIT_XOR)|>
64 "&=" <|token(ASSIGN_BIT_AND)|> 64 "&=" <|token(ASSIGN_BIT_AND)|>
65 "+=" <|token(ASSIGN_ADD)|> 65 "+=" <|token(ASSIGN_ADD)|>
66 "-=" <|token(ASSIGN_SUB)|> 66 "-=" <|token(ASSIGN_SUB)|>
67 "*=" <|token(ASSIGN_MUL)|> 67 "*=" <|token(ASSIGN_MUL)|>
68 "/=" <|token(ASSIGN_DIV)|> 68 "/=" <|token(ASSIGN_DIV)|>
69 "%=" <|token(ASSIGN_MOD)|> 69 "%=" <|token(ASSIGN_MOD)|>
70 70
71 "===" <|token(EQ_STRICT)|> 71 "===" <|token(EQ_STRICT)|>
72 "==" <|token(EQ)|> 72 "==" <|token(EQ)|>
73 "=" <|token(ASSIGN)|> 73 "=" <|token(ASSIGN)|>
74 "!==" <|token(NE_STRICT)|> 74 "!==" <|token(NE_STRICT)|>
75 "!=" <|token(NE)|> 75 "!=" <|token(NE)|>
76 "!" <|token(NOT)|> 76 "!" <|token(NOT)|>
77 77
78 "//" <||SingleLineComment> 78 "//" <||SingleLineComment>
79 "/*" <set_marker(2)||MultiLineComment> 79 "/*" <set_marker(2)||MultiLineComment>
80 "<!--" <||SingleLineComment> 80 "<!--" <||SingleLineComment>
81 81
82 "<!-" <|{ 82 "<!-" <|backtrack(2, LT)|>
83 BACKWARD(2); 83 "<!" <|backtrack(1, LT)|>
84 DO_TOKEN(Token::LT); 84 "-->" <if_line_terminator_backtrack(1, DEC)||SingleLineComment>
85 return;
86 }|>
87
88 "<!" <|{
89 BACKWARD(1);
90 DO_TOKEN(Token::LT);
91 return;
92 }|>
93
94 "-->" <{
95 if (!has_line_terminator_before_next_) {
96 BACKWARD(1);
97 DO_TOKEN(Token::DEC);
98 return;
99 }
100 }||SingleLineComment>
101 85
102 ">>>=" <|token(ASSIGN_SHR)|> 86 ">>>=" <|token(ASSIGN_SHR)|>
103 ">>>" <|token(SHR)|> 87 ">>>" <|token(SHR)|>
104 "<<=" <|token(ASSIGN_SHL)|> 88 "<<=" <|token(ASSIGN_SHL)|>
105 ">>=" <|token(ASSIGN_SAR)|> 89 ">>=" <|token(ASSIGN_SAR)|>
106 "<=" <|token(LTE)|> 90 "<=" <|token(LTE)|>
107 ">=" <|token(GTE)|> 91 ">=" <|token(GTE)|>
108 "<<" <|token(SHL)|> 92 "<<" <|token(SHL)|>
109 ">>" <|token(SAR)|> 93 ">>" <|token(SAR)|>
110 "<" <|token(LT)|> 94 "<" <|token(LT)|>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 "true" <|token(TRUE_LITERAL)|> 177 "true" <|token(TRUE_LITERAL)|>
194 "try" <|token(TRY)|> 178 "try" <|token(TRY)|>
195 "typeof" <|token(TYPEOF)|> 179 "typeof" <|token(TYPEOF)|>
196 "var" <|token(VAR)|> 180 "var" <|token(VAR)|>
197 "void" <|token(VOID)|> 181 "void" <|token(VOID)|>
198 "while" <|token(WHILE)|> 182 "while" <|token(WHILE)|>
199 "with" <|token(WITH)|> 183 "with" <|token(WITH)|>
200 "yield" <|token(YIELD)|> 184 "yield" <|token(YIELD)|>
201 185
202 identifier_start <|token(IDENTIFIER)|Identifier> 186 identifier_start <|token(IDENTIFIER)|Identifier>
203 /\\u[:hex_digit:]{4}/ <{ 187 /\\u[:hex_digit:]{4}/ <check_escaped_identifier_start|token(IDENTIFIER)|Identifi er>
204 if (V8_UNLIKELY(!ValidIdentifierStart())) {
205 goto default_action;
206 }
207 next_.has_escapes = true;
208 }|token(IDENTIFIER)|Identifier>
209 188
210 eos <|terminate|> 189 eos <|terminate|>
211 default_action <do_token_and_go_forward(ILLEGAL)> 190 default_action <do_token_and_go_forward(ILLEGAL)>
212 191
213 <<DoubleQuoteString>> 192 <<DoubleQuoteString>>
214 "\\" line_terminator_sequence <set_has_escapes||continue> 193 "\\" line_terminator_sequence <set_has_escapes||continue>
215 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue> 194 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue>
216 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue> 195 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue>
217 /\\[1-7]/ <octal_inside_string||continue> 196 /\\[1-7]/ <octal_inside_string||continue>
218 /\\[0-7][0-7]+/ <octal_inside_string||continue> 197 /\\[0-7][0-7]+/ <octal_inside_string||continue>
(...skipping 15 matching lines...) Expand all
234 "\\0" <set_has_escapes||continue> 213 "\\0" <set_has_escapes||continue>
235 /\\[^xu0-7:line_terminator:]/ <set_has_escapes||continue> 214 /\\[^xu0-7:line_terminator:]/ <set_has_escapes||continue>
236 "\\" <|token(ILLEGAL)|> 215 "\\" <|token(ILLEGAL)|>
237 line_terminator <|token(ILLEGAL)|> 216 line_terminator <|token(ILLEGAL)|>
238 "'" <|token(STRING)|> 217 "'" <|token(STRING)|>
239 eos <|terminate_illegal|> 218 eos <|terminate_illegal|>
240 catch_all <||continue> 219 catch_all <||continue>
241 220
242 <<Identifier>> 221 <<Identifier>>
243 identifier_char <|token(IDENTIFIER)|continue> 222 identifier_char <|token(IDENTIFIER)|continue>
244 /\\u[:hex_digit:]{4}/ <{ 223 /\\u[:hex_digit:]{4}/ <check_escaped_identifier_part|token(IDENTIFIER)|continue>
245 if (V8_UNLIKELY(!ValidIdentifierPart())) {
246 goto default_action;
247 }
248 next_.has_escapes = true;
249 }|token(IDENTIFIER)|continue>
250 224
251 <<SingleLineComment>> 225 <<SingleLineComment>>
252 line_terminator <|line_terminator|> 226 line_terminator <|line_terminator|>
253 eos <|skip_and_terminate|> 227 eos <|skip_and_terminate|>
254 catch_all <||continue> 228 catch_all <||continue>
255 229
256 <<MultiLineComment>> 230 <<MultiLineComment>>
257 /\*+\// <|skip|> 231 /\*+\// <|skip|>
258 # TODO find a way to generate the below rule 232 # TODO find a way to generate the below rule
259 /\*+[^\/*]/ <||continue> 233 /\*+[^\/*]/ <||continue>
260 line_terminator <line_terminator_in_multiline_comment||continue> 234 line_terminator <line_terminator_in_multiline_comment||continue>
261 eos <|terminate_illegal|> 235 eos <|terminate_illegal|>
262 catch_all <||continue> 236 catch_all <||continue>
OLDNEW
« no previous file with comments | « no previous file | tools/lexer_generator/code_generator.jinja » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698