aat

git mirror of https://ccx.te2000.cz/bzr/aat
git clone https://ccx.te2000.cz/git/aat
Log | Files | Refs | README

commit 6b76361494e12db6109399b975348942e9b367bb
parent b10a8a19de76737e120531bc71f0faaec6b1e75a
Author: Jan Pobrislo <ccx@wpr.cz>
Date:   Thu, 10 Sep 2015 09:58:55 +0200

fix regex parsing
Diffstat:
Mquery.pl | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/query.pl b/query.pl @@ -61,9 +61,11 @@ awk_string_content(R,R) --> []. awk_string_content(L) --> awk_string_content(L,[]). awk_regex_content([0'\\,H|T],R) --> - [0'\\,H], !, awk_regex_content(T,R). + [0'\\,H], + !, + awk_regex_content(T,R). awk_regex_content([H|T],R) --> - [H], { H \= 0'" }, + [H], { H\=0'\\, H\=0'/ }, !, awk_regex_content(T,R). awk_regex_content(R,R) --> []. @@ -81,8 +83,8 @@ awk_code([0'"|T0],R,_,F) --> awk_code([0'/|T0],R,Prev,F) --> { memberchk(Prev, [delim, op]) }, `/`, !, awk_regex_content(T0,T1), `/`, { T1=[0'/|T2] }, awk_code(T2,R,expr,F). -awk_code([0'#|T],R,Prev,F) --> - `#`, !, awk_comment(T,T1), awk_code(T1,R,Prev,F). +awk_code([0'#|T],R,_,F) --> + `#`, !, awk_comment(T,T1), awk_code(T1,R,op,F). awk_code([H|T],R,Prev,F) --> [H], { code_type(H, white) }, !, awk_code(T,R,Prev,F). awk_code([H|T],R,_,F) --> @@ -149,7 +151,7 @@ out_default_aux([]) --> []. %%% -main([InFile]) :- +main([InFile]) :- !, (phrase_from_file(query_awk(Awk), InFile) -> true ; throw(parsing_failed)), (phrase(out_awk(Awk), Out) -> true ; throw(formatting_failed(Awk))), format('~s', [Out]).