| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 !groupingStack.isEmpty() && | 90 !groupingStack.isEmpty() && |
| 91 groupingStack.head.kind === LT_TOKEN) { | 91 groupingStack.head.kind === LT_TOKEN) { |
| 92 groupingStack = groupingStack.tail; | 92 groupingStack = groupingStack.tail; |
| 93 } | 93 } |
| 94 groupingStack = groupingStack.prepend(token); | 94 groupingStack = groupingStack.prepend(token); |
| 95 } | 95 } |
| 96 | 96 |
| 97 int appendEndGroup(PrecedenceInfo info, String value, int openKind) { | 97 int appendEndGroup(PrecedenceInfo info, String value, int openKind) { |
| 98 assert(openKind !== LT_TOKEN); | 98 assert(openKind !== LT_TOKEN); |
| 99 appendStringToken(info, value); | 99 appendStringToken(info, value); |
| 100 discardOpenLt(); |
| 100 if (groupingStack.isEmpty()) { | 101 if (groupingStack.isEmpty()) { |
| 101 return advance(); | 102 return advance(); |
| 102 } | 103 } |
| 103 discardOpenLt(); | |
| 104 BeginGroupToken begin = groupingStack.head; | 104 BeginGroupToken begin = groupingStack.head; |
| 105 if (begin.kind !== openKind) { | 105 if (begin.kind !== openKind) { |
| 106 if (openKind !== OPEN_CURLY_BRACKET_TOKEN || | 106 if (openKind !== OPEN_CURLY_BRACKET_TOKEN || |
| 107 begin.kind !== STRING_INTERPOLATION_TOKEN) { | 107 begin.kind !== STRING_INTERPOLATION_TOKEN) { |
| 108 // Not ending string interpolation. | 108 // Not ending string interpolation. |
| 109 throw new MalformedInputException('Unmatched ${begin.stringValue}', | 109 throw new MalformedInputException('Unmatched ${begin.stringValue}', |
| 110 begin); | 110 begin); |
| 111 } | 111 } |
| 112 // We're ending an interpolated expression. | 112 // We're ending an interpolated expression. |
| 113 begin.endGroup = tail; | 113 begin.endGroup = tail; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 void discardOpenLt() { | 163 void discardOpenLt() { |
| 164 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) { | 164 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) { |
| 165 groupingStack = groupingStack.tail; | 165 groupingStack = groupingStack.tail; |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 // TODO(ahe): make class abstract instead of adding an abstract method. | 169 // TODO(ahe): make class abstract instead of adding an abstract method. |
| 170 abstract peek(); | 170 abstract peek(); |
| 171 } | 171 } |
| OLD | NEW |