Skip to content

Commit

Permalink
parser: More tests for percent topic + modulo
Browse files Browse the repository at this point in the history
  • Loading branch information
js-choi committed Jun 3, 2021
1 parent 40108c0 commit 5d24958
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a |> %
function f() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"type": "File",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}},
"program": {
"type": "Program",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}},
"left": {
"type": "Identifier",
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"},
"name": "a"
},
"operator": "|>",
"right": {
"type": "TopicReference",
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}
}
}
},
{
"type": "FunctionDeclaration",
"start":7,"end":22,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}},
"id": {
"type": "Identifier",
"start":16,"end":17,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"f"},
"name": "f"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":20,"end":22,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}},
"body": [],
"directives": []
}
}
],
"directives": []
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a %
function f() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"type": "File",
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}},
"program": {
"type": "Program",
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":15}},
"left": {
"type": "Identifier",
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"},
"name": "a"
},
"operator": "%",
"right": {
"type": "FunctionExpression",
"start":4,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":15}},
"id": {
"type": "Identifier",
"start":13,"end":14,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"f"},
"name": "f"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":17,"end":19,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}},
"body": [],
"directives": []
}
}
}
}
],
"directives": []
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5 % /3/g;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"type": "File",
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
"program": {
"type": "Program",
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
"left": {
"type": "NumericLiteral",
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}},
"extra": {
"rawValue": 5,
"raw": "5"
},
"value": 5
},
"operator": "%",
"right": {
"type": "RegExpLiteral",
"start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}},
"extra": {
"raw": "/3/g"
},
"pattern": "3",
"flags": "g"
}
}
}
],
"directives": []
}
}

0 comments on commit 5d24958

Please sign in to comment.