Add escaped newlines
This commit is contained in:
parent
5a9bfe1571
commit
d68e65d8f9
|
@ -10,3 +10,33 @@ Comments
|
||||||
(program
|
(program
|
||||||
(comment)
|
(comment)
|
||||||
(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: $ => [
|
extras: $ => [
|
||||||
$.comment,
|
$.comment,
|
||||||
/\s/
|
token(choice(/\s/, '\\\n')),
|
||||||
],
|
],
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
|
@ -116,9 +116,9 @@ module.exports = grammar({
|
||||||
|
|
||||||
file_descriptor: $ => token(prec(1, /\d+/)),
|
file_descriptor: $ => token(prec(1, /\d+/)),
|
||||||
|
|
||||||
leading_word: $ => /[^\s#=|;:{}]+/,
|
leading_word: $ => /[^\\\s#=|;:{}]+/,
|
||||||
|
|
||||||
word: $ => /[^# \s$<>{}&]+/,
|
word: $ => /[^#\\\s$<>{}&]+/,
|
||||||
|
|
||||||
control_operator: $ => choice(
|
control_operator: $ => choice(
|
||||||
'\n',
|
'\n',
|
||||||
|
|
|
@ -435,11 +435,11 @@
|
||||||
},
|
},
|
||||||
"leading_word": {
|
"leading_word": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "[^\\s#=|;:{}]+"
|
"value": "[^\\\\\\s#=|;:{}]+"
|
||||||
},
|
},
|
||||||
"word": {
|
"word": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "[^# \\s$<>{}&]+"
|
"value": "[^#\\\\\\s$<>{}&]+"
|
||||||
},
|
},
|
||||||
"control_operator": {
|
"control_operator": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
|
@ -464,9 +464,21 @@
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "comment"
|
"name": "comment"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "TOKEN",
|
||||||
|
"content": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "\\s"
|
"value": "\\s"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "\\\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"conflicts": [],
|
"conflicts": [],
|
||||||
|
|
2934
src/parser.c
2934
src/parser.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue