diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-20 11:18:54 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-20 11:18:54 (EST) |
commit | 0708bc9507fc1b4f1397938daaed2cc177d65aec (patch) | |
tree | 29cc9f6fdf94e099ff4194853bf5a8a50fa42401 /parsing/parse.sh | |
parent | 055f3e9b50882e4dba51d7dbcdcc80c1aede4d83 (diff) | |
download | eggshell-0708bc9507fc1b4f1397938daaed2cc177d65aec.zip eggshell-0708bc9507fc1b4f1397938daaed2cc177d65aec.tar.gz eggshell-0708bc9507fc1b4f1397938daaed2cc177d65aec.tar.bz2 |
Prepare for command substitution
Diffstat (limited to 'parsing/parse.sh')
-rw-r--r-- | parsing/parse.sh | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/parsing/parse.sh b/parsing/parse.sh index 8168c48..faf4637 100644 --- a/parsing/parse.sh +++ b/parsing/parse.sh @@ -580,12 +580,13 @@ sequential_sep() return 1 } -parse() +parse_sub() { local fn="${1}" - shift 1 + local ln="${2}" + shift 2 - init_lexer "${fn}" + init_lexer "${fn}" ${ln} # If this returns (does not exit), there are no errors. complete_command @@ -598,6 +599,17 @@ parse() return 0 } +parse() +{ + local fn="${1}" + shift 1 + + if parse_sub "${fn}" 1; then + return 0 + fi + return 1 +} + try() { local tokens= @@ -638,6 +650,8 @@ try() #try 'if ; then ; fi' #try 'while foo; do bar; done' #try 'while ; do ; done' -try 'foo(){ bar; }' +#try 'foo(){ bar; }' #try 'case foo in bar) baz;; (qux) quux;; quux);; esac' #try 'foo bar ( baz )' +try 'foo $(bar)' +#try 'foo $((1 + 1))' |