forked from zaach/jison
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding and updating test cases for "lexer ES6 arrow functions in acti…
…on code" issue: zaach/jison-lex#23
- Loading branch information
1 parent
8758ceb
commit dbbce60
Showing
8 changed files
with
992 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// title: Parse error when using arrow function in rules | ||
// test_input: A a B C 1 + 2 + 3 | ||
// ... | ||
// | ||
// This is the SUCCESSFUL lexer spec | ||
// | ||
|
||
let grammar = { | ||
rules: [ | ||
['\\s+', ''], | ||
['\\d+', 'return "NUMBER"'], | ||
['\\w+', ` | ||
if (yytext === 'a') { | ||
return 'TOK_A'; | ||
} else { | ||
return 'WORD'; | ||
} | ||
` | ||
], | ||
['\\+', 'return "+"'], | ||
['$', 'return "EOF"'], | ||
] | ||
}; | ||
|
||
module.exports = grammar; | ||
// export default grammar; | ||
|
303 changes: 303 additions & 0 deletions
303
packages/jison-lex/tests/specs/003-issue-23-alt-good.js-ref.json5
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// title: Parse error when using arrow function in rules | ||
// test_input: A a B C 1 + 2 + 3 | ||
// ... | ||
// | ||
// This is the SUCCESSFUL lexer spec | ||
// | ||
|
||
let grammar = { | ||
rules: [ | ||
['\\s+', ''], | ||
['\\d+', function () { return 'NUMBER'}], | ||
['\\w+', function () { | ||
if (yytext === 'a') { | ||
return 'TOK_A'; | ||
} else { | ||
return 'WORD'; | ||
} | ||
} | ||
], | ||
['\\+', function () { return '+' }], | ||
['$', function () { return 'EOF' }], | ||
] | ||
}; | ||
|
||
module.exports = grammar; | ||
// export default grammar; | ||
|
303 changes: 303 additions & 0 deletions
303
packages/jison-lex/tests/specs/003-issue-23-good.js-ref.json5
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// title: Parse error when using arrow function in rules | ||
// test_input: A a B C 1 + 2 + 3 | ||
// ... | ||
// | ||
// This is the FAILING lexer spec | ||
// | ||
|
||
let grammar = { | ||
rules: [ | ||
['\\s+', ''], | ||
['\\d+', () => 'NUMBER'], | ||
['\\w+', () => { | ||
if (yytext === 'a') { | ||
return 'TOK_A'; | ||
} else { | ||
return 'WORD'; | ||
} | ||
} | ||
], | ||
['\\+', () => '+'], | ||
['$', () => 'EOF'], | ||
] | ||
}; | ||
|
||
module.exports = grammar; | ||
// export default grammar; | ||
|
303 changes: 303 additions & 0 deletions
303
packages/jison-lex/tests/specs/003-issue-23-trouble.js-ref.json5
Large diffs are not rendered by default.
Oops, something went wrong.