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

Unified Diff: tools/lexer_generator/code_generator.jinja

Issue 82953003: Experimental parser: cleanup after adding encodings (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 cadbdb0f6bf614531957de43ffd093d909b606d1..ae8d3273720c64f6133b9c2d8c121d78c24d2ce7 100644
--- a/tools/lexer_generator/code_generator.jinja
+++ b/tools/lexer_generator/code_generator.jinja
@@ -3,12 +3,12 @@
{%- macro do_key(key) -%}
{%- for r in key -%}
{%- if not loop.first %} || {% endif -%}
- {%- if r[0] == 'LATIN_1' -%}
+ {%- if r[0] == 'PRIMARY_RANGE' -%}
{%- if r[1][0] == r[1][1] -%}
yych == {{r[1][0]}}
{%- elif r[1][0] == 0 -%}
yych <= {{r[1][1]}}
- {%- elif r[1][1] == 255 and encoding == 'latin1'-%}
+ {%- elif r[1][1] == upper_bound and not encoding == 'utf16'-%}
yych >= {{r[1][0]}}
{%- else -%}
({{r[1][0]}} <= yych && yych <= {{r[1][1]}})
@@ -24,18 +24,17 @@
{%- 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))
+ (yych > {{upper_bound}} && unicode_cache_->IsWhiteSpace(yych))
{%- elif r[1] == 'non_latin_1_letter' -%}
- {# FIXME: Add and use unicode_cache_->InNonAsciiLetter #}
- (yych > 255 && unicode_cache_->IsLetter(yych))
+ (yych > {{upper_bound}} && unicode_cache_->IsLetter(yych))
{%- elif r[1] == 'non_latin_1_identifier_part_not_letter' -%}
- (yych > 255 && unicode_cache_->IsIdentifierPartNotLetter(yych))
+ (yych > {{upper_bound}} &&
+ unicode_cache_->IsIdentifierPartNotLetter(yych))
{%- elif r[1] == 'non_latin_1_line_terminator' -%}
- (yych > 255 && unicode_cache_->IsLineTerminator(yych))
+ (yych > {{upper_bound}} && unicode_cache_->IsLineTerminator(yych))
{%- elif r[1] == 'non_latin_1_everything_else' -%}
{# FIXME: Optimize this away #}
- (yych > 255 &&
+ (yych > {{upper_bound}} &&
!unicode_cache_->IsWhiteSpace(yych) &&
!unicode_cache_->IsLetter(yych) &&
!unicode_cache_->IsIdentifierPartNotLetter(yych) &&
« 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