diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-20 11:52:54 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-20 11:52:54 (EST) |
commit | e221064cecfad291e65609e7412f074a64a6f5e4 (patch) | |
tree | 3a5b59bb854ee5e5add7ebf7e6844118ebdd4840 /parsing/parse.sh | |
parent | 0708bc9507fc1b4f1397938daaed2cc177d65aec (diff) | |
download | eggshell-e221064cecfad291e65609e7412f074a64a6f5e4.zip eggshell-e221064cecfad291e65609e7412f074a64a6f5e4.tar.gz eggshell-e221064cecfad291e65609e7412f074a64a6f5e4.tar.bz2 |
Add code generation
Diffstat (limited to 'parsing/parse.sh')
-rw-r--r-- | parsing/parse.sh | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/parsing/parse.sh b/parsing/parse.sh index faf4637..a28aad2 100644 --- a/parsing/parse.sh +++ b/parsing/parse.sh @@ -1,7 +1,9 @@ -HT="$(printf '\t.')"; HT="${HT%.}" -LF="$(printf '\n.')"; LF="${LF%.}" -RS="$(printf '\036.')"; RS="${RS%.}" -US="$(printf '\037.')"; US="${US%.}" +STX="$(printf '\002.')"; STX="${STX%.}" +ETX="$(printf '\003.')"; ETX="${ETX%.}" + HT="$(printf '\t.')"; HT="${HT%.}" + LF="$(printf '\n.')"; LF="${LF%.}" + RS="$(printf '\036.')"; RS="${RS%.}" + US="$(printf '\037.')"; US="${US%.}" dbg() { @@ -46,6 +48,7 @@ ptrace_fail() . ./tokens.sh . ./lexer.sh +. ./codegen.sh complete_command() { @@ -626,6 +629,9 @@ try() ;; esac done + printf 'Generated code:\n' + IFS="${LF}" + printf '\t%s\n' $(codegen "${tokens}") unset IFS else printf 'FAIL\n' @@ -634,7 +640,7 @@ try() } #try '"foo bar" && $baz || qux' '${quux%uux quuux' -#try '"foo bar" && $baz || qux' '${quux%uux } quuux' +try '"foo bar" && $baz || qux' '${quux%uux } quuux' #try 'foo ${bar}' #try 'foo ${#bar}' #try 'foo ${bar#baz}' @@ -653,5 +659,5 @@ try() #try 'foo(){ bar; }' #try 'case foo in bar) baz;; (qux) quux;; quux);; esac' #try 'foo bar ( baz )' -try 'foo $(bar)' +#try 'foo $(bar)' #try 'foo $((1 + 1))' |