| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class ArrayBasedScanner<S> extends AbstractScanner<S> { | 5 class ArrayBasedScanner<S> extends AbstractScanner<S> { |
| 6 int get charOffset() => byteOffset + extraCharOffset; | 6 int get charOffset() => byteOffset + extraCharOffset; |
| 7 final Token tokens; | 7 final Token tokens; |
| 8 Token tail; | 8 Token tail; |
| 9 int tokenStart; | 9 int tokenStart; |
| 10 int byteOffset; | 10 int byteOffset; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 groupingStack.head.kind === LT_TOKEN) { | 85 groupingStack.head.kind === LT_TOKEN) { |
| 86 groupingStack = groupingStack.tail; | 86 groupingStack = groupingStack.tail; |
| 87 } | 87 } |
| 88 groupingStack = groupingStack.prepend(token); | 88 groupingStack = groupingStack.prepend(token); |
| 89 } | 89 } |
| 90 | 90 |
| 91 int appendEndGroup(PrecedenceInfo info, String value, int openKind) { | 91 int appendEndGroup(PrecedenceInfo info, String value, int openKind) { |
| 92 assert(openKind !== LT_TOKEN); | 92 assert(openKind !== LT_TOKEN); |
| 93 appendStringToken(info, value); | 93 appendStringToken(info, value); |
| 94 if (groupingStack.isEmpty()) { | 94 if (groupingStack.isEmpty()) { |
| 95 throw new MalformedInputException('Unmatched $value'); | 95 return advance(); |
| 96 } | 96 } |
| 97 discardOpenLt(); | 97 discardOpenLt(); |
| 98 BeginGroupToken begin = groupingStack.head; | 98 BeginGroupToken begin = groupingStack.head; |
| 99 if (begin.kind !== openKind) { | 99 if (begin.kind !== openKind) { |
| 100 if (openKind !== OPEN_CURLY_BRACKET_TOKEN || | 100 if (openKind !== OPEN_CURLY_BRACKET_TOKEN || |
| 101 begin.kind !== STRING_INTERPOLATION_TOKEN) { | 101 begin.kind !== STRING_INTERPOLATION_TOKEN) { |
| 102 // Not ending string interpolation. | 102 // Not ending string interpolation. |
| 103 throw new MalformedInputException('Unmatched ${begin.stringValue}'); | 103 throw new MalformedInputException('Unmatched ${begin.stringValue}'); |
| 104 } | 104 } |
| 105 // We're ending an interpolated expression. | 105 // We're ending an interpolated expression. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 groupingStack = groupingStack.tail; | 152 groupingStack = groupingStack.tail; |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 void discardOpenLt() { | 156 void discardOpenLt() { |
| 157 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) { | 157 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) { |
| 158 groupingStack = groupingStack.tail; | 158 groupingStack = groupingStack.tail; |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 } | 161 } |
| OLD | NEW |