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

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

Issue 138973007: Experimental parser: support subgraph inlining (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 10 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/gyp/v8.gyp » ('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 # Character classes and auxiliary regexps. 28 # Character classes and auxiliary regexps.
29 29
30 line_terminator = [:line_terminator:]; 30 line_terminator = [:line_terminator:];
31 identifier_start = [$_:letter:]; 31 identifier_start = [$_:letter:];
32 identifier_char = [:identifier_start::identifier_part_not_letter:]; 32 identifier_char = [:identifier_start::identifier_part_not_letter:];
33 digit = [0-9]; 33 digit = [0-9];
34 hex_digit = [0-9a-fA-F]; 34 hex_digit = [0-9a-fA-F];
35 unicode_escape = /\\u[:hex_digit:]{4}/;
35 single_escape_char = ['"\\bfnrtv]; 36 single_escape_char = ['"\\bfnrtv];
36 maybe_exponent = /([eE][\-+]?[:digit:]+)?/; 37 maybe_exponent = /([eE][\-+]?[:digit:]+)?/;
37 octal_number = /0[0-7]+/; 38 octal_number = /0[0-7]+/;
38 39
39 # Octal numbers are pretty complicated. For example, 01.0 is invalid, since it's 40 # Octal numbers are pretty complicated. For example, 01.0 is invalid, since it's
40 # parsed as 2 numbers (01 and .0), since 01 is a valid octal number. However, 41 # parsed as 2 numbers (01 and .0), since 01 is a valid octal number. However,
41 # 09.0 is a valid, since 09 cannot be octal. In addition, 0 and 0.1 are valid 42 # 09.0 is a valid, since 09 cannot be octal. In addition, 0 and 0.1 are valid
42 # numbers starting with 0. 43 # numbers starting with 0.
43 44
44 non_octal_whole_part = "0" | ( 45 non_octal_whole_part = "0" | (
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 "true" <|token(TRUE_LITERAL)|> 188 "true" <|token(TRUE_LITERAL)|>
188 "try" <|token(TRY)|> 189 "try" <|token(TRY)|>
189 "typeof" <|token(TYPEOF)|> 190 "typeof" <|token(TYPEOF)|>
190 "var" <|token(VAR)|> 191 "var" <|token(VAR)|>
191 "void" <|token(VOID)|> 192 "void" <|token(VOID)|>
192 "while" <|token(WHILE)|> 193 "while" <|token(WHILE)|>
193 "with" <|token(WITH)|> 194 "with" <|token(WITH)|>
194 "yield" <|token(YIELD)|> 195 "yield" <|token(YIELD)|>
195 196
196 identifier_start <|token(IDENTIFIER)|Identifier> 197 identifier_start <|token(IDENTIFIER)|Identifier>
197 /\\u[:hex_digit:]{4}/ <check_escaped_identifier_start|token(IDENTIFIER)|Identifi er> 198 unicode_escape <check_escaped_identifier_start|token(IDENTIFIER)|Identifier>
198 199
199 eos <terminate> 200 eos <terminate>
200 default_action <do_token_and_go_forward(ILLEGAL)> 201 default_action <do_token_and_go_forward(ILLEGAL)>
201 202
202 <<DoubleQuoteString>> 203 <<DoubleQuoteString>>
203 "\\" line_terminator_sequence <set_has_escapes||continue> 204 epsilon <StringSubgraph>
204 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue>
205 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue>
206 /\\[1-7]/ <octal_inside_string||continue>
207 /\\[0-7][0-7]+/ <octal_inside_string||continue>
208 "\\0" <set_has_escapes||continue>
209 /\\[^xu0-7:line_terminator:]/ <set_has_escapes||continue>
210 "\\" <|token(ILLEGAL)|>
211 line_terminator <|token(ILLEGAL)|>
212 "\"" <|token(STRING)|> 205 "\"" <|token(STRING)|>
213 catch_all <||continue> 206 catch_all <||continue>
214 eos <terminate_illegal> 207 eos <terminate_illegal>
215 208
216 <<SingleQuoteString>> 209 <<SingleQuoteString>>
217 # TODO subgraph for '\' 210 epsilon <StringSubgraph>
218 "\\" line_terminator_sequence <set_has_escapes||continue>
219 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue>
220 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue>
221 /\\[1-7]/ <octal_inside_string||continue>
222 /\\[0-7][0-7]+/ <octal_inside_string||continue>
223 "\\0" <set_has_escapes||continue>
224 /\\[^xu0-7:line_terminator:]/ <set_has_escapes||continue>
225 "\\" <|token(ILLEGAL)|>
226 line_terminator <|token(ILLEGAL)|>
227 "'" <|token(STRING)|> 211 "'" <|token(STRING)|>
228 catch_all <||continue> 212 catch_all <||continue>
229 eos <terminate_illegal> 213 eos <terminate_illegal>
230 214
215 <<StringSubgraph>>
216 "\\" line_terminator_sequence <set_has_escapes||continue(1)>
217 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue(1)>
218 unicode_escape <set_has_escapes||continue(1)>
219 /\\[1-7]/ <octal_inside_string||continue(1)>
220 /\\[0-7][0-7]+/ <octal_inside_string||continue(1)>
221 "\\0" <set_has_escapes||continue(1)>
222 /\\[^xu0-7:line_terminator:]/ <set_has_escapes||continue(1)>
223 "\\" <|token(ILLEGAL)|>
224 line_terminator <|token(ILLEGAL)|>
225
231 <<Identifier>> 226 <<Identifier>>
232 identifier_char <|token(IDENTIFIER)|continue> 227 identifier_char <|token(IDENTIFIER)|continue>
233 /\\u[:hex_digit:]{4}/ <check_escaped_identifier_part|token(IDENTIFIER)|continue> 228 /\\u[:hex_digit:]{4}/ <check_escaped_identifier_part|token(IDENTIFIER)|continue>
234 229
235 <<SingleLineComment>> 230 <<SingleLineComment>>
236 line_terminator <|line_terminator|> 231 line_terminator <|line_terminator|>
232 catch_all <||continue>
237 eos <skip_and_terminate> 233 eos <skip_and_terminate>
238 catch_all <||continue>
239 234
240 <<MultiLineComment>> 235 <<MultiLineComment>>
241 /\*+\// <|skip|> 236 /\*+\// <|skip|>
242 # TODO find a way to generate the below rule 237 # TODO(dcarney): find a way to generate the below rule
243 /\*+[^\/*]/ <||continue> 238 /\*+[^\/*]/ <||continue>
244 line_terminator <line_terminator_in_multiline_comment||continue> 239 line_terminator <line_terminator_in_multiline_comment||continue>
245 catch_all <||continue> 240 catch_all <||continue>
246 eos <terminate_illegal> 241 eos <terminate_illegal>
OLDNEW
« no previous file with comments | « no previous file | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698