specify the end token for simple block in _expr() (#580)

This commit is contained in:
tophf 2018-11-25 08:13:33 +03:00 committed by Rob Garrison
parent 764fe399f3
commit 319ec320c7

View File

@ -4777,7 +4777,7 @@ self.parserlib = (() => {
return result;
}
_expr(inFunction) {
_expr(inFunction, endToken = Tokens.RPAREN) {
const stream = this._tokenStream;
const values = [];
@ -4786,7 +4786,7 @@ self.parserlib = (() => {
if (!value && !values.length) return null;
// get everything inside the parens and let validateProperty handle that
if (!value && inFunction && stream.peek() !== Tokens.RPAREN) {
if (!value && inFunction && stream.peek() !== endToken) {
stream.get();
value = new PropertyValuePart(stream._token);
} else if (!value) {
@ -4914,8 +4914,9 @@ self.parserlib = (() => {
inFunction && Tokens.LBRACE,
])) {
const token = stream._token;
token.expr = this._expr(inFunction);
stream.mustMatch(Tokens.type(token.endChar));
const endToken = Tokens.type(token.endChar);
token.expr = this._expr(inFunction, endToken);
stream.mustMatch(endToken);
return finalize(token, token.value + (token.expr || '') + token.endChar);
}