You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ParseBox range combinators match character sequences up to one or more terminating sentinel strings. These combinators are used to match arbituary Unicode (UTF-16) sequences.
244
-
245
-
246
-
### Until
247
-
248
-
The Until combinator parses characters up to (but not including) one of the specified sentinel string values. It captures all characters encountered before the sentinel. If a sentinel value is not found in the input, parsing fails. Until succeeds even if it matches a zero-length string. This occurs if a sentinel is found immediately at the current parsing position.
249
-
250
-
**BNF**
251
-
252
-
```bnf
253
-
<T> ::= ? any character sequence (0 or more) until 'Z' ?
254
-
```
255
-
256
-
**TypeScript**
257
-
258
-
```typescript
259
-
const T =Runtime.Until(['Z']) // const T = {
260
-
// type: 'Until',
261
-
// values: ['Z']
262
-
// }
263
-
264
-
const R =Runtime.Parse(T, 'X Y Z') // const R = ['X Y ', 'Z']
265
-
```
266
-
267
-
### UntilNonEmpty
268
-
269
-
The UntilNonEmpty combinator works the same as Until, but it fails if the parsed content yields a zero-length string.
270
-
271
-
**BNF**
272
-
273
-
```bnf
274
-
<T> ::= ? any character sequence (1 or more) until 'Z'. fails on zero length ?
275
-
```
276
-
277
-
**TypeScript**
278
-
279
-
```typescript
280
-
const T =Runtime.UntilNonEmpty(['Z']) // const T = {
281
-
// type: 'UntilNonEmpty',
282
-
// values: ['Z']
283
-
// }
284
-
285
-
const R1 =Runtime.Parse(T, 'X Y Z') // const R1 = ['X Y ', 'Z']
ParseBox provides combinators for parsing common lexical tokens, such as numbers, identifiers, and strings, enabling static, optimized parsing of typical JavaScript constructs.
0 commit comments