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 #import('../../../peg/pegparser.dart'); | 5 #library("peg_tests"); |
| 6 #import('../../peg/pegparser.dart'); |
6 | 7 |
7 testParens() { | 8 testParens() { |
8 Grammar g = new Grammar(); | 9 Grammar g = new Grammar(); |
9 Symbol a = g['A']; | 10 Symbol a = g['A']; |
10 | 11 |
11 a.def = ['(', MANY(a, min:0), ')', (a) => a]; | 12 a.def = ['(', MANY(a, min:0), ')', (a) => a]; |
12 | 13 |
13 check(g, a, "", null); | 14 check(g, a, "", null); |
14 check(g, a, "()", '[]'); | 15 check(g, a, "()", '[]'); |
15 check(g, a, "(()())", '[[],[]]'); | 16 check(g, a, "(()())", '[[],[]]'); |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 338 } |
338 | 339 |
339 main() { | 340 main() { |
340 testCODE(); | 341 testCODE(); |
341 testParens(); | 342 testParens(); |
342 testOR(); | 343 testOR(); |
343 testTEXT(); | 344 testTEXT(); |
344 testBlockComment(); | 345 testBlockComment(); |
345 testC(); | 346 testC(); |
346 } | 347 } |
OLD | NEW |