=== modified file 'bin/aat.awk' --- bin/aat.awk 2013-10-09 16:48:47 +0000 +++ bin/aat.awk 2013-10-09 15:08:56 +0000 @@ -45,35 +45,11 @@ # Macro to insert another file as text else if(name == "text"){ - tok_type=T_TEXT while(getline "/dev/stderr" - exit 1 - } - tok_type=T_AWK - token("V[\"" substr(args, 1, RSTART-1) "\"] = " \ - aat_process(substr(args, RSTART+RLENGTH)) "\n") - } - - # if with a query expression - else if(name == "if"){ - tok_type=T_AWK - token("if(" aat_process(substr(args, RSTART+RLENGTH)) ") {\n") - } - - # else if with a query expression - else if(name == "elif"){ - tok_type=T_AWK - token("} else if(" aat_process(substr(args, RSTART+RLENGTH)) ") {\n") - } - # Leave the @ there for postprocessing with sed else { tok_type=T_AWK @@ -275,6 +251,7 @@ } } } + # TODO filters while(str) { if(!match(str, /^\|[a-zA-Z_][a-zA-Z0-9_.]*/)) { print "ERROR: invalid filter: " str >"/dev/stderr" @@ -297,14 +274,7 @@ args = args substr(str, 1, RLENGTH) str = substr(str, RLENGTH+1) } - } else if(match(str, /^ /)) { - if(match(str, /\|[a-zA-Z_]/)) { - args = ", " substr(str, 1, RLENGTH-1) - str = substr(str, RSTART) - } else { - args = ", " str - str = "" - } + # TODO } processed = filter_name "(" processed args ")" } === modified file 'bin/aat_macros.sed' --- bin/aat_macros.sed 2013-10-09 16:48:47 +0000 +++ bin/aat_macros.sed 2013-09-28 19:59:05 +0000 @@ -9,8 +9,7 @@ s/^[[:space:]]*@for[[:space:]]\+\([[:alnum:]]\+\)[[:space:]]\+in[[:space:]]\+\(.\+\)$/for(_loop_\1=loop_start("\2", "\1."); loop_iter(_loop_\1);) {/ s/^[[:space:]]*@for[[:space:]]\+\([[:alnum:]]\+\)[[:space:]]\+var[[:space:]]\+\(.\+\)$/for(_loop_\1=loop_start(\2, "\1."); loop_iter(_loop_\1);) {/ s/^[[:space:]]*@endfor[[:space:]]*$/} loop_end()/ -s/^[[:space:]]*@if[[:space:]]\+\(.\+\)$/if(get("\1")) {\n/ -s/^[[:space:]]*@elif[[:space:]]\+\(.\+\)$/} else if(get("\1")) {\n/ +s/^[[:space:]]*@if[[:space:]]\+\(.\+\)$/if(\1) {\n/ +s/^[[:space:]]*@elif[[:space:]]\+\(.\+\)$/} else if(\1) {\n/ s/^[[:space:]]*@else[[:space:]]*$/} else {/ s/^[[:space:]]*@endif[[:space:]]*$/}/ -s/^[[:space:]]*@let[[:space:]]\+\([a-zA-Z_][a-zA-Z0-9_]*\)[[:space:]]*=[[:space:]]*\(.*\)$/V["\1"] = \2\n/ === removed file 'hello4.aat' --- hello4.aat 2013-10-09 16:48:47 +0000 +++ hello4.aat 1970-01-01 00:00:00 +0000 @@ -1,15 +0,0 @@ -@awk data.awk -|END { -@for x in spam -{} - {} -@ for y in spam -{{ get("x.eggs") + get("y.eggs") }} -@ endfor -@endfor --------------------- -@for n in names -Hello {}{{get("n._last") ? "!" : ","}} -@endfor - -Welcome to the world of {{toupper("awk")}} templating! -|} === removed file 'hello5.aat' --- hello5.aat 2013-10-09 16:48:47 +0000 +++ hello5.aat 1970-01-01 00:00:00 +0000 @@ -1,16 +0,0 @@ -@awk data.awk -|END { -@for x in spam -{} - {} -@ for y in spam -{< x.eggs + y.eggs >} -@ endfor -@endfor --------------------- -@for n in names -Hello {}{} -@endfor - -@let language = "awk" -Welcome to the world of {} templating! -|}