Skip to content

Commit

Permalink
Merge pull request #84 from jmbockhorst/cons-pattern
Browse files Browse the repository at this point in the history
Parse multiple cons_pattern better
  • Loading branch information
razzeee authored Feb 23, 2021
2 parents dafaa5b + 5dd6eca commit 413fc74
Show file tree
Hide file tree
Showing 5 changed files with 13,887 additions and 13,863 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ module.exports = grammar({
cons_pattern: ($) =>
seq(
field("part", $._single_pattern_cons),
repeat1(seq("::", field("part", $._single_pattern_cons)))
seq("::", field("part", choice($.cons_pattern, $._single_pattern_cons)))
),

_single_pattern_cons: ($) =>
Expand Down
40 changes: 23 additions & 17 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2357,24 +2357,30 @@
}
},
{
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "::"
},
{
"type": "FIELD",
"name": "part",
"content": {
"type": "SYMBOL",
"name": "_single_pattern_cons"
}
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "::"
},
{
"type": "FIELD",
"name": "part",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "cons_pattern"
},
{
"type": "SYMBOL",
"name": "_single_pattern_cons"
}
]
}
]
}
}
]
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@
"type": "char_constant_expr",
"named": true
},
{
"type": "cons_pattern",
"named": true
},
{
"type": "list_pattern",
"named": true
Expand Down
Loading

0 comments on commit 413fc74

Please sign in to comment.