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 PegParser; | 5 library PegParser; |
6 | 6 |
7 /* | 7 /* |
8 * The following functions are combinators for building Rules. | 8 * The following functions are combinators for building Rules. |
9 * | 9 * |
10 * A rule is one of the following | 10 * A rule is one of the following |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 state.max_rule = [this]; | 364 state.max_rule = [this]; |
365 } else { | 365 } else { |
366 state.max_rule = []; | 366 state.max_rule = []; |
367 } | 367 } |
368 } else if (pos == state.max_pos) { | 368 } else if (pos == state.max_pos) { |
369 if (this is _Expectable) { | 369 if (this is _Expectable) { |
370 state.max_rule.add(this); | 370 state.max_rule.add(this); |
371 } | 371 } |
372 } | 372 } |
373 } | 373 } |
374 // Delegate the matching logic to the the specialized function. | 374 // Delegate the matching logic to the specialized function. |
375 return _match(state, pos); | 375 return _match(state, pos); |
376 } | 376 } |
377 | 377 |
378 // Overridden in subclasses to match the rule. | 378 // Overridden in subclasses to match the rule. |
379 _match(_ParserState state, int pos) => null; | 379 _match(_ParserState state, int pos) => null; |
380 | 380 |
381 // Does the rule generate a value (AST) with the match? | 381 // Does the rule generate a value (AST) with the match? |
382 bool get generatesValue => false; | 382 bool get generatesValue => false; |
383 | 383 |
384 get defaultValue => null; | 384 get defaultValue => null; |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 add(s); | 849 add(s); |
850 add(t); | 850 add(t); |
851 add(u); | 851 add(u); |
852 add(v); | 852 add(v); |
853 add(w); | 853 add(w); |
854 add(x); | 854 add(x); |
855 add(y); | 855 add(y); |
856 add(z); | 856 add(z); |
857 return list; | 857 return list; |
858 } | 858 } |
OLD | NEW |