<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 18,  comments - 0,  trackbacks - 0

       在目前的WHERE條件中,針對where ((a > 0) and (c = 'hjd'))之間的邏輯表達(dá)式無法識別,參考o(jì)racle的語法文件,我修改了語法文件,語法已可以驗(yàn)證,但在遍歷語法樹時,TOKEN下面的子TOKEN內(nèi)容無法獲取,語法定義的內(nèi)容如下:

    /*==================================================================//
    //                                                                  //
    //      Where Condition Begin                                       //
    //                                                                  //
    //==================================================================*/
    where_condition
     : condition
            { #where_condition = #([WHERE_CONDITION, "where_condition"], #where_condition); }
        ;

    condition
     :  logical_term ( ("or"^ | "或者"^) logical_term )*
     ;

    logical_term
     : logical_factor ( ("and"^ | "并且"^) logical_factor )*
     ;

    logical_factor
     : ( exp_simple compare_op exp_simple ) => (exp_simple compare_op exp_simple )
      {#logical_factor = #([COMPARE_OP, "comp_op"], #logical_factor);}
     |  ( exp_simple ( "in" | "在于" ) ) => exp_simple ( "in" | "在于" ) exp_set
      { #logical_factor = #([LOGICAL_CONTAIN, "logic_contain"], #logical_factor); }
     | ( exp_simple ( "not in" | "不在于" ) ) => exp_simple ( "not in" | "不在于" ) exp_set
      { #logical_factor = #([LOGICAL_CONTAIN, "logic_contain"], #logical_factor); }
     |  ( exp_simple ( "like" | "包含" ) ) => exp_simple ("like" | "包含" ) where_expression ( "escape" QUOTED_STRING )?
      { #logical_factor = #([LOGICAL_LIKE, "logic_like"], #logical_factor); }
     |  ( exp_simple ( "not like" | "不包含" ) ) => exp_simple ("not like" | "不包含" ) where_expression ( "escape" QUOTED_STRING )?
      { #logical_factor = #([LOGICAL_LIKE, "logic_like"], #logical_factor); }
     |  ( exp_simple ( "between"| "范圍" ) ) => exp_simple ( "between" | "范圍" ) exp_simple exp_simple
      { #logical_factor = #([LOGICAL_BETWEEN, "logic_between"], #logical_factor); }
     |  ( exp_simple ( "not between"| "不在范圍" ) ) => exp_simple ( "not between" | "不在范圍" ) exp_simple exp_simple
      { #logical_factor = #([LOGICAL_BETWEEN, "logic_between"], #logical_factor); }
     |  ( exp_simple ( "is null" | "為空" ) ) => exp_simple ( "is null" | "為空" )
      { #logical_factor = #([LOGICAL_NULL, "logic_null"], #logical_factor); }
     |  ( exp_simple ( "is not null" | "非空" ) ) => exp_simple ( "is not null" | "非空" )
      { #logical_factor = #([LOGICAL_NULL, "logic_null"], #logical_factor); }
     |  ( quantified_factor ) => quantified_factor
      { #logical_factor = #([LOGICAL_EXISTS, "logic_exists"], #logical_factor); }
     |  ( ( "not" | "非" ) condition ) => ( "not" | "非" ) condition
      { #logical_factor = #([COND_NOT, "cond_not"], #logical_factor); }
     |  ( LPAREN condition RPAREN )
      { #logical_factor = #([COND_PAREN, "cond_paren"], #logical_factor); }
        ;

    quantified_factor
     : ( exp_simple compare_op ( "all" | "any" )? subquery ) => exp_simple compare_op ( "all" | "any" )? subquery
        |  ( ( "not" )? "exists" subquery ) => ( "not" )? "exists" subquery
        |  subquery
        ;

    exp_simple
     :  where_expression
     ;

    where_expression
     :  term ( ( PLUS^ | MINUS^ | "加"^ | "減"^) term )*
        ;

    term
     :  factor ( ( MUL^ | DIVIDE^ | "乘"^ | "除"^) factor )*
        ;
     
    multiply
     : MUL | "乘"
            { #multiply = #([MULTIPLY, "multiply"], #multiply); }
        ;

    factor
     : ( sql_literal ) => sql_literal
     | ( ( PLUS | MINUS ) where_expression ) => ( PLUS | MINUS ) where_expression
     | ( function_name ( LPAREN where_expression ( COMMA where_expression )* RPAREN ) ) => function_name ( LPAREN where_expression ( COMMA where_expression )* RPAREN )
      { #factor = #([NORMAL_FUNCTION, "normal_function"], #factor); }
     |  ( aggregate_func_name LPAREN ( STAR | "all" | "distinct" )? (where_expression)? RPAREN ) => aggregate_func_name LPAREN ( STAR | "all" | "distinct" )? (where_expression)? RPAREN
            { #factor = #([GROUP_FUNCTION, "group_function"], #factor); }
     | ( LPAREN where_expression RPAREN ) => LPAREN where_expression RPAREN
      { #factor = #([EXPRESSION_PAREN, "expression_paren"], #factor); }
     ;

    sql_literal
     : constant
     | field_name
     ;

    where_expression_list
     : LPAREN where_expression ( COMMA where_expression )+ RPAREN
     ;

    exp_set
     :  LPAREN constexpset RPAREN
     {#exp_set = #([SUBCONTAIN_OP, "subcontain_op"], #exp_set);}
    // | subquery
     ;

    constexpset
     : constant (COMMA^ constant)*
    // {#constexpset = #([SUBCONTAIN_CONTENT, "subcontain_content"], #constexpset);}
     ;
    /*==================================================================//
    //                                                                 //
    //      Where Condition End                                        //
    //                                                                 //
    //==================================================================*/

    posted on 2007-04-12 10:50 LORD BLOG 閱讀(565) 評論(0)  編輯  收藏 所屬分類: 工作日志
    主站蜘蛛池模板: 亚洲国产综合精品| 阿v视频免费在线观看| 亚洲视屏在线观看| 亚洲午夜精品一区二区麻豆| 亚洲砖码砖专无区2023| 日韩成人精品日本亚洲| 曰批免费视频播放免费| 99精品免费视频| 亚洲最大免费视频网| 国产免费小视频在线观看| 亚洲综合激情另类专区| 自怕偷自怕亚洲精品| 亚洲一区二区三区丝袜| 久久嫩草影院免费看夜色| 免费无码又爽又刺激网站| 丁香花免费完整高清观看| 日本高清免费不卡视频| 亚洲国产精品无码成人片久久| 国产亚洲国产bv网站在线| 国产国产人免费人成成免视频 | 亚洲成人免费网址| 美女视频黄.免费网址| 美女裸身网站免费看免费网站| 亚洲第一黄片大全| 91丁香亚洲综合社区| 成人av片无码免费天天看| 日韩毛片免费无码无毒视频观看| 亚洲色精品88色婷婷七月丁香| 亚洲不卡影院午夜在线观看| 免费国产黄网站在线观看可以下载| 午夜小视频免费观看| 2020国产精品亚洲综合网| 91精品国产免费久久国语蜜臀| 亚洲色偷偷狠狠综合网| 特级毛片aaaa级毛片免费| 天天拍拍天天爽免费视频| 亚洲色大网站WWW永久网站| 国产成人免费在线| 337p日本欧洲亚洲大胆色噜噜| 久久久久久AV无码免费网站| 久久亚洲精品中文字幕无码|