0
我使用JFLEX,byacc,JAVA解析聲明它看起來像YACC /野牛鑑定結果在行動
where expr,expr having expr
和語法看起來像
%token WHERE HAVING COMMA
%%
stmt : whereclause havingclause
whereclause : WHERE conditionlist { move tmpList to whereClause};
havingclause : HAVING conditionlist { move tmpList to havingClause};
conditionlist : condition | condition COMMA conditionlist;
condition : expr { tmpList.add($1);
/How do I know this is being executed for whereclause or havingclause /};
expr : ....
我不能夠區分如果條件是where條款或having條款的一部分,那麼我將條件存儲在臨時列表中,然後移至正確的條款。 這樣做的正確方法是什麼?