unget the unary token if got no term to finalize

This commit is contained in:
tophf 2018-01-07 19:11:00 +03:00
parent acbb69e5ad
commit 9111ebcd2b

View File

@ -4840,6 +4840,7 @@ self.parserlib = (() => {
const unary = stream.match([Tokens.MINUS, Tokens.PLUS]) && stream._token; const unary = stream.match([Tokens.MINUS, Tokens.PLUS]) && stream._token;
const finalize = (token, value) => { const finalize = (token, value) => {
if (!token && unary) stream.unget();
if (!token) return null; if (!token) return null;
if (token instanceof SyntaxUnit) return token; if (token instanceof SyntaxUnit) return token;
if (unary) { if (unary) {