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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 : extractor); | 139 : extractor); |
140 | 140 |
141 /** | 141 /** |
142 * Matches an optional rule. | 142 * Matches an optional rule. |
143 * | 143 * |
144 * MAYBE is a value generating matcher. | 144 * MAYBE is a value generating matcher. |
145 * | 145 * |
146 * If [rule] is value generating then the value is the value generated by [rule] | 146 * If [rule] is value generating then the value is the value generated by [rule] |
147 * if it matches, and [:null:] if it does not. | 147 * if it matches, and [:null:] if it does not. |
148 * | 148 * |
149 * If [rule] is not value generatinge then the value is [:true:] if [rule] | 149 * If [rule] is not value generating then the value is [:true:] if [rule] |
150 * matches and [:false:] if it does not. | 150 * matches and [:false:] if it does not. |
151 */ | 151 */ |
152 _Rule MAYBE(rule) => new _OptionalRule(_compile(rule)); | 152 _Rule MAYBE(rule) => new _OptionalRule(_compile(rule)); |
153 | 153 |
154 /** | 154 /** |
155 * MANY(rule) matches [rule] [min] or more times. | 155 * MANY(rule) matches [rule] [min] or more times. |
156 * [min] must be 0 or 1. | 156 * [min] must be 0 or 1. |
157 * If [separator] is provided it is used to match a separator between matches of | 157 * If [separator] is provided it is used to match a separator between matches of |
158 * [rule]. | 158 * [rule]. |
159 * | 159 * |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 add(s); | 878 add(s); |
879 add(t); | 879 add(t); |
880 add(u); | 880 add(u); |
881 add(v); | 881 add(v); |
882 add(w); | 882 add(w); |
883 add(x); | 883 add(x); |
884 add(y); | 884 add(y); |
885 add(z); | 885 add(z); |
886 return list; | 886 return list; |
887 } | 887 } |
OLD | NEW |