Add escaped newlines
This commit is contained in:
parent
5a9bfe1571
commit
d68e65d8f9
|
@ -10,3 +10,33 @@ Comments
|
|||
(program
|
||||
(comment)
|
||||
(comment))
|
||||
|
||||
===============================
|
||||
Escaped newlines
|
||||
===============================
|
||||
|
||||
abc \
|
||||
d \
|
||||
e
|
||||
|
||||
f=g \
|
||||
h=i \
|
||||
j \
|
||||
--k
|
||||
|
||||
---
|
||||
|
||||
(program
|
||||
(command (simple_command
|
||||
(command_name)
|
||||
(argument)
|
||||
(argument)))
|
||||
(command (simple_command
|
||||
(environment_variable_assignment
|
||||
(variable_name)
|
||||
(argument))
|
||||
(environment_variable_assignment
|
||||
(variable_name)
|
||||
(argument))
|
||||
(command_name)
|
||||
(argument))))
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = grammar({
|
|||
|
||||
extras: $ => [
|
||||
$.comment,
|
||||
/\s/
|
||||
token(choice(/\s/, '\\\n')),
|
||||
],
|
||||
|
||||
rules: {
|
||||
|
@ -116,9 +116,9 @@ module.exports = grammar({
|
|||
|
||||
file_descriptor: $ => token(prec(1, /\d+/)),
|
||||
|
||||
leading_word: $ => /[^\s#=|;:{}]+/,
|
||||
leading_word: $ => /[^\\\s#=|;:{}]+/,
|
||||
|
||||
word: $ => /[^# \s$<>{}&]+/,
|
||||
word: $ => /[^#\\\s$<>{}&]+/,
|
||||
|
||||
control_operator: $ => choice(
|
||||
'\n',
|
||||
|
|
|
@ -435,11 +435,11 @@
|
|||
},
|
||||
"leading_word": {
|
||||
"type": "PATTERN",
|
||||
"value": "[^\\s#=|;:{}]+"
|
||||
"value": "[^\\\\\\s#=|;:{}]+"
|
||||
},
|
||||
"word": {
|
||||
"type": "PATTERN",
|
||||
"value": "[^# \\s$<>{}&]+"
|
||||
"value": "[^#\\\\\\s$<>{}&]+"
|
||||
},
|
||||
"control_operator": {
|
||||
"type": "CHOICE",
|
||||
|
@ -465,8 +465,20 @@
|
|||
"name": "comment"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s"
|
||||
"type": "TOKEN",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "\\\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"conflicts": [],
|
||||
|
|
2934
src/parser.c
2934
src/parser.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue