From 0708bc9507fc1b4f1397938daaed2cc177d65aec Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 20 Feb 2016 11:18:54 -0500 Subject: Prepare for command substitution --- (limited to 'parsing/parse.sh') 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))' -- cgit v0.9.1