1
0
forked from GitHub/gf-core

Handle errors in readExpr

This commit is contained in:
John J. Camilleri
2021-10-08 12:54:36 +02:00
parent a27cf6a17b
commit 71536e8e37
2 changed files with 75 additions and 64 deletions

View File

@@ -201,6 +201,9 @@ function newNGF (abstract_name: string, path?: string): PGFGrammar {
function readExpr (str: string): Expr {
const txt = PgfText_FromString(str)
const expr = runtime.pgf_read_expr(txt, unmarshaller.ref())
if (ref.isNull(expr)) {
throw new PGFError('unable to parse expression')
}
return ref.readObject(expr) as Expr
}