The goal of my application is to validate an sql code and generate,in the mean time, from that code a formatted one with some modification.
For example this where clause :
where
e.student_name= c.contact_name and ( c.address = " nefta" or c.address=" tozeur ") and
e.age <18
我们本会把产出形式化,如:
。
where e.student_name= c.contact_name
and (c.address=trim("nefta")
or c.address=trim("tozeur") )
and e.age <18
我希望我能很好地解释我的目标。
The problem is grammars may contain recursive rules which make the rewrite task unreliable ; for instance in my sql grammar i have this :
search_condition : search_condition OR search_condition{clbck_or} | search_condition AND search_condition{clbck_and} | NOT search_condition {clbck_not} | ( search_condition ) {clbck__} | predicate {clbck_pre} ;
我知道,我指定了解决转移问题的优先工作
。
%left OR
%left AND
%left NOT
So back on the last example ; my clause where will be consumed this way:
c.address="nefta"or c.address="tozeur" -> search_condition
(c.address="nefta"or c.address="tozeur")->search_condition
e.student_name= c.contact_name and (c.address="nefta"or c.address="tozeur")-> search_condition
... and e.age<18-> search_condition
你们可以理解的是,在每一次削减引起的呼吁方面重建投入流的难度并不相同。
Any help for this problem ?