Skip to content

Commit

Permalink
Don't require statement terminator at EOF
Browse files Browse the repository at this point in the history
Fixes #15
  • Loading branch information
maxbrunsfeld committed Aug 6, 2018
1 parent da2ba9c commit 6ff7fe3
Show file tree
Hide file tree
Showing 5 changed files with 77,987 additions and 74,665 deletions.
9 changes: 9 additions & 0 deletions corpus/programs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = grammar({
word: $ => $.word,

rules: {
program: $ => repeat($._terminated_statement),
program: $ => optional($._statements),

_terminated_statement: $ => seq(
$._statement,
Expand Down
3 changes: 0 additions & 3 deletions script/known-failures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 changes: 10 additions & 5 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading

0 comments on commit 6ff7fe3

Please sign in to comment.