(...potentials: Array<ParseYieldable | any>)
| 151 | } |
| 152 | |
| 153 | export function optional(...potentials: Array<ParseYieldable | any>): () => ParseGenerator<any> { |
| 154 | return function* () { |
| 155 | const result = yield [...potentials, '']; |
| 156 | return result === '' ? undefined : result; |
| 157 | }; |
| 158 | } |
| 159 | |
| 160 | export function lookAhead(regex: RegExp) { |
| 161 | const lookAheadRegex = new RegExp(`^(?=${regex.source})`); |
no outgoing calls