Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
4 changes: 2 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1460,8 +1460,8 @@ module.exports = grammar({
seq(
"'",
choice(
token.immediate(prec(2, /[^\\\n\r']/)),
alias($._char_escape_sequence, $.escape_sequence)
alias($._char_escape_sequence, $.escape_sequence),
alias(token.immediate(prec(2, /[^\\\n\r']/)), $.char_content)
),
token.immediate("'")
),
Expand Down
27 changes: 16 additions & 11 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -13563,17 +13563,6 @@
{
"type": "CHOICE",
"members": [
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "PREC",
"value": 2,
"content": {
"type": "PATTERN",
"value": "[^\\\\\\n\\r']"
}
}
},
{
"type": "ALIAS",
"content": {
Expand All @@ -13582,6 +13571,22 @@
},
"named": true,
"value": "escape_sequence"
},
{
"type": "ALIAS",
"content": {
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "PREC",
"value": 2,
"content": {
"type": "PATTERN",
"value": "[^\\\\\\n\\r']"
}
}
},
"named": true,
"value": "char_content"
}
]
},
Expand Down
14 changes: 13 additions & 1 deletion src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@
{
"type": "block_comment",
"named": true,
"extra": true,
"fields": {},
"children": {
"multiple": false,
Expand All @@ -867,6 +868,7 @@
{
"type": "block_documentation_comment",
"named": true,
"extra": true,
"fields": {},
"children": {
"multiple": false,
Expand Down Expand Up @@ -1948,8 +1950,12 @@
"fields": {},
"children": {
"multiple": false,
"required": false,
"required": true,
"types": [
{
"type": "char_content",
"named": true
},
{
"type": "escape_sequence",
"named": true
Expand Down Expand Up @@ -2294,6 +2300,7 @@
{
"type": "comment",
"named": true,
"extra": true,
"fields": {},
"children": {
"multiple": false,
Expand Down Expand Up @@ -3496,6 +3503,7 @@
{
"type": "documentation_comment",
"named": true,
"extra": true,
"fields": {},
"children": {
"multiple": false,
Expand Down Expand Up @@ -12111,6 +12119,10 @@
"type": "cast",
"named": false
},
{
"type": "char_content",
"named": true
},
{
"type": "comment_content",
"named": true
Expand Down
20 changes: 14 additions & 6 deletions src/parser.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions test/corpus/deviations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ r"string
(string_content)
(block_comment
(comment_content)))
(char_literal
(block_comment
(comment_content)))
(char_literal
(char_content)
(block_comment
(comment_content)))
(raw_string_literal
(string_content)
(block_comment
Expand Down
12 changes: 8 additions & 4 deletions test/corpus/literals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,14 @@ Character literals
--------------------------------------------------------------------------------

(source_file
(char_literal)
(char_literal)
(char_literal)
(char_literal)
(char_literal
(char_content))
(char_literal
(char_content))
(char_literal
(char_content))
(char_literal
(char_content))
(char_literal
(escape_sequence))
(char_literal
Expand Down
Loading