OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:source_span/source_span.dart'; | 5 import 'package:source_span/source_span.dart'; |
6 | 6 |
7 import 'ast.dart'; | 7 import 'ast.dart'; |
8 import 'scanner.dart'; | 8 import 'scanner.dart'; |
9 import 'token.dart'; | 9 import 'token.dart'; |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 case TokenType.leftParen: | 90 case TokenType.leftParen: |
91 var child = _conditional(); | 91 var child = _conditional(); |
92 if (!_scanner.scan(TokenType.rightParen)) { | 92 if (!_scanner.scan(TokenType.rightParen)) { |
93 throw new SourceSpanFormatException( | 93 throw new SourceSpanFormatException( |
94 'Expected ")".', _scanner.peek().span); | 94 'Expected ")".', _scanner.peek().span); |
95 } | 95 } |
96 return child; | 96 return child; |
97 | 97 |
98 case TokenType.identifier: | 98 case TokenType.identifier: |
99 return new VariableNode(token.name, token.span); | 99 return new VariableNode((token as IdentifierToken).name, token.span); |
100 | 100 |
101 default: | 101 default: |
102 throw new SourceSpanFormatException("Expected expression.", token.span); | 102 throw new SourceSpanFormatException("Expected expression.", token.span); |
103 } | 103 } |
104 } | 104 } |
105 } | 105 } |
OLD | NEW |