=== modified file 'query.pl' --- query.pl 2015-08-19 20:11:44 +0000 +++ query.pl 2015-07-25 04:11:12 +0000 @@ -14,26 +14,13 @@ query_name_next(T). query_name_next([]) --> []. -query_default_text([H|T]) --> [H], {\+memberchk(H,`'<>`)}, query_default_text(T). -query_default_text([]) --> []. - query_content([name(Name)|T]) --> query_name(Name), query_content(T). query_content([query(Query)|T]) --> query_exp(Query), query_content(T). query_content([expr(Expr)|T]) --> `'`, query_awk(Expr), `'`, query_content(T). query_content([]) --> []. -%query_default([text(Text)|T]) --> query_default_text(Text), query_default(T). -query_default([expr(Expr)|T]) --> `'`, query_awk(Expr), `'`, query_default(T). -query_default([query(Query)|T]) --> query_exp(Query), query_default(T). -query_default([query(Query, Default)|T]) --> - query_exp(Query, Default), query_default(T). -query_default([]) --> []. - query_exp(Content) --> `<`, query_content(Content), `>`. -query_exp(Content, Default) --> - `<`, query_content(Content), `:`, query_default(Default), `>`. - awk_string(String) --> `"`, awk_string_content(String), `"`. awk_string_content([0'\\,H|T],R) --> @@ -74,9 +61,6 @@ awk_code(R,R,L,L) --> []. % awk_code(L) --> awk_code(L,[],delim,_). -query_awk([query(Query, Default)|T],delim) --> - query_exp(Query, Default), - query_awk(T, expr). query_awk([query(Query)|T],delim) --> query_exp(Query), query_awk(T, expr). @@ -91,28 +75,13 @@ awk_out([code(Code)|T]) --> Code, awk_out(T). awk_out([query(Query)|T]) --> `get(`, query_out(Query), `)`, awk_out(T). -awk_out([query(Query, Default)|T]) --> - `(find(`, query_out(Query), `)?found:`, default_out(Default), `)`, awk_out(T). awk_out([]) --> []. query_out([name(Name)|T]) --> `"`, Name, `"`, query_out(T). query_out([query(Query)|T]) --> `get(`, query_out(Query), `)`, query_out(T). -query_out([query(Query, Default)|T]) --> - `(find(`, query_out(Query), `)?found:`, default_out(Default), `)`, query_out(T). query_out([expr(Expr)|T]) --> `(`, awk_out(Expr), `)`, query_out(T). query_out([]) --> []. -default_out([]) --> `""`. -default_out([H|T]) --> default_out_aux([H|T]). -%default_out_aux([text(Text)|T]) --> Text, default_out_aux(T). -default_out_aux([query(Query)|T]) --> - `get(`, query_out(Query), `)`, default_out_aux(T). -default_out_aux([query(Query, Default)|T]) --> - `(find(`, query_out(Query), `)?found:`, default_out(Default), `)`, - default_out_aux(T). -default_out_aux([expr(Expr)|T]) --> `(`, awk_out(Expr), `)`, default_out_aux(T). -default_out_aux([]) --> []. - %%% main([InFile]) :- === modified file 'query_example.awk' --- query_example.awk 2015-08-19 20:11:44 +0000 +++ query_example.awk 2015-07-25 04:11:12 +0000 @@ -1,11 +1,4 @@ BEGIN { foo() x[>] = - y = "" - y = (y) () - y = (y) () - y = (y) (>) - y = (y) (>>) - y = (y) ( - ()'>>>) - y = (y) () - ()'>>>) }