Skip to content

Commit

Permalink
made exponentiation right-assoc #43
Browse files Browse the repository at this point in the history
  • Loading branch information
m93a committed Jun 23, 2021
1 parent a493047 commit 6709e73
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/browser/filtrex.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ var filtrex = (function (exports) {
8: [2, 8],
9: [2, 8],
10: [2, 8],
11: [2, 8],
11: [1, 17],
12: [2, 8],
13: [2, 8],
16: [2, 8],
Expand Down
2 changes: 1 addition & 1 deletion dist/browser/filtrex.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cjs/filtrex.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ var _parser = (function() {
8: [2, 8],
9: [2, 8],
10: [2, 8],
11: [2, 8],
11: [1, 17],
12: [2, 8],
13: [2, 8],
16: [2, 8],
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/generateParser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const grammar = {
['left', '+', '-'],
['left', '*', '/', '%'],
['left', 'not', 'UMINUS'],
['left', '^'],
['right', '^'],
['left', 'of'],
],
// Grammar
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ var _parser = (function() {
8: [2, 8],
9: [2, 8],
10: [2, 8],
11: [2, 8],
11: [1, 17],
12: [2, 8],
13: [2, 8],
16: [2, 8],
Expand Down
2 changes: 1 addition & 1 deletion src/generateParser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const grammar = {
['left', '+', '-'],
['left', '*', '/', '%'],
['left', 'not', 'UMINUS'],
['left', '^'],
['right', '^'],
['left', 'of'],
],
// Grammar
Expand Down
4 changes: 4 additions & 0 deletions test/arithmetics.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,8 @@ describe('Arithmetics', () => {
expect( eval('-x^2', {x:2}) ).equals(-4)
})

it('exponentiation is right-associative', () => {
expect( eval('5^3^2') ).equals(5**(3**2))
})

});

0 comments on commit 6709e73

Please sign in to comment.