aboutsummaryrefslogtreecommitdiff
path: root/src/parser.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.ts')
-rw-r--r--src/parser.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/parser.ts b/src/parser.ts
index 732e32a..eeb9acf 100644
--- a/src/parser.ts
+++ b/src/parser.ts
@@ -108,6 +108,18 @@ const exprParser: P.Parser<Expr> = P.or([
identifierExprParser,
])
+export const parseExpr = (input: string): Expr => {
+ return match(exprParser(input), {
+ Ok: ({ value, input }) => {
+ if (input) throw new Error(`Aaaaaa. Input left: ${input}`)
+ return value
+ },
+ Err: e => {
+ throw e
+ },
+ })
+}
+
const declarationParser = P.or([callExprParser, selectorExprParser])
const multiDeclarationParser = P.sepBy(declarationParser, whitespace)