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
Copy file name to clipboardExpand all lines: readme.md
+22-23Lines changed: 22 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -66,10 +66,10 @@ License: MIT
66
66
67
67
- [Combinators](#Combinators)
68
68
- [Const](#Const)
69
-
- [Until](#Until)
70
69
- [Tuple](#Tuple)
71
70
- [Union](#Union)
72
71
- [Array](#Array)
72
+
- [Until](#Until)
73
73
- [Optional](#Optional)
74
74
- [Epsilon](#Epsilon)
75
75
- [Terminals](#Terminals)
@@ -107,28 +107,6 @@ const T = Runtime.Const('X') // const T = {
107
107
const R =Runtime.Parse(T, 'X Y Z') // const R = ['X', ' Y Z']
108
108
```
109
109
110
-
111
-
### Until
112
-
113
-
The Until combinator parses all characters up unto the specified string. This parser parser will leave the specified string unconsumed. If the specified string is not found, this parser will fail.
114
-
115
-
**BNF**
116
-
117
-
```bnf
118
-
<T> ::= ? any character until 'Z' ?
119
-
```
120
-
121
-
**TypeScript**
122
-
123
-
```typescript
124
-
const T =Runtime.Until('Z') // const T = {
125
-
// type: 'Until',
126
-
// value: 'X'
127
-
// }
128
-
129
-
const R =Runtime.Parse(T, 'X Y Z') // const R = ['X Y ', 'Z']
130
-
```
131
-
132
110
### Tuple
133
111
134
112
The Tuple parser matches a sequence of parsers, with an empty tuple representing Epsilon (the empty production).
@@ -209,6 +187,27 @@ const R2 = Runtime.Parse(T, 'X X X Y Z') // const R2 = [['X', 'X', '
The Until combinator parses all characters up to (but not including) the specified string. The specified string remains unconsumed in the input. If the string is not found, parsing fails.
193
+
194
+
**BNF**
195
+
196
+
```bnf
197
+
<T> ::= ? any character until 'Z' ?
198
+
```
199
+
200
+
**TypeScript**
201
+
202
+
```typescript
203
+
const T =Runtime.Until('Z') // const T = {
204
+
// type: 'Until',
205
+
// value: 'X'
206
+
// }
207
+
208
+
const R =Runtime.Parse(T, 'X Y Z') // const R = ['X Y ', 'Z']
209
+
```
210
+
212
211
### Optional
213
212
214
213
The Optional combinator parses zero or one occurrence of the interior parser, returning a tuple with one element or an empty tuple if there is no match.
0 commit comments