diff --git a/feature/group.js b/feature/group.js index b02ef4d..19b2a04 100644 --- a/feature/group.js +++ b/feature/group.js @@ -1,6 +1,6 @@ import { err, nary, group } from '../src/parse.js' import { compile, operator } from '../src/compile.js' -import { PREC_ACCESS, PREC_GROUP, PREC_SEQ } from '../src/const.js' +import { PREC_ACCESS, PREC_GROUP, PREC_SEQ, PREC_STATEMENT } from '../src/const.js' // (a,b,c), (a) // FIXME: try raising group precedence (it causes conflict in ?. though) @@ -9,4 +9,4 @@ operator('()', (a) => (!a && err('Empty ()'), compile(a))) const last = (...args) => (args = args.map(compile), ctx => args.map(arg => arg(ctx)).pop()) nary(',', PREC_SEQ), operator(',', last) -nary(';', PREC_SEQ, true), operator(';', last) +nary(';', PREC_STATEMENT, true), operator(';', last) diff --git a/src/const.js b/src/const.js index 6bd62ce..098df33 100644 --- a/src/const.js +++ b/src/const.js @@ -21,6 +21,7 @@ export const // ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence // we mult by 10 to leave space for extensions export const + PREC_STATEMENT = 1, PREC_SEQ = 10, PREC_ASSIGN = 20, PREC_LOR = 30,