(s: string)
| 374 | } |
| 375 | |
| 376 | export function parse(s: string): Expression { |
| 377 | if (!s) return 'Nothing'; |
| 378 | try { |
| 379 | // eslint-disable-next-line prefer-const |
| 380 | let [i, result] = expression(s, skipWhitespace(s, 0)); |
| 381 | |
| 382 | i = skipWhitespace(s, i); |
| 383 | |
| 384 | if (i < s.length) |
| 385 | return ['Error', { str: 'unexpected-token' }, { str: s.substring(i) }]; |
| 386 | |
| 387 | return result ?? 'Nothing'; |
| 388 | } catch (e) { |
| 389 | console.error(e instanceof Error ? e.message : String(e)); |
| 390 | } |
| 391 | return 'Nothing'; |
| 392 | } |
no test coverage detected