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

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

Issue 83693002: Experimentar scanner: Unify the API to Scanner API some more. (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 | « test/lexer/cornercases/multiline-and-weird-html-comment.js ('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 #include "lexer/experimental-scanner.h" 1 #include "lexer/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] == 'PRIMARY_RANGE' -%} 6 {%- if r[0] == 'PRIMARY_RANGE' -%}
7 {%- if r[1][0] == r[1][1] -%} 7 {%- if r[1][0] == r[1][1] -%}
8 primary_char == {{r[1][0]}} 8 primary_char == {{r[1][0]}}
9 {%- elif r[1][0] == 0 -%} 9 {%- elif r[1][0] == 0 -%}
10 primary_char <= {{r[1][1]}} 10 primary_char <= {{r[1][1]}}
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 {% else %} 186 {% else %}
187 goto default_action; 187 goto default_action;
188 {%- endif %} 188 {%- endif %}
189 189
190 {%- endmacro %} 190 {%- endmacro %}
191 191
192 #define PREPARE_PUSH_TOKEN() { \ 192 #define PREPARE_PUSH_TOKEN() { \
193 next_.beg_pos = start_ - buffer_; \ 193 next_.beg_pos = start_ - buffer_; \
194 next_.end_pos = cursor_ - buffer_; \ 194 next_.end_pos = cursor_ - buffer_; \
195 start_ = cursor_; \ 195 start_ = cursor_; \
196 just_seen_line_terminator_ = false; \
197 } 196 }
198 197
199 #define PUSH_TOKEN(T) { \ 198 #define PUSH_TOKEN(T) { \
200 PREPARE_PUSH_TOKEN(); \ 199 PREPARE_PUSH_TOKEN(); \
201 next_.token = T; \ 200 next_.token = T; \
202 return; \ 201 return; \
203 } 202 }
204 203
205 #define PUSH_TOKEN_AND_GO_FORWARD(T) {\ 204 #define PUSH_TOKEN_AND_GO_FORWARD(T) {\
206 PREPARE_PUSH_TOKEN(); \ 205 PREPARE_PUSH_TOKEN(); \
207 FORWARD(); \ 206 FORWARD(); \
208 next_.token = T; \ 207 next_.token = T; \
209 return; \ 208 return; \
210 } 209 }
211 210
212 #define PUSH_EOS() { \ 211 #define PUSH_EOS() { \
213 cursor_ -= 1; \ 212 cursor_ -= 1; \
214 PUSH_TOKEN(Token::EOS); \ 213 PUSH_TOKEN(Token::EOS); \
215 } 214 }
216 215
217 #define PUSH_LINE_TERMINATOR(s) { \ 216 #define PUSH_LINE_TERMINATOR(s) { \
218 start_ = cursor_; \ 217 start_ = cursor_; \
219 just_seen_line_terminator_ = true; \ 218 has_line_terminator_before_next_ = true; \
220 } 219 }
221 220
222 #define FORWARD() { \ 221 #define FORWARD() { \
223 if (++cursor_ >= buffer_end_) primary_char = 0; \ 222 if (++cursor_ >= buffer_end_) primary_char = 0; \
224 else primary_char = *(cursor_); \ 223 else primary_char = *(cursor_); \
225 } 224 }
226 225
227 #define BACKWARD(n) { \ 226 #define BACKWARD(n) { \
228 cursor_ -= n; \ 227 cursor_ -= n; \
229 if (cursor_ >= buffer_end_) primary_char = 0; \ 228 if (cursor_ >= buffer_end_) primary_char = 0; \
(...skipping 30 matching lines...) Expand all
260 {% endif -%} 259 {% endif -%}
261 {{dispatch_action(default_action[0], default_action[1])}} 260 {{dispatch_action(default_action[0], default_action[1])}}
262 FORWARD(); 261 FORWARD();
263 goto code_start; 262 goto code_start;
264 263
265 fell_through: 264 fell_through:
266 CHECK(false); 265 CHECK(false);
267 } 266 }
268 } } 267 } }
269 268
OLDNEW
« no previous file with comments | « test/lexer/cornercases/multiline-and-weird-html-comment.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698