| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.parser; | 3 library engine.parser; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 6 import 'instrumentation.dart'; | 6 import 'instrumentation.dart'; |
| 7 import 'error.dart'; | 7 import 'error.dart'; |
| 8 import 'source.dart'; | 8 import 'source.dart'; |
| 9 import 'scanner.dart'; | 9 import 'scanner.dart'; |
| 10 import 'ast.dart'; | 10 import 'ast.dart'; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 */ | 252 */ |
| 253 List<Statement> parseStatements(Token token) { | 253 List<Statement> parseStatements(Token token) { |
| 254 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.Parser.parseStatements"); | 254 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.Parser.parseStatements"); |
| 255 try { | 255 try { |
| 256 _currentToken = token; | 256 _currentToken = token; |
| 257 return parseStatements2(); | 257 return parseStatements2(); |
| 258 } finally { | 258 } finally { |
| 259 instrumentation.log(); | 259 instrumentation.log(); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 void set currentToken(Token currentToken2) { | 262 void set currentToken(Token currentToken) { |
| 263 this._currentToken = currentToken2; | 263 this._currentToken = currentToken; |
| 264 } | 264 } |
| 265 | 265 |
| 266 /** | 266 /** |
| 267 * Advance to the next token in the token stream. | 267 * Advance to the next token in the token stream. |
| 268 */ | 268 */ |
| 269 void advance() { | 269 void advance() { |
| 270 _currentToken = _currentToken.next; | 270 _currentToken = _currentToken.next; |
| 271 } | 271 } |
| 272 | 272 |
| 273 /** | 273 /** |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 */ | 811 */ |
| 812 bool matches2(String identifier) => identical(_currentToken.type, TokenType.ID
ENTIFIER) && _currentToken.lexeme == identifier; | 812 bool matches2(String identifier) => identical(_currentToken.type, TokenType.ID
ENTIFIER) && _currentToken.lexeme == identifier; |
| 813 | 813 |
| 814 /** | 814 /** |
| 815 * Return `true` if the given token matches the given keyword. | 815 * Return `true` if the given token matches the given keyword. |
| 816 * | 816 * |
| 817 * @param token the token being tested | 817 * @param token the token being tested |
| 818 * @param keyword the keyword that is being tested for | 818 * @param keyword the keyword that is being tested for |
| 819 * @return `true` if the given token matches the given keyword | 819 * @return `true` if the given token matches the given keyword |
| 820 */ | 820 */ |
| 821 bool matches3(Token token, Keyword keyword2) => identical(token.type, TokenTyp
e.KEYWORD) && identical(((token as KeywordToken)).keyword, keyword2); | 821 bool matches3(Token token, Keyword keyword) => identical(token.type, TokenType
.KEYWORD) && identical(((token as KeywordToken)).keyword, keyword); |
| 822 | 822 |
| 823 /** | 823 /** |
| 824 * Return `true` if the given token has the given type. | 824 * Return `true` if the given token has the given type. |
| 825 * | 825 * |
| 826 * @param token the token being tested | 826 * @param token the token being tested |
| 827 * @param type the type of token that is being tested for | 827 * @param type the type of token that is being tested for |
| 828 * @return `true` if the given token has the given type | 828 * @return `true` if the given token has the given type |
| 829 */ | 829 */ |
| 830 bool matches4(Token token, TokenType type2) => identical(token.type, type2); | 830 bool matches4(Token token, TokenType type) => identical(token.type, type); |
| 831 | 831 |
| 832 /** | 832 /** |
| 833 * Return `true` if the current token has the given type. Note that this metho
d, unlike | 833 * Return `true` if the current token has the given type. Note that this metho
d, unlike |
| 834 * other variants, will modify the token stream if possible to match a wider r
ange of tokens. In | 834 * other variants, will modify the token stream if possible to match a wider r
ange of tokens. In |
| 835 * particular, if we are attempting to match a '>' and the next token is eithe
r a '>>' or '>>>', | 835 * particular, if we are attempting to match a '>' and the next token is eithe
r a '>>' or '>>>', |
| 836 * the token stream will be re-written and `true` will be returned. | 836 * the token stream will be re-written and `true` will be returned. |
| 837 * | 837 * |
| 838 * @param type the type of token that can optionally appear in the current loc
ation | 838 * @param type the type of token that can optionally appear in the current loc
ation |
| 839 * @return `true` if the current token has the given type | 839 * @return `true` if the current token has the given type |
| 840 */ | 840 */ |
| 841 bool matches5(TokenType type2) { | 841 bool matches5(TokenType type) { |
| 842 TokenType currentType = _currentToken.type; | 842 TokenType currentType = _currentToken.type; |
| 843 if (currentType != type2) { | 843 if (currentType != type) { |
| 844 if (identical(type2, TokenType.GT)) { | 844 if (identical(type, TokenType.GT)) { |
| 845 if (identical(currentType, TokenType.GT_GT)) { | 845 if (identical(currentType, TokenType.GT_GT)) { |
| 846 int offset = _currentToken.offset; | 846 int offset = _currentToken.offset; |
| 847 Token first = new Token(TokenType.GT, offset); | 847 Token first = new Token(TokenType.GT, offset); |
| 848 Token second = new Token(TokenType.GT, offset + 1); | 848 Token second = new Token(TokenType.GT, offset + 1); |
| 849 second.setNext(_currentToken.next); | 849 second.setNext(_currentToken.next); |
| 850 first.setNext(second); | 850 first.setNext(second); |
| 851 _currentToken.previous.setNext(first); | 851 _currentToken.previous.setNext(first); |
| 852 _currentToken = first; | 852 _currentToken = first; |
| 853 return true; | 853 return true; |
| 854 } else if (identical(currentType, TokenType.GT_EQ)) { | 854 } else if (identical(currentType, TokenType.GT_EQ)) { |
| (...skipping 6060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6915 if ("\n" == separator) { | 6915 if ("\n" == separator) { |
| 6916 _writer.print("\n"); | 6916 _writer.print("\n"); |
| 6917 indent(); | 6917 indent(); |
| 6918 } else if (i > 0) { | 6918 } else if (i > 0) { |
| 6919 _writer.print(separator); | 6919 _writer.print(separator); |
| 6920 } | 6920 } |
| 6921 _writer.print(tokens[i].lexeme); | 6921 _writer.print(tokens[i].lexeme); |
| 6922 } | 6922 } |
| 6923 } | 6923 } |
| 6924 } | 6924 } |
| OLD | NEW |