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

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

Issue 75353003: Experimental lexer generator: Lex files with zeros properly. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cornercases/file-with-zero.js ('k') | tools/lexer_generator/rule_parser.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 3
4 {# TODO implement CLASS checks #} 4 {# TODO implement CLASS checks #}
5 {%- macro do_key(key) -%} 5 {%- macro do_key(key) -%}
6 {%- for r in key.range_iter() -%} 6 {%- for r in key.range_iter() -%}
7 {%- if not loop.first %} || {% endif -%} 7 {%- if not loop.first %} || {% endif -%}
8 {%- if r[0] == 'LATIN_1' -%} 8 {%- if r[0] == 'LATIN_1' -%}
9 {%- if r[1][0] == r[1][1] -%} 9 {%- if r[1][0] == r[1][1] -%}
10 yych == {{r[1][0]}} 10 yych == {{r[1][0]}}
11 {%- elif r[1][0] == 0 -%} 11 {%- elif r[1][0] == 0 -%}
12 yych <= {{r[1][1]}} 12 yych <= {{r[1][1]}}
13 {%- elif r[1][1] == 255 -%} 13 {%- elif r[1][1] == 255 -%}
14 yych >= {{r[1][0]}} 14 yych >= {{r[1][0]}}
15 {%- else -%} 15 {%- else -%}
16 ({{r[1][0]}} <= yych && yych <= {{r[1][1]}}) 16 ({{r[1][0]}} <= yych && yych <= {{r[1][1]}})
17 {%- endif -%} 17 {%- endif -%}
18 {%- elif r[0] == 'CLASS' -%}
19 {%- if r[1] == 'eof' -%}
20 (yych == 0 && cursor_ == buffer_end_)
21 {%- else -%}
22 false
23 {%- endif -%}
18 {%- else -%} 24 {%- else -%}
19 false 25 false
20 {%- endif -%} 26 {%- endif -%}
21 {%- endfor -%} 27 {%- endfor -%}
22 {%- endmacro -%} 28 {%- endmacro -%}
23 29
24 30
25 {% macro dispatch_action(type, value) -%} 31 {% macro dispatch_action(type, value) -%}
26 {%- if type == 'code' %} 32 {%- if type == 'code' %}
27 {{value}} 33 {{value}}
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 {% endif -%} 154 {% endif -%}
149 {{dispatch_action(default_action[0], default_action[1])}} 155 {{dispatch_action(default_action[0], default_action[1])}}
150 FORWARD(); 156 FORWARD();
151 goto code_start; 157 goto code_start;
152 158
153 fell_through: 159 fell_through:
154 CHECK(false); 160 CHECK(false);
155 } 161 }
156 } } 162 } }
157 163
OLDNEW
« no previous file with comments | « test/cornercases/file-with-zero.js ('k') | tools/lexer_generator/rule_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698