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

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

Issue 85853003: Experimental parser: simplify goto logic (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 | « tools/lexer_generator/automaton.py ('k') | 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 {% elif type == 'skip' %} 80 {% elif type == 'skip' %}
81 SKIP(); 81 SKIP();
82 {% elif type == 'skip_and_terminate' %} 82 {% elif type == 'skip_and_terminate' %}
83 SKIP(); 83 SKIP();
84 --start_; 84 --start_;
85 {{dispatch_action('terminate', None)}} 85 {{dispatch_action('terminate', None)}}
86 {% elif type == 'line_terminator' %} 86 {% elif type == 'line_terminator' %}
87 DO_LINE_TERMINATOR(); 87 DO_LINE_TERMINATOR();
88 {% elif type == 'token' %} 88 {% elif type == 'token' %}
89 DO_TOKEN(Token::{{value}}) 89 DO_TOKEN(Token::{{value}})
90 {% elif type == 'goto' %} 90 {% elif type == 'goto_start' %}
91 goto code_after_entry_{{value}}; 91 goto code_{{value[0]}};
92 {% elif type == 'store_token' %} 92 {% elif type == 'store_token' %}
93 stored_token = Token::{{value}}; 93 stored_token = Token::{{value}};
94 {% elif type == 'store_token_and_goto' %}
95 stored_token = Token::{{value[0]}};
96 goto code_after_entry_{{value[1]}};
94 {% elif type == 'do_stored_token' %} 97 {% elif type == 'do_stored_token' %}
95 DO_TOKEN(stored_token) 98 DO_TOKEN(stored_token)
96 {% elif type == 'do_token_and_go_forward' %} 99 {% elif type == 'do_token_and_go_forward' %}
97 DO_TOKEN_AND_GO_FORWARD(Token::{{value}}) 100 DO_TOKEN_AND_GO_FORWARD(Token::{{value}})
98 {% elif type == 'harmony_token' %} 101 {% elif type == 'harmony_token' %}
99 if (harmony_{{value[0]}}_) { 102 if (harmony_{{value[0]}}_) {
100 DO_TOKEN(Token::{{value[1][0]}}); 103 DO_TOKEN(Token::{{value[1]}});
101 } else { 104 } else {
102 DO_TOKEN(Token::{{value[1][1]}}); 105 DO_TOKEN(Token::{{value[2]}});
103 } 106 }
104 {% elif type == 'store_harmony_token' %} 107 {% elif type == 'store_harmony_token_and_goto' %}
105 if (harmony_{{value[0]}}_) { 108 if (harmony_{{value[0]}}_) {
106 stored_token = Token::{{value[1][0]}}; 109 stored_token = Token::{{value[1]}};
107 } else { 110 } else {
108 stored_token = Token::{{value[1][1]}}; 111 stored_token = Token::{{value[2]}};
109 } 112 }
113 goto code_after_entry_{{value[3]}};
110 {% elif type == 'set_marker' %} 114 {% elif type == 'set_marker' %}
111 marker_ = cursor_ - {{value}}; 115 marker_ = cursor_ - {{value}};
112 {% else %} 116 {% else %}
113 uncompilable code for {{type}} 117 uncompilable code for {{type}}
114 {% endif -%} 118 {% endif -%}
115 {%- endmacro -%} 119 {%- endmacro -%}
116 120
117 121
118 {%- macro long_char_check() -%} 122 {%- macro long_char_check() -%}
119 {%- if encoding == 'utf16'-%} 123 {%- if encoding == 'utf16'-%}
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 FORWARD(); 311 FORWARD();
308 goto code_start; 312 goto code_start;
309 313
310 fell_through: 314 fell_through:
311 ((void(*)())0)(); // crash 315 ((void(*)())0)(); // crash
312 // force use of stored_token 316 // force use of stored_token
313 stored_token = Token::ILLEGAL; 317 stored_token = Token::ILLEGAL;
314 } 318 }
315 } } 319 } }
316 320
OLDNEW
« no previous file with comments | « tools/lexer_generator/automaton.py ('k') | tools/lexer_generator/code_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698