| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.parser; | 8 library engine.parser; |
| 9 | 9 |
| 10 import "dart:math" as math; | 10 import "dart:math" as math; |
| (...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 // | 1715 // |
| 1716 // Validate that the new node can replace the old node. | 1716 // Validate that the new node can replace the old node. |
| 1717 // | 1717 // |
| 1718 Token mappedToken = _tokenMap.get(oldNode.endToken.next); | 1718 Token mappedToken = _tokenMap.get(oldNode.endToken.next); |
| 1719 if (mappedToken == null || | 1719 if (mappedToken == null || |
| 1720 newNode == null || | 1720 newNode == null || |
| 1721 mappedToken.offset != newNode.endToken.next.offset || | 1721 mappedToken.offset != newNode.endToken.next.offset || |
| 1722 newNode.offset != oldNode.offset) { | 1722 newNode.offset != oldNode.offset) { |
| 1723 advanceToParent = true; | 1723 advanceToParent = true; |
| 1724 } | 1724 } |
| 1725 } on InsufficientContextException catch (exception) { | 1725 } on InsufficientContextException { |
| 1726 advanceToParent = true; | 1726 advanceToParent = true; |
| 1727 } catch (exception) { | 1727 } catch (exception) { |
| 1728 return null; | 1728 return null; |
| 1729 } | 1729 } |
| 1730 if (advanceToParent) { | 1730 if (advanceToParent) { |
| 1731 newNode = null; | 1731 newNode = null; |
| 1732 oldNode = parent; | 1732 oldNode = parent; |
| 1733 originalOffset = oldNode.offset; | 1733 originalOffset = oldNode.offset; |
| 1734 parseToken = _findTokenAt(parseToken, originalOffset); | 1734 parseToken = _findTokenAt(parseToken, originalOffset); |
| 1735 parser.currentToken = parseToken; | 1735 parser.currentToken = parseToken; |
| (...skipping 4999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6735 return new NullLiteral(getAndAdvance()); | 6735 return new NullLiteral(getAndAdvance()); |
| 6736 } else if (_matchesKeyword(Keyword.FALSE)) { | 6736 } else if (_matchesKeyword(Keyword.FALSE)) { |
| 6737 return new BooleanLiteral(getAndAdvance(), false); | 6737 return new BooleanLiteral(getAndAdvance(), false); |
| 6738 } else if (_matchesKeyword(Keyword.TRUE)) { | 6738 } else if (_matchesKeyword(Keyword.TRUE)) { |
| 6739 return new BooleanLiteral(getAndAdvance(), true); | 6739 return new BooleanLiteral(getAndAdvance(), true); |
| 6740 } else if (_matches(TokenType.DOUBLE)) { | 6740 } else if (_matches(TokenType.DOUBLE)) { |
| 6741 Token token = getAndAdvance(); | 6741 Token token = getAndAdvance(); |
| 6742 double value = 0.0; | 6742 double value = 0.0; |
| 6743 try { | 6743 try { |
| 6744 value = double.parse(token.lexeme); | 6744 value = double.parse(token.lexeme); |
| 6745 } on FormatException catch (exception) { | 6745 } on FormatException { |
| 6746 // The invalid format should have been reported by the scanner. | 6746 // The invalid format should have been reported by the scanner. |
| 6747 } | 6747 } |
| 6748 return new DoubleLiteral(token, value); | 6748 return new DoubleLiteral(token, value); |
| 6749 } else if (_matches(TokenType.HEXADECIMAL)) { | 6749 } else if (_matches(TokenType.HEXADECIMAL)) { |
| 6750 Token token = getAndAdvance(); | 6750 Token token = getAndAdvance(); |
| 6751 int value = null; | 6751 int value = null; |
| 6752 try { | 6752 try { |
| 6753 value = int.parse(token.lexeme.substring(2), radix: 16); | 6753 value = int.parse(token.lexeme.substring(2), radix: 16); |
| 6754 } on FormatException catch (exception) { | 6754 } on FormatException { |
| 6755 // The invalid format should have been reported by the scanner. | 6755 // The invalid format should have been reported by the scanner. |
| 6756 } | 6756 } |
| 6757 return new IntegerLiteral(token, value); | 6757 return new IntegerLiteral(token, value); |
| 6758 } else if (_matches(TokenType.INT)) { | 6758 } else if (_matches(TokenType.INT)) { |
| 6759 Token token = getAndAdvance(); | 6759 Token token = getAndAdvance(); |
| 6760 int value = null; | 6760 int value = null; |
| 6761 try { | 6761 try { |
| 6762 value = int.parse(token.lexeme); | 6762 value = int.parse(token.lexeme); |
| 6763 } on FormatException catch (exception) { | 6763 } on FormatException { |
| 6764 // The invalid format should have been reported by the scanner. | 6764 // The invalid format should have been reported by the scanner. |
| 6765 } | 6765 } |
| 6766 return new IntegerLiteral(token, value); | 6766 return new IntegerLiteral(token, value); |
| 6767 } else if (_matches(TokenType.STRING)) { | 6767 } else if (_matches(TokenType.STRING)) { |
| 6768 return parseStringLiteral(); | 6768 return parseStringLiteral(); |
| 6769 } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) { | 6769 } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) { |
| 6770 return _parseMapLiteral(null, null); | 6770 return _parseMapLiteral(null, null); |
| 6771 } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) || | 6771 } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) || |
| 6772 _matches(TokenType.INDEX)) { | 6772 _matches(TokenType.INDEX)) { |
| 6773 return _parseListLiteral(null, null); | 6773 return _parseListLiteral(null, null); |
| (...skipping 3763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10537 } | 10537 } |
| 10538 | 10538 |
| 10539 /** | 10539 /** |
| 10540 * Copy resolution data from the [fromNode] to the [toNode]. | 10540 * Copy resolution data from the [fromNode] to the [toNode]. |
| 10541 */ | 10541 */ |
| 10542 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 10542 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
| 10543 ResolutionCopier copier = new ResolutionCopier(); | 10543 ResolutionCopier copier = new ResolutionCopier(); |
| 10544 copier._isEqualNodes(fromNode, toNode); | 10544 copier._isEqualNodes(fromNode, toNode); |
| 10545 } | 10545 } |
| 10546 } | 10546 } |
| OLD | NEW |