Skip to content

Commit

Permalink
Merge pull request #17 from Daksh-10/test
Browse files Browse the repository at this point in the history
Adding Grammer
  • Loading branch information
Peefy authored May 24, 2024
2 parents e96fdcf + aca71b4 commit ee8b294
Show file tree
Hide file tree
Showing 5 changed files with 14,205 additions and 14,077 deletions.
4 changes: 2 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ module.exports = grammar({
$._dedent,
),

dotted_name: $ => prec(1, sep1($.identifier, '.')),
dotted_name: $ => prec(1, sep1($.identifier, choice('?.','.',))),

// Patterns

Expand Down Expand Up @@ -553,7 +553,7 @@ module.exports = grammar({
assignment: $ => seq(
field('left', $.dotted_name),
choice(
seq('=', field('right', $.expression)),
seq('=', field('right', choice($.dotted_name,$.expression,))),
seq(':', field('type', $.type), '=', field('right', $.expression)),
),
),
Expand Down
26 changes: 22 additions & 4 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,17 @@
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "."
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "?."
},
{
"type": "STRING",
"value": "."
}
]
},
{
"type": "SYMBOL",
Expand Down Expand Up @@ -1877,8 +1886,17 @@
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL",
"name": "expression"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "dotted_name"
},
{
"type": "SYMBOL",
"name": "expression"
}
]
}
}
]
Expand Down
8 changes: 8 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@
"multiple": false,
"required": true,
"types": [
{
"type": "dotted_name",
"named": true
},
{
"type": "expression",
"named": true
Expand Down Expand Up @@ -2039,6 +2043,10 @@
"type": ">>=",
"named": false
},
{
"type": "?.",
"named": false
},
{
"type": "@",
"named": false
Expand Down
Loading

0 comments on commit ee8b294

Please sign in to comment.