Skip to content

Commit

Permalink
Merge pull request #11 from msantos/fix-zero-arity-fun
Browse files Browse the repository at this point in the history
Fix parsing of 0-arity functions
  • Loading branch information
joewalnes committed Mar 6, 2015
2 parents 3e85f75 + c742dc3 commit 218c5be
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions filtrex.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ function filtrexParser() {
['NUMBER' , code([1])],
['STRING' , code(['"', 1, '"'])],
['SYMBOL' , code(['data["', 1, '"]'])],
['SYMBOL ( )', code(['(functions.hasOwnProperty("', 1, '") ? functions.', 1, '() : unknown("', 1, '"))'])],
['SYMBOL ( argsList )', code(['(functions.hasOwnProperty("', 1, '") ? functions.', 1, '(', 3, ') : unknown("', 1, '"))'])],
['e in ( inSet )', code([1, ' in (function(o) { ', 4, 'return o; })({})'])],
['e not in ( inSet )', code(['!(', 1, ' in (function(o) { ', 5, 'return o; })({}))'])],
Expand Down
1 change: 1 addition & 0 deletions src/filtrex.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ function filtrexParser() {
['NUMBER' , code([1])],
['STRING' , code(['"', 1, '"'])],
['SYMBOL' , code(['data["', 1, '"]'])],
['SYMBOL ( )', code(['(functions.hasOwnProperty("', 1, '") ? functions.', 1, '() : unknown("', 1, '"))'])],
['SYMBOL ( argsList )', code(['(functions.hasOwnProperty("', 1, '") ? functions.', 1, '(', 3, ') : unknown("', 1, '"))'])],
['e in ( inSet )', code([1, ' in (function(o) { ', 4, 'return o; })({})'])],
['e not in ( inSet )', code(['!(', 1, ' in (function(o) { ', 5, 'return o; })({}))'])],
Expand Down
1 change: 1 addition & 0 deletions test/filtrex-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},

'functions with multiple args': function() {
eq(1, compileExpression('random() >= 0')());
eq(2, compileExpression('min(2)')());
eq(2, compileExpression('max(2)')());
eq(2, compileExpression('min(2, 5)')());
Expand Down

0 comments on commit 218c5be

Please sign in to comment.