| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 * | 392 * |
| 393 * @return the synthetic string literal that was created | 393 * @return the synthetic string literal that was created |
| 394 */ | 394 */ |
| 395 SimpleStringLiteral createSyntheticStringLiteral() => new SimpleStringLiteral.
full(createSyntheticToken2(TokenType.STRING), ""); | 395 SimpleStringLiteral createSyntheticStringLiteral() => new SimpleStringLiteral.
full(createSyntheticToken2(TokenType.STRING), ""); |
| 396 | 396 |
| 397 /** | 397 /** |
| 398 * Create a synthetic token representing the given keyword. | 398 * Create a synthetic token representing the given keyword. |
| 399 * | 399 * |
| 400 * @return the synthetic token that was created | 400 * @return the synthetic token that was created |
| 401 */ | 401 */ |
| 402 Token createSyntheticToken(Keyword keyword) => new KeywordToken_13(keyword, _c
urrentToken.offset); | 402 Token createSyntheticToken(Keyword keyword) => new KeywordToken_15(keyword, _c
urrentToken.offset); |
| 403 | 403 |
| 404 /** | 404 /** |
| 405 * Create a synthetic token with the given type. | 405 * Create a synthetic token with the given type. |
| 406 * | 406 * |
| 407 * @return the synthetic token that was created | 407 * @return the synthetic token that was created |
| 408 */ | 408 */ |
| 409 Token createSyntheticToken2(TokenType type) => new StringToken(type, "", _curr
entToken.offset); | 409 Token createSyntheticToken2(TokenType type) => new StringToken(type, "", _curr
entToken.offset); |
| 410 | 410 |
| 411 /** | 411 /** |
| 412 * Check that the given expression is assignable and report an error if it isn
't. | 412 * Check that the given expression is assignable and report an error if it isn
't. |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1722 * comment | 1722 * comment |
| 1723 * @param sourceOffset the offset of the first character of the reference sour
ce | 1723 * @param sourceOffset the offset of the first character of the reference sour
ce |
| 1724 * @return the comment reference that was parsed, or `null` if no reference co
uld be found | 1724 * @return the comment reference that was parsed, or `null` if no reference co
uld be found |
| 1725 */ | 1725 */ |
| 1726 CommentReference parseCommentReference(String referenceSource, int sourceOffse
t) { | 1726 CommentReference parseCommentReference(String referenceSource, int sourceOffse
t) { |
| 1727 if (referenceSource.length == 0) { | 1727 if (referenceSource.length == 0) { |
| 1728 return null; | 1728 return null; |
| 1729 } | 1729 } |
| 1730 try { | 1730 try { |
| 1731 List<bool> errorFound = [false]; | 1731 List<bool> errorFound = [false]; |
| 1732 AnalysisErrorListener listener = new AnalysisErrorListener_14(errorFound); | 1732 AnalysisErrorListener listener = new AnalysisErrorListener_16(errorFound); |
| 1733 StringScanner scanner = new StringScanner(null, referenceSource, listener)
; | 1733 Scanner scanner = new Scanner(null, new SubSequenceReader(new CharSequence
(referenceSource), sourceOffset), listener); |
| 1734 scanner.setSourceStart(1, 1, sourceOffset); | 1734 scanner.setSourceStart(1, 1); |
| 1735 Token firstToken = scanner.tokenize(); | 1735 Token firstToken = scanner.tokenize(); |
| 1736 if (errorFound[0]) { | 1736 if (errorFound[0]) { |
| 1737 return null; | 1737 return null; |
| 1738 } | 1738 } |
| 1739 Token newKeyword = null; | 1739 Token newKeyword = null; |
| 1740 if (matches3(firstToken, Keyword.NEW)) { | 1740 if (matches3(firstToken, Keyword.NEW)) { |
| 1741 newKeyword = firstToken; | 1741 newKeyword = firstToken; |
| 1742 firstToken = firstToken.next; | 1742 firstToken = firstToken.next; |
| 1743 } | 1743 } |
| 1744 if (matchesIdentifier2(firstToken)) { | 1744 if (matchesIdentifier2(firstToken)) { |
| (...skipping 2750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4495 * @return the type alias that was parsed | 4495 * @return the type alias that was parsed |
| 4496 */ | 4496 */ |
| 4497 TypeAlias parseTypeAlias(CommentAndMetadata commentAndMetadata) { | 4497 TypeAlias parseTypeAlias(CommentAndMetadata commentAndMetadata) { |
| 4498 Token keyword = expect(Keyword.TYPEDEF); | 4498 Token keyword = expect(Keyword.TYPEDEF); |
| 4499 if (matchesIdentifier()) { | 4499 if (matchesIdentifier()) { |
| 4500 Token next = peek(); | 4500 Token next = peek(); |
| 4501 if (matches4(next, TokenType.LT)) { | 4501 if (matches4(next, TokenType.LT)) { |
| 4502 next = skipTypeParameterList(next); | 4502 next = skipTypeParameterList(next); |
| 4503 if (next != null && matches4(next, TokenType.EQ)) { | 4503 if (next != null && matches4(next, TokenType.EQ)) { |
| 4504 TypeAlias typeAlias = parseClassTypeAlias(commentAndMetadata, keyword)
; | 4504 TypeAlias typeAlias = parseClassTypeAlias(commentAndMetadata, keyword)
; |
| 4505 reportError9(ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword, [])
; |
| 4505 return typeAlias; | 4506 return typeAlias; |
| 4506 } | 4507 } |
| 4507 } else if (matches4(next, TokenType.EQ)) { | 4508 } else if (matches4(next, TokenType.EQ)) { |
| 4508 TypeAlias typeAlias = parseClassTypeAlias(commentAndMetadata, keyword); | 4509 TypeAlias typeAlias = parseClassTypeAlias(commentAndMetadata, keyword); |
| 4510 reportError9(ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword, []); |
| 4509 return typeAlias; | 4511 return typeAlias; |
| 4510 } | 4512 } |
| 4511 } | 4513 } |
| 4512 return parseFunctionTypeAlias(commentAndMetadata, keyword); | 4514 return parseFunctionTypeAlias(commentAndMetadata, keyword); |
| 4513 } | 4515 } |
| 4514 | 4516 |
| 4515 /** | 4517 /** |
| 4516 * Parse a list of type arguments. | 4518 * Parse a list of type arguments. |
| 4517 * | 4519 * |
| 4518 * <pre> | 4520 * <pre> |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5645 reportError9(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.externalKeyword,
[]); | 5647 reportError9(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.externalKeyword,
[]); |
| 5646 } | 5648 } |
| 5647 if (modifiers.finalKeyword != null) { | 5649 if (modifiers.finalKeyword != null) { |
| 5648 reportError9(ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword, []); | 5650 reportError9(ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword, []); |
| 5649 } | 5651 } |
| 5650 if (modifiers.varKeyword != null) { | 5652 if (modifiers.varKeyword != null) { |
| 5651 reportError9(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword, []); | 5653 reportError9(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword, []); |
| 5652 } | 5654 } |
| 5653 } | 5655 } |
| 5654 } | 5656 } |
| 5655 class KeywordToken_13 extends KeywordToken { | 5657 class KeywordToken_15 extends KeywordToken { |
| 5656 KeywordToken_13(Keyword arg0, int arg1) : super(arg0, arg1); | 5658 KeywordToken_15(Keyword arg0, int arg1) : super(arg0, arg1); |
| 5657 int get length => 0; | 5659 int get length => 0; |
| 5658 } | 5660 } |
| 5659 class AnalysisErrorListener_14 implements AnalysisErrorListener { | 5661 class AnalysisErrorListener_16 implements AnalysisErrorListener { |
| 5660 List<bool> errorFound; | 5662 List<bool> errorFound; |
| 5661 AnalysisErrorListener_14(this.errorFound); | 5663 AnalysisErrorListener_16(this.errorFound); |
| 5662 void onError(AnalysisError error) { | 5664 void onError(AnalysisError error) { |
| 5663 errorFound[0] = true; | 5665 errorFound[0] = true; |
| 5664 } | 5666 } |
| 5665 } | 5667 } |
| 5666 /** | 5668 /** |
| 5667 * The enumeration `ParserErrorCode` defines the error codes used for errors det
ected by the | 5669 * The enumeration `ParserErrorCode` defines the error codes used for errors det
ected by the |
| 5668 * parser. The convention for this class is for the name of the error code to in
dicate the problem | 5670 * parser. The convention for this class is for the name of the error code to in
dicate the problem |
| 5669 * that caused the error to be generated and for the error message to explain wh
at is wrong and, | 5671 * that caused the error to be generated and for the error message to explain wh
at is wrong and, |
| 5670 * when appropriate, how the problem can be corrected. | 5672 * when appropriate, how the problem can be corrected. |
| 5671 * | 5673 * |
| (...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6932 if ("\n" == separator) { | 6934 if ("\n" == separator) { |
| 6933 _writer.print("\n"); | 6935 _writer.print("\n"); |
| 6934 indent(); | 6936 indent(); |
| 6935 } else if (i > 0) { | 6937 } else if (i > 0) { |
| 6936 _writer.print(separator); | 6938 _writer.print(separator); |
| 6937 } | 6939 } |
| 6938 _writer.print(tokens[i].lexeme); | 6940 _writer.print(tokens[i].lexeme); |
| 6939 } | 6941 } |
| 6940 } | 6942 } |
| 6941 } | 6943 } |
| OLD | NEW |