=== modified file 'bin/aat.awk' --- bin/aat.awk 2013-09-16 21:20:41 +0000 +++ bin/aat.awk 2013-08-14 21:17:17 +0000 @@ -9,9 +9,6 @@ tok_type = T_TEXT } -# Append 'content' to array of tokens. Token type is taken from current value -# of tok_type. It concatenates sequence of tokens of same type, unless -# tok_finished is set. function token(content) { if(!content) return # concatenate tokens of same type if the previous one doesn't end in newline @@ -26,67 +23,8 @@ tok_n, type_names[tok_type], tok_contents[tok_n] >"/dev/stderr" } -function call_macro(name, args) { - # Macro to recursively parse another template - if(name == "include"){ - while(getline "/dev/stderr" eat_nl = 0 @@ -156,8 +94,6 @@ } } -{ parse_line($0) } - END { nl = 1 # are we on new line? for(tok_n=1; tok_types[tok_n]; tok_n++) { === modified file 'bin/aat_macros.sed' --- bin/aat_macros.sed 2013-09-16 21:20:41 +0000 +++ bin/aat_macros.sed 2013-08-14 20:02:38 +0000 @@ -5,10 +5,3 @@ s/^[[:space:]]*ELIF[[:space:]]\+\(.\+\)$/} else if(\1) {\n/ s/^[[:space:]]*ELSE[[:space:]]*$/} else {/ s/^[[:space:]]*ENDIF[[:space:]]*$/}/ - -s/^[[:space:]]*@for[[:space:]]\+\([[:alnum:]]\+\)[[:space:]]\+in[[:space:]]\+\(.\+\)$/for(_loop_\1=loop_start("\2", "\1_"); loop_iter(_loop_\1);) {/ -s/^[[:space:]]*@endfor[[:space:]]*$/} loop_end()/ -s/^[[:space:]]*@if[[:space:]]\+\(.\+\)$/if(\1) {\n/ -s/^[[:space:]]*@elif[[:space:]]\+\(.\+\)$/} else if(\1) {\n/ -s/^[[:space:]]*@else[[:space:]]*$/} else {/ -s/^[[:space:]]*@endif[[:space:]]*$/}/ === modified file 'data.awk' --- data.awk 2013-09-16 21:20:41 +0000 +++ data.awk 2013-09-16 16:59:30 +0000 @@ -40,7 +40,7 @@ m = match($0, ident_re) varname = substr($0, m, RLENGTH) V[varname] = substr($0, m+1+RLENGTH) - if(DEBUG) printf "got scalar: %s ⇒ %s (%d)\n", varname, V[varname], m + printf "got scalar: %s ⇒ %s (%d)\n", varname, V[varname], m next } @@ -88,19 +88,17 @@ return V[varname] } -# for testing it out, set TEST=1 on commandline +# just testing it out END { - if(TEST) { - for(key in V) { - printf("%s⇒\t→%s←\n", key, V[key]) - } - print "--------------------" - print get("foo") - for(d1=loop_start("spam"); loop_iter(d1);) { - print get("name") "-" get("value") - for(d2=loop_start("spam", "i_"); loop_iter(d2);) { - print get("eggs") + get("i_eggs") - } loop_end() + for(key in V) { + printf("%s⇒\t→%s←\n", key, V[key]) + } + print "--------------------" + print get("foo") + for(d1=loop_start("spam"); loop_iter(d1);) { + print get("name") "-" get("value") + for(d2=loop_start("spam", "i_"); loop_iter(d2);) { + print get("eggs") + get("i_eggs") } loop_end() - } + } loop_end() } === removed file 'hello3.aat' --- hello3.aat 2013-09-16 21:20:41 +0000 +++ hello3.aat 1970-01-01 00:00:00 +0000 @@ -1,9 +0,0 @@ -|!/bin/awk -f -@awk data.awk -|END { -@ for name in names -Hello {{get("name_v")}}{{get("name__last") ? "!" : ","}} -@ endfor - -Welcome to the world of {{toupper("awk")}} templating! -|}