| OLD | NEW |
| 1 #include "lexer/even-more-experimental-scanner.h" | 1 #include "lexer/even-more-experimental-scanner.h" |
| 2 | 2 |
| 3 | |
| 4 {# TODO implement CLASS checks #} | 3 {# TODO implement CLASS checks #} |
| 5 {%- macro do_key(key) -%} | 4 {%- macro do_key(key) -%} |
| 6 {%- for r in key -%} | 5 {%- for r in key -%} |
| 7 {%- if not loop.first %} || {% endif -%} | 6 {%- if not loop.first %} || {% endif -%} |
| 8 {%- if r[0] == 'LATIN_1' -%} | 7 {%- if r[0] == 'LATIN_1' -%} |
| 9 {%- if r[1][0] == r[1][1] -%} | 8 {%- if r[1][0] == r[1][1] -%} |
| 10 yych == {{r[1][0]}} | 9 yych == {{r[1][0]}} |
| 11 {%- elif r[1][0] == 0 -%} | 10 {%- elif r[1][0] == 0 -%} |
| 12 yych <= {{r[1][1]}} | 11 yych <= {{r[1][1]}} |
| 13 {%- elif r[1][1] == 255 -%} | 12 {%- elif r[1][1] == 255 -%} |
| 14 yych >= {{r[1][0]}} | 13 yych >= {{r[1][0]}} |
| 15 {%- else -%} | 14 {%- else -%} |
| 16 ({{r[1][0]}} <= yych && yych <= {{r[1][1]}}) | 15 ({{r[1][0]}} <= yych && yych <= {{r[1][1]}}) |
| 17 {%- endif -%} | 16 {%- endif -%} |
| 18 {%- elif r[0] == 'CLASS' -%} | 17 {%- elif r[0] == 'CLASS' -%} |
| 19 {%- if r[1] == 'eof' -%} | 18 {%- if r[1] == 'eos' -%} |
| 20 » (yych == 0 && cursor_ == buffer_end_) | 19 » (yych == 0 && cursor_ >= buffer_end_) |
| 20 {%- elif r[1] == 'zero' -%} |
| 21 » (yych == 0 && cursor_ < buffer_end_) |
| 21 {%- else -%} | 22 {%- else -%} |
| 22 false | 23 false |
| 23 {%- endif -%} | 24 {%- endif -%} |
| 24 {%- else -%} | 25 {%- else -%} |
| 25 false | 26 false |
| 26 {%- endif -%} | 27 {%- endif -%} |
| 27 {%- endfor -%} | 28 {%- endfor -%} |
| 28 {%- endmacro -%} | 29 {%- endmacro -%} |
| 29 | 30 |
| 30 | 31 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return T; \ | 136 return T; \ |
| 136 } | 137 } |
| 137 | 138 |
| 138 #define PUSH_TOKEN_AND_GO_FORWARD(T) {\ | 139 #define PUSH_TOKEN_AND_GO_FORWARD(T) {\ |
| 139 PREPARE_PUSH_TOKEN(); \ | 140 PREPARE_PUSH_TOKEN(); \ |
| 140 FORWARD(); \ | 141 FORWARD(); \ |
| 141 return T; \ | 142 return T; \ |
| 142 } | 143 } |
| 143 | 144 |
| 144 #define PUSH_EOS() { \ | 145 #define PUSH_EOS() { \ |
| 145 --cursor_; \ | 146 --start_; \ |
| 147 cursor_ -= 2; \ |
| 146 PUSH_TOKEN(Token::EOS); \ | 148 PUSH_TOKEN(Token::EOS); \ |
| 147 } | 149 } |
| 148 | 150 |
| 149 #define PUSH_LINE_TERMINATOR(s) { \ | 151 #define PUSH_LINE_TERMINATOR(s) { \ |
| 150 start_ = cursor_; \ | 152 start_ = cursor_; \ |
| 151 just_seen_line_terminator_ = true; \ | 153 just_seen_line_terminator_ = true; \ |
| 152 } | 154 } |
| 153 | 155 |
| 154 #define FORWARD() { \ | 156 #define FORWARD() { \ |
| 155 yych = *(++cursor_); \ | 157 if (++cursor_ >= buffer_end_) yych = 0; \ |
| 158 else yych = *(cursor_); \ |
| 156 } | 159 } |
| 157 | 160 |
| 158 #define BACKWARD() { \ | 161 #define BACKWARD() { \ |
| 159 yych = *(--cursor_); \ | 162 if (--cursor_ >= buffer_end_) yych = 0; \ |
| 163 else yych = *(cursor_); \ |
| 160 } | 164 } |
| 161 | 165 |
| 162 #define SKIP() { \ | 166 #define SKIP() { \ |
| 163 start_ = cursor_; \ | 167 start_ = cursor_; \ |
| 164 } | 168 } |
| 165 | 169 |
| 166 namespace v8 { | 170 namespace v8 { |
| 167 namespace internal { | 171 namespace internal { |
| 168 Token::Value EvenMoreExperimentalScanner::Next(int* beg_pos_to_return, | 172 Token::Value EvenMoreExperimentalScanner::Next(int* beg_pos_to_return, |
| 169 int* end_pos_to_return) { | 173 int* end_pos_to_return) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 187 {% endif -%} | 191 {% endif -%} |
| 188 {{dispatch_action(default_action[0], default_action[1])}} | 192 {{dispatch_action(default_action[0], default_action[1])}} |
| 189 FORWARD(); | 193 FORWARD(); |
| 190 goto code_start; | 194 goto code_start; |
| 191 | 195 |
| 192 fell_through: | 196 fell_through: |
| 193 CHECK(false); | 197 CHECK(false); |
| 194 } | 198 } |
| 195 } } | 199 } } |
| 196 | 200 |
| OLD | NEW |