Don't require statement terminator at EOF

Fixes #15
This commit is contained in:
Max Brunsfeld 2018-08-06 11:18:33 -07:00
parent da2ba9cfdf
commit 6ff7fe3c7e
5 changed files with 81572 additions and 78250 deletions

View File

@ -50,3 +50,12 @@ echo 1 \ 2 \ 3
---
(program (command (command_name (word)) (word) (word) (word)))
====================================
Files without trailing terminators
====================================
echo hi
---
(program (command (command_name (word)) (word)))

View File

@ -47,7 +47,7 @@ module.exports = grammar({
word: $ => $.word,
rules: {
program: $ => repeat($._terminated_statement),
program: $ => optional($._statements),
_terminated_statement: $ => seq(
$._statement,

View File

@ -3,7 +3,6 @@ examples/bash-it/plugins/available/extract.plugin.bash
examples/bash-it/plugins/available/go.plugin.bash
examples/bash-it/install.sh
examples/bash-it/completion/available/go.completion.bash
examples/bash-it/completion/available/maven.completion.bash
examples/bash-it/completion/available/svn.completion.bash
examples/bash-it/completion/available/docker-compose.completion.bash
examples/bash-it/completion/available/jboss7.completion.bash
@ -20,7 +19,6 @@ examples/bash-it/completion/available/vault.completion.bash
examples/bash-it/completion/available/docker.completion.bash
examples/bash-it/completion/available/tmux.completion.bash
examples/bash-it/completion/available/apm.completion.bash
examples/bash-it/completion/available/git_flow.completion.bash
examples/bash-it/lib/preexec.bash
examples/bash-it/lib/composure.bash
examples/bash-it/test_lib/bats-support/src/lang.bash
@ -34,6 +32,5 @@ examples/bash-it/themes/powerline/powerline.base.bash
examples/bash-it/themes/base.theme.bash
examples/bash-it/themes/brainy/brainy.theme.bash
examples/bash-it/themes/nwinkler_random_colors/nwinkler_random_colors.theme.bash
examples/bash-it/themes/mbriggs/mbriggs.theme.bash
examples/bash-it/themes/kitsune/kitsune.theme.bash
examples/bash-it/themes/doubletime/doubletime.theme.bash

15
src/grammar.json vendored
View File

@ -3,11 +3,16 @@
"word": "word",
"rules": {
"program": {
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_terminated_statement"
}
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
"_terminated_statement": {
"type": "SEQ",

159793
src/parser.c vendored

File diff suppressed because it is too large Load Diff