Skip to content

Commit

Permalink
perf: improve gen time + parse state
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Jul 8, 2024
1 parent 9f804be commit 88e38e0
Show file tree
Hide file tree
Showing 5 changed files with 315,566 additions and 367,010 deletions.
13 changes: 7 additions & 6 deletions common/define-grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ module.exports = function defineGrammar(dialect) {
seq('declare', optional($.accessibility_modifier)),
seq($.accessibility_modifier, optional('declare')),
)),
choice(
seq(optional('static'), optional($.override_modifier), optional('readonly')),
seq(optional('abstract'), optional('readonly')),
seq(optional('readonly'), optional('abstract')),
),
optional('accessor'),
repeat(prec.right(choice(
'readonly',
'abstract',
'accessor',
'static',
$.override_modifier,
))),
field('name', $._property_name),
optional(choice('?', '!')),
field('type', optional($.type_annotation)),
Expand Down
118 changes: 17 additions & 101 deletions tsx/src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -7279,120 +7279,36 @@
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"type": "REPEAT",
"content": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "static"
},
{
"type": "BLANK"
}
]
"type": "STRING",
"value": "readonly"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "override_modifier"
},
{
"type": "BLANK"
}
]
"type": "STRING",
"value": "abstract"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "readonly"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "abstract"
},
{
"type": "BLANK"
}
]
"type": "STRING",
"value": "accessor"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "readonly"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "readonly"
},
{
"type": "BLANK"
}
]
"type": "STRING",
"value": "static"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "abstract"
},
{
"type": "BLANK"
}
]
"type": "SYMBOL",
"name": "override_modifier"
}
]
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "accessor"
},
{
"type": "BLANK"
}
]
}
},
{
"type": "FIELD",
Expand Down
Loading

0 comments on commit 88e38e0

Please sign in to comment.