feat(Parser): associate pipes right to left
closes #4605 BREAKING CHANGE: Before: `1 + 1 | pipe:a | pipe:b` was parsed as `(1 + 1) | pipe:(a | pipe:b)` After: `1 + 1 | pipe:a | pipe:b` is parsed as `((1 + 1) | pipe:a) | pipe:b` Closes #4716
This commit is contained in:
@@ -216,6 +216,14 @@ export class _ParseAST {
|
||||
return n.toString();
|
||||
}
|
||||
|
||||
parseSimpleBinding(): AST {
|
||||
var ast = this.parseChain();
|
||||
if (!SimpleExpressionChecker.check(ast)) {
|
||||
this.error(`Simple binding expression can only contain field access and constants'`);
|
||||
}
|
||||
return ast;
|
||||
}
|
||||
|
||||
parseChain(): AST {
|
||||
var exprs = [];
|
||||
while (this.index < this.tokens.length) {
|
||||
@@ -237,14 +245,6 @@ export class _ParseAST {
|
||||
return new Chain(exprs);
|
||||
}
|
||||
|
||||
parseSimpleBinding(): AST {
|
||||
var ast = this.parseChain();
|
||||
if (!SimpleExpressionChecker.check(ast)) {
|
||||
this.error(`Simple binding expression can only contain field access and constants'`);
|
||||
}
|
||||
return ast;
|
||||
}
|
||||
|
||||
parsePipe(): AST {
|
||||
var result = this.parseExpression();
|
||||
if (this.optionalOperator("|")) {
|
||||
@@ -256,7 +256,7 @@ export class _ParseAST {
|
||||
var name = this.expectIdentifierOrKeyword();
|
||||
var args = [];
|
||||
while (this.optionalCharacter($COLON)) {
|
||||
args.push(this.parsePipe());
|
||||
args.push(this.parseExpression());
|
||||
}
|
||||
result = new BindingPipe(result, name, args);
|
||||
} while (this.optionalOperator("|"));
|
||||
|
||||
Reference in New Issue
Block a user