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

Side by Side 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 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 #include "lexer/even-more-experimental-scanner.h" 1 #include "lexer/even-more-experimental-scanner.h"
2 2
3 {%- macro do_key(key) -%} 3 {%- macro do_key(key) -%}
4 {%- for r in key -%} 4 {%- for r in key -%}
5 {%- if not loop.first %} || {% endif -%} 5 {%- if not loop.first %} || {% endif -%}
6 {%- if r[0] == 'LATIN_1' -%} 6 {%- if r[0] == 'PRIMARY_RANGE' -%}
7 {%- if r[1][0] == r[1][1] -%} 7 {%- if r[1][0] == r[1][1] -%}
8 yych == {{r[1][0]}} 8 yych == {{r[1][0]}}
9 {%- elif r[1][0] == 0 -%} 9 {%- elif r[1][0] == 0 -%}
10 yych <= {{r[1][1]}} 10 yych <= {{r[1][1]}}
11 {%- elif r[1][1] == 255 and encoding == 'latin1'-%} 11 {%- elif r[1][1] == upper_bound and not encoding == 'utf16'-%}
12 yych >= {{r[1][0]}} 12 yych >= {{r[1][0]}}
13 {%- else -%} 13 {%- else -%}
14 ({{r[1][0]}} <= yych && yych <= {{r[1][1]}}) 14 ({{r[1][0]}} <= yych && yych <= {{r[1][1]}})
15 {%- endif -%} 15 {%- endif -%}
16 {%- elif r[0] == 'CLASS' -%} 16 {%- elif r[0] == 'CLASS' -%}
17 {%- if r[1] == 'eos' -%} 17 {%- if r[1] == 'eos' -%}
18 (yych == 0 && cursor_ >= buffer_end_) 18 (yych == 0 && cursor_ >= buffer_end_)
19 {%- elif r[1] == 'zero' -%} 19 {%- elif r[1] == 'zero' -%}
20 (yych == 0 && cursor_ < buffer_end_) 20 (yych == 0 && cursor_ < buffer_end_)
21 {%- elif encoding == 'latin1' -%} 21 {%- elif encoding == 'latin1' -%}
22 false /* {{r[1]}} */ 22 false /* {{r[1]}} */
23 {%- elif encoding == 'utf16' -%} 23 {%- elif encoding == 'utf16' -%}
24 {%- if r[1] == 'byte_order_mark' -%} 24 {%- if r[1] == 'byte_order_mark' -%}
25 (yych == 0xfffe || yych == 0xfeff) 25 (yych == 0xfffe || yych == 0xfeff)
26 {%- elif r[1] == 'non_latin_1_whitespace' -%} 26 {%- elif r[1] == 'non_latin_1_whitespace' -%}
27 {# FIXME: Add and use unicode_cache_->InNonAsciiWhitespace #} 27 (yych > {{upper_bound}} && unicode_cache_->IsWhiteSpace(yych))
28 (yych > 255 && unicode_cache_->IsWhiteSpace(yych))
29 {%- elif r[1] == 'non_latin_1_letter' -%} 28 {%- elif r[1] == 'non_latin_1_letter' -%}
30 {# FIXME: Add and use unicode_cache_->InNonAsciiLetter #} 29 (yych > {{upper_bound}} && unicode_cache_->IsLetter(yych))
31 (yych > 255 && unicode_cache_->IsLetter(yych))
32 {%- elif r[1] == 'non_latin_1_identifier_part_not_letter' -%} 30 {%- elif r[1] == 'non_latin_1_identifier_part_not_letter' -%}
33 (yych > 255 && unicode_cache_->IsIdentifierPartNotLetter(yych)) 31 (yych > {{upper_bound}} &&
32 unicode_cache_->IsIdentifierPartNotLetter(yych))
34 {%- elif r[1] == 'non_latin_1_line_terminator' -%} 33 {%- elif r[1] == 'non_latin_1_line_terminator' -%}
35 (yych > 255 && unicode_cache_->IsLineTerminator(yych)) 34 (yych > {{upper_bound}} && unicode_cache_->IsLineTerminator(yych))
36 {%- elif r[1] == 'non_latin_1_everything_else' -%} 35 {%- elif r[1] == 'non_latin_1_everything_else' -%}
37 {# FIXME: Optimize this away #} 36 {# FIXME: Optimize this away #}
38 (yych > 255 && 37 (yych > {{upper_bound}} &&
39 !unicode_cache_->IsWhiteSpace(yych) && 38 !unicode_cache_->IsWhiteSpace(yych) &&
40 !unicode_cache_->IsLetter(yych) && 39 !unicode_cache_->IsLetter(yych) &&
41 !unicode_cache_->IsIdentifierPartNotLetter(yych) && 40 !unicode_cache_->IsIdentifierPartNotLetter(yych) &&
42 !unicode_cache_->IsLineTerminator(yych)) 41 !unicode_cache_->IsLineTerminator(yych))
43 {%- else %} 42 {%- else %}
44 uncompilable code for {{encoding}} {{r[0]}} {{r[1]}} 43 uncompilable code for {{encoding}} {{r[0]}} {{r[1]}}
45 {%- endif -%} 44 {%- endif -%}
46 {%- else -%} 45 {%- else -%}
47 uncompilable code for {{encoding}} {{r[0]}} {{r[1]}} 46 uncompilable code for {{encoding}} {{r[0]}} {{r[1]}}
48 {%- endif -%} 47 {%- endif -%}
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 {% endif -%} 230 {% endif -%}
232 {{dispatch_action(default_action[0], default_action[1])}} 231 {{dispatch_action(default_action[0], default_action[1])}}
233 FORWARD(); 232 FORWARD();
234 goto code_start; 233 goto code_start;
235 234
236 fell_through: 235 fell_through:
237 CHECK(false); 236 CHECK(false);
238 } 237 }
239 } } 238 } }
240 239
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