Skip to content

Commit

Permalink
Merge pull request #241 from galegosimpatico/fix-240
Browse files Browse the repository at this point in the history
Fix wrong parse of `(def()->string 'foo')()`.
  • Loading branch information
davewx7 authored Feb 4, 2018
2 parents 001e86d + 99ea45c commit 0e15400
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 0e15400

Please sign in to comment.