Treat # in color literals as a separate token

This commit is contained in:
Max Brunsfeld 2018-10-28 14:17:28 -07:00
parent 034eda815e
commit 90369e3d66
3 changed files with 5013 additions and 4533 deletions

View File

@ -249,7 +249,7 @@ module.exports = grammar({
$.call_expression
)),
color_value: $ => /#[0-9a-fA-F]{3,8}/,
color_value: $ => seq('#', token.immediate(/[0-9a-fA-F]{3,8}/)),
string_value: $ => token(choice(
seq("'", /([^'\n]|\\(.|\n))*/, "'"),

16
src/grammar.json vendored
View File

@ -1126,8 +1126,20 @@
}
},
"color_value": {
"type": "PATTERN",
"value": "#[0-9a-fA-F]{3,8}"
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "#"
},
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "PATTERN",
"value": "[0-9a-fA-F]{3,8}"
}
}
]
},
"string_value": {
"type": "TOKEN",

9528
src/parser.c vendored

File diff suppressed because it is too large Load Diff