Skip to content

Commit

Permalink
Fix wrong parse of (def()->string 'foo')().
Browse files Browse the repository at this point in the history
Duck tape issue #240.
  • Loading branch information
galegosimpatico committed Feb 2, 2018
1 parent 3e2187c commit 99ea45c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/formula.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4453,7 +4453,12 @@ static std::string debugSubexpressionTypes(ConstFormulaPtr & fml)

if(op == nullptr) {
if(i1->type == FFL_TOKEN_TYPE::LPARENS && (i2-1)->type == FFL_TOKEN_TYPE::RPARENS) {
// This `if` will prevent ` ( def ( ) -> int 32993 ) ( ) `
// from being incorrectly interpreted as that
// ` def ( ) -> int 32993 ) ( ` must be parsed.
if (i2 - 2 >= i1 && (i2 - 2)->type != FFL_TOKEN_TYPE::LPARENS) {
return parse_expression(formula_str, i1+1,i2-1,symbols, callable_def, can_optimize);
}
} else if( (i2-1)->type == FFL_TOKEN_TYPE::RSQUARE) { //check if there is [ ] : either a list definition, or a operator
const Token* tok = i2-2;
int square_parens = 0;
Expand Down

0 comments on commit 99ea45c

Please sign in to comment.