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

Side by Side Diff: tools/lexer_generator/code_generator.jinja

Issue 145623002: Experimental parser: cleanup deferred transitions (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.py » ('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 25 matching lines...) Expand all
36 {%- if r[0] == 'PRIMARY_RANGE' -%} 36 {%- if r[0] == 'PRIMARY_RANGE' -%}
37 {%- if r[1][0] == r[1][1] -%} 37 {%- if r[1][0] == r[1][1] -%}
38 primary_char == {{r[1][0]}} 38 primary_char == {{r[1][0]}}
39 {%- elif r[1][0] == 0 -%} 39 {%- elif r[1][0] == 0 -%}
40 primary_char <= {{r[1][1]}} 40 primary_char <= {{r[1][1]}}
41 {%- elif r[1][1] == upper_bound and not encoding == 'utf16'-%} 41 {%- elif r[1][1] == upper_bound and not encoding == 'utf16'-%}
42 primary_char >= {{r[1][0]}} 42 primary_char >= {{r[1][0]}}
43 {%- else -%} 43 {%- else -%}
44 ({{r[1][0]}} <= primary_char && primary_char <= {{r[1][1]}}) 44 ({{r[1][0]}} <= primary_char && primary_char <= {{r[1][1]}})
45 {%- endif -%} 45 {%- endif -%}
46 {%- elif r[0] == 'CLASS' -%}
47 {%- if r[1] == 'eos' -%}
48 (primary_char == 0 && cursor_ >= buffer_end_)
49 {%- elif r[1] == 'zero' -%}
50 (primary_char == 0 && cursor_ < buffer_end_)
51 {%- else %}
52 uncompilable code for {{encoding}} {{r[0]}} {{r[1]}}
53 {%- endif -%}
54 {# These classes require long_char and to be outside the primary range #} 46 {# These classes require long_char and to be outside the primary range #}
55 {%- elif r[0] == 'LONG_CHAR_CLASS' and encoding in ['utf16', 'utf8'] -%} 47 {%- elif r[0] == 'LONG_CHAR_CLASS' and encoding in ['utf16', 'utf8'] -%}
56 {%- if r[1] == 'byte_order_mark' -%} 48 {%- if r[1] == 'byte_order_mark' -%}
57 (long_char == 0xfffe || long_char == 0xfeff) 49 (long_char == 0xfffe || long_char == 0xfeff)
58 {%- elif r[1] == 'call' -%} 50 {%- elif r[1] == 'call' -%}
59 unicode_cache_->{{r[2]}}(long_char) 51 unicode_cache_->{{r[2]}}(long_char)
60 {%- elif r[1] == 'invert' -%} 52 {%- elif r[1] == 'invert' -%}
61 !({{do_key(r[2])}}) 53 !({{do_key(r[2])}})
62 {%- elif r[1] == 'catch_all' -%} 54 {%- elif r[1] == 'catch_all' -%}
63 (true || long_char == 0) /* {{r[1]}} */ 55 (true || long_char == 0) /* {{r[1]}} */
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 {% endfor -%} 259 {% endfor -%}
268 } 260 }
269 {%- endif -%} 261 {%- endif -%}
270 262
271 {%- for key, jump_id in state['if_transitions'] %} 263 {%- for key, jump_id in state['if_transitions'] %}
272 if ({{do_key(key)}}) { // normal if transition 264 if ({{do_key(key)}}) { // normal if transition
273 {{ do_transition(jump_id) }} 265 {{ do_transition(jump_id) }}
274 } 266 }
275 {% endfor -%} 267 {% endfor -%}
276 268
277 {%- for key, jump_id in state['deferred_transitions'] %} 269 {%- if state['deferred_transitions'] -%}
278 if ({{do_key(key)}}) { // deferred transition
279 {{ do_transition(jump_id) }}
280 }
281 {% endfor -%}
282
283 {%- if state['long_char_transitions'] -%}
284 if ({{long_char_check()}}) { 270 if ({{long_char_check()}}) {
285 next_.is_onebyte = false; 271 next_.is_onebyte = false;
286 {{long_char_create()}} 272 {{long_char_create()}}
287 {%- for key, jump_id in state['long_char_transitions'] %} 273 {%- for key, jump_id in state['deferred_transitions'] %}
288 if ({{do_key(key)}}) { // long_char transition 274 if ({{do_key(key)}}) { // long_char transition
289 {{ do_transition(jump_id) }} 275 {{ do_transition(jump_id) }}
290 } 276 }
291 {% endfor -%} 277 {% endfor -%}
292 } 278 }
293 {%- endif-%} 279 {%- endif-%}
294 280
295 {{ write_label('before_match', node_number) }} 281 {{ write_label('before_match', node_number) }}
296 282
297 {%- set match_action = state.match_action -%} 283 {%- set match_action = state.match_action -%}
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // force use of stored_token 353 // force use of stored_token
368 stored_token = Token::ILLEGAL; 354 stored_token = Token::ILLEGAL;
369 // force use of marker 355 // force use of marker
370 marker = NULL; 356 marker = NULL;
371 // force use of state_entry_0 357 // force use of state_entry_0
372 goto state_entry_0; 358 goto state_entry_0;
373 } 359 }
374 } 360 }
375 } } 361 } }
376 362
OLDNEW
« no previous file with comments | « no previous file | tools/lexer_generator/code_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698