Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 73 additions & 70 deletions grammars/rescript.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,84 +119,87 @@
}
]
},
"expression": {
"patterns": [
{ "include": "#constant" },
{ "include": "#bracketAccess" },
{ "include": "#string" },
{ "include": "#number" },
{ "include": "#character" }
Comment on lines +124 to +128
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be much more than these 5.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And bracketAccess should be replaced with an array constructor.

]
},
"string-character-escape": {
"name": "constant.character.escape",
"match": "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u{[0-9A-Fa-f]+}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)"
},
"string": {
"string-double-quoted": {
"name": "string.quoted.double",
"begin": "\"",
"end": "\"",
"beginCaptures": {
"1": {
"name": "punctuation.definition.string.begin"
}
},
"endCaptures": {
"1": {
"name": "punctuation.definition.string.end"
}
},
"patterns": [
{
"name": "string.quoted.double",
"begin": "\"",
"end": "\"",
"beginCaptures": {
"1": {
"name": "punctuation.definition.string.begin"
}
},
"endCaptures": {
"1": {
"name": "punctuation.definition.string.end"
}
},
"patterns": [
{
"include": "#string-character-escape"
}
]
"include": "#string-character-escape"
}
]
},
"template": {
"name": "string.template",
"begin": "([a-z_][0-9a-zA-Z_]*)?(`)",
"end": "(?<!\\\\)`",
"beginCaptures": {
"1": {
"name": "entity.name.function"
},
{
"name": "string.template",
"begin": "([a-z_][0-9a-zA-Z_]*)?(`)",
"end": "(?<!\\\\)`",
"beginCaptures": {
"1": {
"name": "entity.name.function"
},
"2": {
"name": "punctuation.definition.string.template.begin"
}
},
"endCaptures": {
"1": {
"name": "punctuation.definition.string.template.end"
}
},
"patterns": [
{
"include": "#string-character-escape"
},
{
"name": "meta.template.expression",
"begin": "\\$\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.template-expression.begin"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.template-expression.end"
}
},
"patterns": [
{
"match": "[a-z_][0-9a-zA-Z_]*"
},
{
"include": "#operator"
},
{
"include": "#punctuations"
},
{
"include": "#string"
}
]
}
]
"2": {
"name": "punctuation.definition.string.template.begin"
}
},
"endCaptures": {
"1": {
"name": "punctuation.definition.string.template.end"
}
},
"patterns": [
{ "include": "#string-character-escape" },
{ "include": "#template-substitution-element" }
]
},
"template-substitution-element": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Structured it more similar to ts grammar

"name": "meta.template.expression",
"begin": "\\$\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.template-expression.begin"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.template-expression.end"
}
},
"patterns": [
{ "include": "#commentLine" },
{ "include": "#commentBlock" },
{ "include": "#operator" },
{ "include": "#punctuations" },
Comment on lines +194 to +195
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of highlighting operators and punctuations separately, they should be part of expression

{ "include": "#expression" }
]
},
"string": {
"patterns": [
{ "include": "#string-double-quoted" },
{ "include": "#template" }
]
},
"function": {
Expand Down