| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.generated.parser; | 5 library analyzer.src.generated.parser; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 FinalConstVarOrType(this.keyword, this.type); | 520 FinalConstVarOrType(this.keyword, this.type); |
| 521 } | 521 } |
| 522 | 522 |
| 523 /** | 523 /** |
| 524 * A dispatcher that will invoke the right parse method when re-parsing a | 524 * A dispatcher that will invoke the right parse method when re-parsing a |
| 525 * specified child of the visited node. All of the methods in this class assume | 525 * specified child of the visited node. All of the methods in this class assume |
| 526 * that the parser is positioned to parse the replacement for the node. All of | 526 * that the parser is positioned to parse the replacement for the node. All of |
| 527 * the methods will throw an [IncrementalParseException] if the node could not | 527 * the methods will throw an [IncrementalParseException] if the node could not |
| 528 * be parsed for some reason. | 528 * be parsed for some reason. |
| 529 */ | 529 */ |
| 530 @deprecated |
| 530 class IncrementalParseDispatcher implements AstVisitor<AstNode> { | 531 class IncrementalParseDispatcher implements AstVisitor<AstNode> { |
| 531 /** | 532 /** |
| 532 * The parser used to parse the replacement for the node. | 533 * The parser used to parse the replacement for the node. |
| 533 */ | 534 */ |
| 534 final Parser _parser; | 535 final Parser _parser; |
| 535 | 536 |
| 536 /** | 537 /** |
| 537 * The node that is to be replaced. | 538 * The node that is to be replaced. |
| 538 */ | 539 */ |
| 539 final AstNode _oldNode; | 540 final AstNode _oldNode; |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 AstNode _notAChild(AstNode node) { | 1658 AstNode _notAChild(AstNode node) { |
| 1658 throw new IncrementalParseException.con1( | 1659 throw new IncrementalParseException.con1( |
| 1659 "Internal error: the visited node (a ${node.runtimeType}) was not the pa
rent of the node to be replaced (a ${_oldNode.runtimeType})"); | 1660 "Internal error: the visited node (a ${node.runtimeType}) was not the pa
rent of the node to be replaced (a ${_oldNode.runtimeType})"); |
| 1660 } | 1661 } |
| 1661 } | 1662 } |
| 1662 | 1663 |
| 1663 /** | 1664 /** |
| 1664 * An exception that occurred while attempting to parse a replacement for a | 1665 * An exception that occurred while attempting to parse a replacement for a |
| 1665 * specified node in an existing AST structure. | 1666 * specified node in an existing AST structure. |
| 1666 */ | 1667 */ |
| 1668 @deprecated |
| 1667 class IncrementalParseException extends RuntimeException { | 1669 class IncrementalParseException extends RuntimeException { |
| 1668 /** | 1670 /** |
| 1669 * Initialize a newly created exception to have no message and to be its own | 1671 * Initialize a newly created exception to have no message and to be its own |
| 1670 * cause. | 1672 * cause. |
| 1671 */ | 1673 */ |
| 1672 IncrementalParseException() : super(); | 1674 IncrementalParseException() : super(); |
| 1673 | 1675 |
| 1674 /** | 1676 /** |
| 1675 * Initialize a newly created exception to have the given [message] and to be | 1677 * Initialize a newly created exception to have the given [message] and to be |
| 1676 * its own cause. | 1678 * its own cause. |
| 1677 */ | 1679 */ |
| 1678 IncrementalParseException.con1(String message) : super(message: message); | 1680 IncrementalParseException.con1(String message) : super(message: message); |
| 1679 | 1681 |
| 1680 /** | 1682 /** |
| 1681 * Initialize a newly created exception to have no message and to have the | 1683 * Initialize a newly created exception to have no message and to have the |
| 1682 * given [cause]. | 1684 * given [cause]. |
| 1683 */ | 1685 */ |
| 1684 IncrementalParseException.con2(Exception cause) : super(cause: cause); | 1686 IncrementalParseException.con2(Exception cause) : super(cause: cause); |
| 1685 } | 1687 } |
| 1686 | 1688 |
| 1687 /** | 1689 /** |
| 1688 * An object used to re-parse a single AST structure within a larger AST | 1690 * An object used to re-parse a single AST structure within a larger AST |
| 1689 * structure. | 1691 * structure. |
| 1690 */ | 1692 */ |
| 1693 @deprecated |
| 1691 class IncrementalParser { | 1694 class IncrementalParser { |
| 1692 /** | 1695 /** |
| 1693 * The source being parsed. | 1696 * The source being parsed. |
| 1694 */ | 1697 */ |
| 1695 final Source _source; | 1698 final Source _source; |
| 1696 | 1699 |
| 1697 /** | 1700 /** |
| 1698 * A map from old tokens to new tokens used during the cloning process. | 1701 * A map from old tokens to new tokens used during the cloning process. |
| 1699 */ | 1702 */ |
| 1700 final TokenMap _tokenMap; | 1703 final TokenMap _tokenMap; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 } | 1855 } |
| 1853 | 1856 |
| 1854 /** | 1857 /** |
| 1855 * A visitor capable of inferring the correct parser state for incremental | 1858 * A visitor capable of inferring the correct parser state for incremental |
| 1856 * parsing. This visitor visits each parent/child relationship in the chain of | 1859 * parsing. This visitor visits each parent/child relationship in the chain of |
| 1857 * ancestors of the node to be replaced (starting with the root of the parse | 1860 * ancestors of the node to be replaced (starting with the root of the parse |
| 1858 * tree), updating the parser to the correct state for parsing the child of the | 1861 * tree), updating the parser to the correct state for parsing the child of the |
| 1859 * given parent. Once it has visited all of these relationships, the parser | 1862 * given parent. Once it has visited all of these relationships, the parser |
| 1860 * will be in the correct state for reparsing the node to be replaced. | 1863 * will be in the correct state for reparsing the node to be replaced. |
| 1861 */ | 1864 */ |
| 1865 @deprecated |
| 1862 class IncrementalParseStateBuilder extends SimpleAstVisitor { | 1866 class IncrementalParseStateBuilder extends SimpleAstVisitor { |
| 1863 // TODO(paulberry): add support for other pieces of parser state (_inAsync, | 1867 // TODO(paulberry): add support for other pieces of parser state (_inAsync, |
| 1864 // _inGenerator, _inLoop, and _inSwitch). Note that _inLoop and _inSwitch | 1868 // _inGenerator, _inLoop, and _inSwitch). Note that _inLoop and _inSwitch |
| 1865 // only affect error message generation. | 1869 // only affect error message generation. |
| 1866 | 1870 |
| 1867 /** | 1871 /** |
| 1868 * The parser whose state should be built. | 1872 * The parser whose state should be built. |
| 1869 */ | 1873 */ |
| 1870 final Parser _parser; | 1874 final Parser _parser; |
| 1871 | 1875 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 _parser._inInitializer = false; | 1947 _parser._inInitializer = false; |
| 1944 } | 1948 } |
| 1945 } | 1949 } |
| 1946 } | 1950 } |
| 1947 | 1951 |
| 1948 /** | 1952 /** |
| 1949 * An exception indicating that an AST node cannot be re-parsed because there is | 1953 * An exception indicating that an AST node cannot be re-parsed because there is |
| 1950 * not enough context to know how to re-parse the node. Clients can attempt to | 1954 * not enough context to know how to re-parse the node. Clients can attempt to |
| 1951 * re-parse the parent of the node. | 1955 * re-parse the parent of the node. |
| 1952 */ | 1956 */ |
| 1957 @deprecated |
| 1953 class InsufficientContextException extends IncrementalParseException { | 1958 class InsufficientContextException extends IncrementalParseException { |
| 1954 /** | 1959 /** |
| 1955 * Initialize a newly created exception to have no message and to be its own | 1960 * Initialize a newly created exception to have no message and to be its own |
| 1956 * cause. | 1961 * cause. |
| 1957 */ | 1962 */ |
| 1958 InsufficientContextException() : super(); | 1963 InsufficientContextException() : super(); |
| 1959 | 1964 |
| 1960 /** | 1965 /** |
| 1961 * Initialize a newly created exception to have the given [message] and to be | 1966 * Initialize a newly created exception to have the given [message] and to be |
| 1962 * its own cause. | 1967 * its own cause. |
| (...skipping 7971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9934 */ | 9939 */ |
| 9935 const ParserErrorCode(String name, String message, [String correction]) | 9940 const ParserErrorCode(String name, String message, [String correction]) |
| 9936 : super(name, message, correction); | 9941 : super(name, message, correction); |
| 9937 | 9942 |
| 9938 @override | 9943 @override |
| 9939 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | 9944 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 9940 | 9945 |
| 9941 @override | 9946 @override |
| 9942 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | 9947 ErrorType get type => ErrorType.SYNTACTIC_ERROR; |
| 9943 } | 9948 } |
| OLD | NEW |