forked from prettier/prettier
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added jison action code test cases. (Running into trouble cf. jestjs/…
…jest#2441 while trying to make these work. !@#$%^&*-jest!)
- Loading branch information
1 parent
f9bcfbf
commit bf84c93
Showing
30 changed files
with
135 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rv = #LABEL#; |
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 @@ | ||
@$ = @1 + 1; |
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 @@ | ||
$$ = $1.tx(`blub: ${$1} @ ${@1} vs. ${@alt_loc}?`); |
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 @@ | ||
yyparser.prettyPrint(`no dice! ${#ID#} is not what you are looking for!`); |
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,4 @@ | ||
$1.push($2, { | ||
yylloc, | ||
tokens: [#1, #2], | ||
}) |
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,2 @@ | ||
if ($1 > 0) YYCONTINUE | ||
yyerror("B0rk @ " + #STMT) |
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 @@ | ||
$$ = $1.tx(`blub: ${$$1} @ ${@@1} vs. ${##alt_loc}?`); |
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,6 @@ | ||
// test jison negative index reference variables recognition: | ||
$$ = { | ||
val: $-1 + a.tx(`blub: ${$$-2} @ ${@@-3} vs. ${##-4}?`), | ||
loc: @-5, | ||
idx: #-6, | ||
}; |
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,11 @@ | ||
if ($prec) { | ||
if ($handle.length === 0) { | ||
yyerror(rmCommonWS` | ||
You cannot specify a precedence override for an epsilon (a.k.a. empty) rule! | ||
Erroneous area: | ||
${yylexer.prettyPrintRange(@handle, @0 /* @handle is very probably NULL! We need this one for some decent location info! */, @action /* ditto! */)} | ||
`); | ||
} | ||
$$.push($prec); | ||
} |
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,4 @@ | ||
// test jison variable decoding edge cases: accept any number of $ as legal variable names | ||
if ($) { | ||
$$.push($); | ||
} |
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,7 @@ | ||
// any jison var referencing current value is okay: $$, @$, #$, ##$, #$# | ||
$$ = 0; | ||
@$.range = [1, 2]; | ||
// highly suspect as the next few are considered strictly CONSTANTS/RVALUES in JISON: | ||
#$--; | ||
##$--; | ||
#$#--; |
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,3 @@ | ||
// do not confuse jison vars with @def or @@iter ES7/ESX constructs: | ||
@def.start_line = 1; | ||
@@iter.range = [2, 3]; |
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,8 @@ | ||
// negative index jison variables: | ||
$$ = $-1 + $-2 + $12; | ||
@$ = @-1 + @0; | ||
|
||
// babel itself does not have the smarts built in to detect the wrongness in these: | ||
#$ = #-1 + #0; | ||
##$ = ##-1 + ##7; | ||
#$# += #-1# + #0#; |
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,2 @@ | ||
// illegal = non-jison identifier: | ||
rv = #1#2#; |
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,2 @@ | ||
// illegal = non-jison identifiers: | ||
location@home = 1; |
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,2 @@ | ||
// illegal = non-jison markers. These are not identifiers! | ||
rv = #; |
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,2 @@ | ||
// illegal = non-jison markers. These are not identifiers! | ||
rv = @; |
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,2 @@ | ||
// illegal = non-jison markers. These are not identifiers! | ||
rv = #@; |
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,2 @@ | ||
// illegal = non-jison identifier: | ||
rv = a2#; |
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,2 @@ | ||
// illegal = non-jison identifier: | ||
rv = a#b; |
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,2 @@ | ||
// illegal = non-jison identifier: | ||
rv = a#b; |
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,2 @@ | ||
// illegal = non-jison identifier: | ||
rv = @@; |
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,2 @@ | ||
// illegal = non-jison identifier: | ||
rv = ##; |
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,2 @@ | ||
// illegal = non-jison identifier: yet this decodes as legal JS: `$ - $` | ||
rv = @-@; |
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,43 @@ | ||
// const defaultOptions = { | ||
// // Source type ("script" or "module") for different semantics | ||
// sourceType: "script", | ||
// // Source filename. | ||
// sourceFilename: undefined, | ||
// // Line from which to start counting source. Useful for | ||
// // integration with other tools. | ||
// startLine: 1, | ||
// // When enabled, await at the top level is not considered an | ||
// // error. | ||
// allowAwaitOutsideFunction: false, | ||
// // When enabled, a return at the top level is not considered an | ||
// // error. | ||
// allowReturnOutsideFunction: false, | ||
// // When enabled, import/export statements are not constrained to | ||
// // appearing at the top of the program. | ||
// allowImportExportEverywhere: false, | ||
// // TODO | ||
// allowSuperOutsideMethod: false, | ||
// // An array of plugins to enable | ||
// plugins: [], | ||
// // TODO | ||
// strictMode: null, | ||
// // Nodes have their start and end characters offsets recorded in | ||
// // `start` and `end` properties (directly on the node, rather than | ||
// // the `loc` object, which holds line/column data. To also add a | ||
// // [semi-standardized][range] `range` property holding a `[start, | ||
// // end]` array with the same numbers, set the `ranges` option to | ||
// // `true`. | ||
// // | ||
// // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 | ||
// ranges: false, | ||
// // Adds all parsed tokens to a `tokens` property on the `File` node | ||
// tokens: false, | ||
// // Recognize JISON action block variables, e.g. `#1` or `@id` | ||
// jisonVariables: false, | ||
// }; | ||
|
||
run_spec(__dirname, ["babylon"], { | ||
parserOptions: { | ||
jisonVariables: true | ||
} | ||
}); |
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,2 @@ | ||
// illegal = non-jison identifier: yet this decodes as legal JS: `$ - $` | ||
rv = $-$; |
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,2 @@ | ||
// this decodes as legal JS: `$ - 5` | ||
rv = $- 5; |
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,2 @@ | ||
// this decodes as legal JS: `$ - 5` | ||
rv = $ -5; |
Submodule aficionado
added at
9c3946
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,13 @@ | ||
{ | ||
"name": "tmp", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
} | ||
} |