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

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

Issue 91123002: Experimental scanner: keep track of which strings / identifiers contain an escape. (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_py.re ('k') | no next file » | 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 {% elif type == 'store_harmony_token_and_goto' %} 107 {% elif type == 'store_harmony_token_and_goto' %}
108 if (harmony_{{value[0]}}_) { 108 if (harmony_{{value[0]}}_) {
109 stored_token = Token::{{value[1]}}; 109 stored_token = Token::{{value[1]}};
110 } else { 110 } else {
111 stored_token = Token::{{value[2]}}; 111 stored_token = Token::{{value[2]}};
112 } 112 }
113 goto code_after_entry_{{value[3]}}; 113 goto code_after_entry_{{value[3]}};
114 {% elif type == 'set_marker' %} 114 {% elif type == 'set_marker' %}
115 marker_ = cursor_ - {{value}}; 115 marker_ = cursor_ - {{value}};
116 {% elif type == 'set_has_escapes' %}
117 next_.has_escapes = true;
116 {% else %} 118 {% else %}
117 uncompilable code for {{type}} 119 uncompilable code for {{type}}
118 {% endif -%} 120 {% endif -%}
119 {%- endmacro -%} 121 {%- endmacro -%}
120 122
121 123
122 {%- macro long_char_check() -%} 124 {%- macro long_char_check() -%}
123 {%- if encoding == 'utf16'-%} 125 {%- if encoding == 'utf16'-%}
124 primary_char > {{upper_bound}} 126 primary_char > {{upper_bound}}
125 {%- elif encoding == 'utf8'-%} 127 {%- elif encoding == 'utf8'-%}
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 281 }
280 282
281 #define SKIP() { \ 283 #define SKIP() { \
282 start_ = cursor_; \ 284 start_ = cursor_; \
283 } 285 }
284 286
285 namespace v8 { 287 namespace v8 {
286 namespace internal { 288 namespace internal {
287 template<> 289 template<>
288 void ExperimentalScanner<{{char_type}}>::Scan() { 290 void ExperimentalScanner<{{char_type}}>::Scan() {
291 next_.has_escapes = false;
289 // Setup environment. 292 // Setup environment.
290 Token::Value stored_token; 293 Token::Value stored_token;
291 {{char_type}} primary_char; 294 {{char_type}} primary_char;
292 if (cursor_ >= buffer_end_) primary_char = 0; 295 if (cursor_ >= buffer_end_) primary_char = 0;
293 else primary_char = *(cursor_); 296 else primary_char = *(cursor_);
294 297
295 {# first node is start node #} 298 {# first node is start node #}
296 {% for dfa_state in dfa_states -%} 299 {% for dfa_state in dfa_states -%}
297 {%- set inline = dfa_state['inline'] -%} 300 {%- set inline = dfa_state['inline'] -%}
298 {%- if not inline %} 301 {%- if not inline %}
(...skipping 12 matching lines...) Expand all
311 FORWARD(); 314 FORWARD();
312 goto code_start; 315 goto code_start;
313 316
314 fell_through: 317 fell_through:
315 ((void(*)())0)(); // crash 318 ((void(*)())0)(); // crash
316 // force use of stored_token 319 // force use of stored_token
317 stored_token = Token::ILLEGAL; 320 stored_token = Token::ILLEGAL;
318 } 321 }
319 } } 322 } }
320 323
OLDNEW
« no previous file with comments | « src/lexer/lexer_py.re ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698