=== modified file 'bin/query.awk' --- bin/query.awk 2013-10-29 08:11:15 +0000 +++ bin/query.awk 2013-10-13 15:13:47 +0000 @@ -4,10 +4,8 @@ } function out(str) { - if(length(str)) { - printf "%s", str - last_out = str - } + printf "%s", str + last_out = str } # called for expanding {< >} @@ -45,9 +43,9 @@ function parse_line(line) { while(length(line)) { - if(DEBUG) printf "%d: →%s←\n", in_string, line >"/dev/stderr" + if(DEBUG) printf "%d: \"%s\"\n", in_string, line >"/dev/stderr" if(in_string) { - if(match(line, /^(\\[^"]|[^"\\])+/)) { + if(match(line, /^\(\\[^"]\|[^"\\]\)/)) { out(substr(line, 1, RLENGTH)) line = substr(line, RLENGTH+1) } @@ -62,7 +60,6 @@ # is this valid? } else { print "string parsing error" >"/dev/stderr" - if(DEBUG) printf "%d: →%s←\n", in_string, line >"/dev/stderr" exit 1 } } else if(match(line, /[<"]/)) { @@ -72,8 +69,7 @@ line = substr(line, 2) in_string = 1 } else { - if(DEBUG) printf "q: →%s← →%s←\n", last_out, line >"/dev/stderr" - if(match(last_out, /[\n\t([ ]$/) && match(line, /^<([a-zA-Z0-9._]|'[^']*')*>/)) { + if(match(last_out, /[\n\t([ ]$/) && match(line, /^<\([a-zA-Z0-9._]\|'[^']*'\)*>/)) { expand_remaining = substr(line, 2, RLENGTH-2) line = substr(line, RLENGTH+1) out(expand_query())