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

Unified Diff: tools/lexer_generator/code_generator.jinja

Issue 80513003: Experimental parser: add everything_else class (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/lexer_generator/code_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/code_generator.jinja
diff --git a/tools/lexer_generator/code_generator.jinja b/tools/lexer_generator/code_generator.jinja
index f44ac647618e7bba2fb47ae38af0e8ec11eaaacc..c590244ec37e713c0fc9184f58023cf8aae4b9e1 100644
--- a/tools/lexer_generator/code_generator.jinja
+++ b/tools/lexer_generator/code_generator.jinja
@@ -18,23 +18,36 @@
(yych == 0 && cursor_ >= buffer_end_)
{%- elif r[1] == 'zero' -%}
(yych == 0 && cursor_ < buffer_end_)
- {%- elif r[1] == 'byte_order_mark' and encoding == 'utf16'-%}
- (yych == 0xfffe || yych == 0xfeff)
- {%- elif r[1] == 'non_latin_1_whitespace' and encoding == 'utf16'-%}
- {# FIXME: Add and use unicode_cache_->InNonAsciiWhitespace #}
- (yych > 255 && unicode_cache_->IsWhiteSpace(yych))
- {%- elif r[1] == 'non_latin_1_letter' and encoding == 'utf16'-%}
- {# FIXME: Add and use unicode_cache_->InNonAsciiLetter #}
- (yych > 255 && unicode_cache_->IsLetter(yych))
- {%- elif r[1] == 'non_latin1_identifier_part_not_letter' and encoding == 'utf16'-%}
- (yych > 255 && unicode_cache_->IsIdentifierPartNotLetter(yych))
- {%- elif r[1] == 'non_latin1_line_terminator' and encoding == 'utf16'-%}
- (yych > 255 && unicode_cache_->IsLineTerminator(yych))
- {%- else -%}
+ {%- elif encoding == 'latin1' -%}
false /* {{r[1]}} */
+ {%- elif encoding == 'utf16' -%}
+ {%- if r[1] == 'byte_order_mark' -%}
+ (yych == 0xfffe || yych == 0xfeff)
+ {%- elif r[1] == 'non_latin_1_whitespace' -%}
+ {# FIXME: Add and use unicode_cache_->InNonAsciiWhitespace #}
+ (yych > 255 && unicode_cache_->IsWhiteSpace(yych))
+ {%- elif r[1] == 'non_latin_1_letter' -%}
+ {# FIXME: Add and use unicode_cache_->InNonAsciiLetter #}
+ (yych > 255 && unicode_cache_->IsLetter(yych))
+ {%- elif r[1] == 'non_latin_1_identifier_part_not_letter' -%}
+ (yych > 255 && unicode_cache_->IsIdentifierPartNotLetter(yych))
+ {%- elif r[1] == 'non_latin_1_line_terminator' -%}
+ (yych > 255 && unicode_cache_->IsLineTerminator(yych))
+ {%- elif r[1] == 'non_latin_1_everything_else' -%}
+ {# FIXME: Optimize this away #}
+ (yych > 255 &&
+ !unicode_cache_->IsWhiteSpace(yych) &&
+ !unicode_cache_->IsLetter(yych) &&
+ !unicode_cache_->IsIdentifierPartNotLetter(yych) &&
+ !unicode_cache_->IsLineTerminator(yych))
+ {%- else %}
+ uncompilable code for {{encoding}} {{r[0]}} {{r[1]}}
+ {%- endif -%}
+ {%- else -%}
+ uncompilable code for {{encoding}} {{r[0]}} {{r[1]}}
{%- endif -%}
{%- else -%}
- false
+ uncompilable code for {{encoding}} {{r[0]}} {{r[1]}}
{%- endif -%}
{%- endfor -%}
{%- endmacro -%}
@@ -126,6 +139,12 @@
}
{% endfor -%}
+ {%- for key, transition_state_id in state['deferred_transitions'] %}
+ if ({{do_key(key)}}) { // deferred transition
+ {{ do_transition(transition_state_id) }}
+ }
+ {% endfor -%}
+
{%- set match_action = state.match_action -%}
{%- if match_action %}
« 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