Allow backslashes between tokens

Fixes #14
This commit is contained in:
Max Brunsfeld 2018-08-06 11:13:42 -07:00
parent 0e172361a8
commit da2ba9cfdf
5 changed files with 74886 additions and 61694 deletions

View File

@ -40,3 +40,13 @@ f=g \
(word)) (word))
(command_name (word)) (command_name (word))
(word))) (word)))
=============================
Escaped whitespace
============================
echo 1 \ 2 \ 3
---
(program (command (command_name (word)) (word) (word) (word)))

View File

@ -41,7 +41,7 @@ module.exports = grammar({
extras: $ => [ extras: $ => [
$.comment, $.comment,
token(choice(/\s/, '\\\n')), /\\?\s/,
], ],
word: $ => $.word, word: $ => $.word,

View File

@ -19,7 +19,6 @@ examples/bash-it/completion/available/packer.completion.bash
examples/bash-it/completion/available/vault.completion.bash examples/bash-it/completion/available/vault.completion.bash
examples/bash-it/completion/available/docker.completion.bash examples/bash-it/completion/available/docker.completion.bash
examples/bash-it/completion/available/tmux.completion.bash examples/bash-it/completion/available/tmux.completion.bash
examples/bash-it/completion/available/virsh.completion.bash
examples/bash-it/completion/available/apm.completion.bash examples/bash-it/completion/available/apm.completion.bash
examples/bash-it/completion/available/git_flow.completion.bash examples/bash-it/completion/available/git_flow.completion.bash
examples/bash-it/lib/preexec.bash examples/bash-it/lib/preexec.bash
@ -38,4 +37,3 @@ examples/bash-it/themes/nwinkler_random_colors/nwinkler_random_colors.theme.bash
examples/bash-it/themes/mbriggs/mbriggs.theme.bash examples/bash-it/themes/mbriggs/mbriggs.theme.bash
examples/bash-it/themes/kitsune/kitsune.theme.bash examples/bash-it/themes/kitsune/kitsune.theme.bash
examples/bash-it/themes/doubletime/doubletime.theme.bash examples/bash-it/themes/doubletime/doubletime.theme.bash
examples/bash-it/themes/duru/duru.theme.bash

14
src/grammar.json vendored
View File

@ -2132,21 +2132,9 @@
"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": [],

136550
src/parser.c vendored

File diff suppressed because it is too large Load Diff