| OLD | NEW |
| 1 #include "lexer/even-more-experimental-scanner.h" | 1 #include "lexer/even-more-experimental-scanner.h" |
| 2 | 2 |
| 3 {# TODO implement CLASS checks #} | 3 {# TODO implement CLASS checks #} |
| 4 {%- macro do_key(key) -%} | 4 {%- macro do_key(key) -%} |
| 5 {%- for r in key -%} | 5 {%- for r in key -%} |
| 6 {%- if not loop.first %} || {% endif -%} | 6 {%- if not loop.first %} || {% endif -%} |
| 7 {%- if r[0] == 'LATIN_1' -%} | 7 {%- if r[0] == 'LATIN_1' -%} |
| 8 {%- if r[1][0] == r[1][1] -%} | 8 {%- if r[1][0] == r[1][1] -%} |
| 9 yych == {{r[1][0]}} | 9 yych == {{r[1][0]}} |
| 10 {%- elif r[1][0] == 0 -%} | 10 {%- elif r[1][0] == 0 -%} |
| 11 yych <= {{r[1][1]}} | 11 yych <= {{r[1][1]}} |
| 12 {%- elif r[1][1] == 255 -%} | 12 {%- elif r[1][1] == 255 -%} |
| 13 yych >= {{r[1][0]}} | 13 yych >= {{r[1][0]}} |
| 14 {%- else -%} | 14 {%- else -%} |
| 15 ({{r[1][0]}} <= yych && yych <= {{r[1][1]}}) | 15 ({{r[1][0]}} <= yych && yych <= {{r[1][1]}}) |
| 16 {%- endif -%} | 16 {%- endif -%} |
| 17 {%- elif r[0] == 'CLASS' -%} | 17 {%- elif r[0] == 'CLASS' -%} |
| 18 {%- if r[1] == 'eos' -%} | 18 {%- if r[1] == 'eos' -%} |
| 19 (yych == 0 && cursor_ >= buffer_end_) | 19 (yych == 0 && cursor_ >= buffer_end_) |
| 20 {%- elif r[1] == 'zero' -%} | 20 {%- elif r[1] == 'zero' -%} |
| 21 (yych == 0 && cursor_ < buffer_end_) | 21 (yych == 0 && cursor_ < buffer_end_) |
| 22 {%- elif r[1] == 'whitespace' and encoding == 'utf16'-%} |
| 23 unicode_cache_->IsWhiteSpace(yych) |
| 24 {%- elif r[1] == 'letter' and encoding == 'utf16'-%} |
| 25 (!(yych >= 'a' && yych <= 'z') && !(yych >= 'A' && yych <= 'Z') && unic
ode_cache_->IsLetter(yych)) |
| 26 {%- elif r[1] == 'identifier_part_not_letter' and encoding == 'utf16'-%} |
| 27 unicode_cache_->IsIdentifierPartNotLetter(yych) |
| 22 {%- else -%} | 28 {%- else -%} |
| 23 » false | 29 » false /* {{r[1]}} */ |
| 24 {%- endif -%} | 30 {%- endif -%} |
| 25 {%- else -%} | 31 {%- else -%} |
| 26 false | 32 false |
| 27 {%- endif -%} | 33 {%- endif -%} |
| 28 {%- endfor -%} | 34 {%- endfor -%} |
| 29 {%- endmacro -%} | 35 {%- endmacro -%} |
| 30 | 36 |
| 31 | 37 |
| 32 {% macro dispatch_action(type, value) -%} | 38 {% macro dispatch_action(type, value) -%} |
| 33 {%- if type == 'code' %} | 39 {%- if type == 'code' %} |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 else yych = *(cursor_); \ | 170 else yych = *(cursor_); \ |
| 165 } | 171 } |
| 166 | 172 |
| 167 #define SKIP() { \ | 173 #define SKIP() { \ |
| 168 start_ = cursor_; \ | 174 start_ = cursor_; \ |
| 169 } | 175 } |
| 170 | 176 |
| 171 namespace v8 { | 177 namespace v8 { |
| 172 namespace internal { | 178 namespace internal { |
| 173 template<> | 179 template<> |
| 180 {%- if encoding == 'latin1' %} |
| 181 {%- set char_type = 'uint8_t' -%} |
| 182 {%- elif encoding == 'utf16' %} |
| 183 {%- set char_type = 'uint16_t' -%} |
| 184 {%- endif %} |
| 174 Token::Value EvenMoreExperimentalScanner<{{char_type}}>::Next(int* beg_pos_to_re
turn, | 185 Token::Value EvenMoreExperimentalScanner<{{char_type}}>::Next(int* beg_pos_to_re
turn, |
| 175 int* end_pos_to_re
turn) { | 186 int* end_pos_to_re
turn) { |
| 176 // Setup environment. | 187 // Setup environment. |
| 177 {{char_type}} yych; | 188 {{char_type}} yych; |
| 178 if (cursor_ >= buffer_end_) yych = 0; | 189 if (cursor_ >= buffer_end_) yych = 0; |
| 179 else yych = *(cursor_); | 190 else yych = *(cursor_); |
| 180 | 191 |
| 181 {# first node is start node #} | 192 {# first node is start node #} |
| 182 {% for dfa_state in dfa_states -%} | 193 {% for dfa_state in dfa_states -%} |
| 183 {%- set inline = dfa_state['inline'] -%} | 194 {%- set inline = dfa_state['inline'] -%} |
| (...skipping 11 matching lines...) Expand all Loading... |
| 195 {% endif -%} | 206 {% endif -%} |
| 196 {{dispatch_action(default_action[0], default_action[1])}} | 207 {{dispatch_action(default_action[0], default_action[1])}} |
| 197 FORWARD(); | 208 FORWARD(); |
| 198 goto code_start; | 209 goto code_start; |
| 199 | 210 |
| 200 fell_through: | 211 fell_through: |
| 201 CHECK(false); | 212 CHECK(false); |
| 202 } | 213 } |
| 203 } } | 214 } } |
| 204 | 215 |
| OLD | NEW |