=== modified file 'bin/aat.awk' --- bin/aat.awk 2013-10-30 21:03:06 +0000 +++ bin/aat.awk 2013-10-29 09:19:34 +0000 @@ -52,16 +52,15 @@ } # Assign a variable with query expression - # else if(name == "let"){ - # if (!match(args, / *= */)) { - # print "ERROR: invalid let statement: " args >"/dev/stderr" - # exit 1 - # } - # tok_type=T_AWK - # token("V[\"" substr(args, 1, RSTART-1) "\"] = " \ - # substr(args, RSTART+RLENGTH)) "\n" - # # aat_process(substr(args, RSTART+RLENGTH)) "\n") - # } + else if(name == "let"){ + if (!match(args, / *= */)) { + print "ERROR: invalid let statement: " args >"/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"){ === modified file 'bin/aat_macros.sed' --- bin/aat_macros.sed 2013-10-30 21:03:06 +0000 +++ bin/aat_macros.sed 2013-10-09 16:48:47 +0000 @@ -13,4 +13,4 @@ s/^[[:space:]]*@elif[[:space:]]\+\(.\+\)$/} else if(get("\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/ +s/^[[:space:]]*@let[[:space:]]\+\([a-zA-Z_][a-zA-Z0-9_]*\)[[:space:]]*=[[:space:]]*\(.*\)$/V["\1"] = \2\n/ === modified file 'bin/query.awk' --- bin/query.awk 2013-10-30 21:03:06 +0000 +++ bin/query.awk 2013-10-29 09:19:34 +0000 @@ -13,28 +13,22 @@ # called for expanding {< >} # global variable expand_remaining used as input function expand_query( expanded) { - if(DEBUG) printf "E: →%s←\n", expand_remaining >"/dev/stderr" expanded = "" while(match(expand_remaining, "['<>]")) { - if(RSTART > 1) { + if(RSTART > 1) expanded = expanded "\"" substr(expand_remaining, 1, RSTART-1) "\"" - if(DEBUG) printf "e: →%s←\n", expanded >"/dev/stderr" - } char = substr(expand_remaining, RSTART, 1) expand_remaining = substr(expand_remaining, RSTART+1) if(char == ">") return "get("expanded")" else if(char == "<") { expanded = expanded expand_query() - if(DEBUG) printf "e: →%s←\n", expanded >"/dev/stderr" } else if(char == "'") { if(match(expand_remaining, "'")) { - expanded = expanded "(" substr(expand_remaining, 1, RSTART-1) ")" - if(DEBUG) printf "e: →%s←\n", expanded >"/dev/stderr" + expanded = expanded substr(expand_remaining, 1, RSTART-1) expand_remaining = substr(expand_remaining, RSTART+1) } else { - expanded = expanded "(" expand_remaining ")" - if(DEBUG) printf "e: →%s←\n", expanded >"/dev/stderr" + expanded = expand_remaining expand_remaining = "" } } else { @@ -43,8 +37,7 @@ } } if(expand_remaining) { - expanded = expanded "\"" expand_remaining "\"" - if(DEBUG) printf "e: →%s←\n", expanded >"/dev/stderr" + expanded = "\"" expand_remaining "\"" expand_remaining = "" } return "get("expanded")" === modified file 'data.awk' --- data.awk 2013-10-30 21:03:06 +0000 +++ data.awk 2013-09-28 19:59:05 +0000 @@ -77,7 +77,7 @@ loop_stack["depth"]-- } -function _get(varname, i, n, names, values, loopvar, looprow, prefix) { +function get(varname, i, n, names, values, loopvar, looprow, prefix) { for(i=loop_stack["depth"]; i>0; i--) { prefix = loop_stack[i, "pre"] if(prefix) @@ -115,14 +115,6 @@ return V[varname] } -function get(varname, result) { - result = _get(varname) - if(DEBUG) { - print "get →" varname "← ⇒ →"result"←" >"/dev/stderr" - } - return result -} - function or_(a, b) { return a ? a : b }