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 #library("status_expression"); | 5 #library("status_expression"); |
6 | 6 |
7 /** | 7 /** |
8 * Parse and evaluate expressions in a .status file for Dart and V8. | 8 * Parse and evaluate expressions in a .status file for Dart and V8. |
9 * There are set expressions and Boolean expressions in a .status file. | 9 * There are set expressions and Boolean expressions in a .status file. |
10 * The grammar is: | 10 * The grammar is: |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 String current; | 175 String current; |
176 | 176 |
177 Scanner(this.tokens) { | 177 Scanner(this.tokens) { |
178 tokenIterator = tokens.iterator(); | 178 tokenIterator = tokens.iterator(); |
179 advance(); | 179 advance(); |
180 } | 180 } |
181 | 181 |
182 bool hasMore() => current != null; | 182 bool hasMore() => current != null; |
183 | 183 |
184 void advance() { | 184 void advance() { |
185 current = tokenIterator.hasNext() ? tokenIterator.next() : null; | 185 current = tokenIterator.hasNext ? tokenIterator.next() : null; |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 | 189 |
190 class ExpressionParser { | 190 class ExpressionParser { |
191 Scanner scanner; | 191 Scanner scanner; |
192 | 192 |
193 ExpressionParser(this.scanner); | 193 ExpressionParser(this.scanner); |
194 | 194 |
195 SetExpression parseSetExpression() => parseSetUnion(); | 195 SetExpression parseSetExpression() => parseSetUnion(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 "Expected identifier in expression, got ${scanner.current}"); | 288 "Expected identifier in expression, got ${scanner.current}"); |
289 TermConstant right = new TermConstant(scanner.current); | 289 TermConstant right = new TermConstant(scanner.current); |
290 scanner.advance(); | 290 scanner.advance(); |
291 return new Comparison(left, right); | 291 return new Comparison(left, right); |
292 } else { | 292 } else { |
293 return new BooleanVariable(left); | 293 return new BooleanVariable(left); |
294 } | 294 } |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
OLD | NEW |