~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2010-02-11 22:56:25 UTC
  • Revision ID: brian@gaz-20100211225625-63v3e79p78blva2u
Remove WEIGHT_STRING() from parser (where it does not belong). If someone
wants to they can reimplement this as a straight function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
743
743
%token  VAR_SAMP_SYM
744
744
%token  WARNINGS
745
745
%token  WEEK_SYM
746
 
%token  WEIGHT_STRING_SYM
747
746
%token  WHEN_SYM                      /* SQL-2003-R */
748
747
%token  WHERE                         /* SQL-2003-R */
749
748
%token  WITH                          /* SQL-2003-R */
803
802
        delete_option
804
803
 
805
804
%type <ulong_num>
806
 
        ulong_num real_ulong_num
807
 
        ws_nweights
808
 
        ws_level_flag_desc ws_level_flag_reverse ws_level_flags
809
 
        opt_ws_levels ws_level_list ws_level_list_item ws_level_number
810
 
        ws_level_range ws_level_list_or_range 
 
805
        ulong_num
811
806
 
812
807
%type <ulonglong_number>
813
808
        ulonglong_num
1867
1862
        | DEFAULT {}
1868
1863
        ;
1869
1864
 
1870
 
ws_nweights:
1871
 
        '(' real_ulong_num
1872
 
        {
1873
 
          if ($2 == 0)
1874
 
          {
1875
 
            my_parse_error(ER(ER_SYNTAX_ERROR));
1876
 
            DRIZZLE_YYABORT;
1877
 
          }
1878
 
        }
1879
 
        ')'
1880
 
        { $$= $2; }
1881
 
        ;
1882
 
 
1883
 
ws_level_flag_desc:
1884
 
        ASC { $$= 0; }
1885
 
        | DESC { $$= 1 << MY_STRXFRM_DESC_SHIFT; }
1886
 
        ;
1887
 
 
1888
 
ws_level_flag_reverse:
1889
 
        REVERSE_SYM { $$= 1 << MY_STRXFRM_REVERSE_SHIFT; } ;
1890
 
 
1891
 
ws_level_flags:
1892
 
        /* empty */ { $$= 0; }
1893
 
        | ws_level_flag_desc { $$= $1; }
1894
 
        | ws_level_flag_desc ws_level_flag_reverse { $$= $1 | $2; }
1895
 
        | ws_level_flag_reverse { $$= $1 ; }
1896
 
        ;
1897
 
 
1898
 
ws_level_number:
1899
 
        real_ulong_num
1900
 
        {
1901
 
          $$= $1 < 1 ? 1 : ($1 > MY_STRXFRM_NLEVELS ? MY_STRXFRM_NLEVELS : $1);
1902
 
          $$--;
1903
 
        }
1904
 
        ;
1905
 
 
1906
 
ws_level_list_item:
1907
 
        ws_level_number ws_level_flags
1908
 
        {
1909
 
          $$= (1 | $2) << $1;
1910
 
        }
1911
 
        ;
1912
 
 
1913
 
ws_level_list:
1914
 
        ws_level_list_item { $$= $1; }
1915
 
        | ws_level_list ',' ws_level_list_item { $$|= $3; }
1916
 
        ;
1917
 
 
1918
 
ws_level_range:
1919
 
        ws_level_number '-' ws_level_number
1920
 
        {
1921
 
          uint32_t start= $1;
1922
 
          uint32_t end= $3;
1923
 
          for ($$= 0; start <= end; start++)
1924
 
            $$|= (1 << start);
1925
 
        }
1926
 
        ;
1927
 
 
1928
 
ws_level_list_or_range:
1929
 
        ws_level_list { $$= $1; }
1930
 
        | ws_level_range { $$= $1; }
1931
 
        ;
1932
 
 
1933
 
opt_ws_levels:
1934
 
        /* empty*/ { $$= 0; }
1935
 
        | LEVEL_SYM ws_level_list_or_range { $$= $2; }
1936
 
        ;
1937
 
 
1938
1865
opt_primary:
1939
1866
          /* empty */
1940
1867
        | PRIMARY_SYM
3202
3129
          { $$= new (YYSession->mem_root) Item_func_reverse($3); }
3203
3130
        | TRUNCATE_SYM '(' expr ',' expr ')'
3204
3131
          { $$= new (YYSession->mem_root) Item_func_round($3,$5,1); }
3205
 
        | WEIGHT_STRING_SYM '(' expr opt_ws_levels ')'
3206
 
          { $$= new (YYSession->mem_root) Item_func_weight_string($3, 0, $4); }
3207
 
        | WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_nweights opt_ws_levels ')'
3208
 
          {
3209
 
            $$= new (YYSession->mem_root)
3210
 
                Item_func_weight_string($3, $6, $7|MY_STRXFRM_PAD_WITH_SPACE);
3211
 
          }
3212
 
        | WEIGHT_STRING_SYM '(' expr AS BINARY ws_nweights ')'
3213
 
          {
3214
 
            $3= create_func_char_cast(YYSession, $3, $6, &my_charset_bin);
3215
 
            $$= new (YYSession->mem_root)
3216
 
                Item_func_weight_string($3, $6, MY_STRXFRM_PAD_WITH_SPACE);
3217
 
          }
3218
3132
        ;
3219
3133
 
3220
3134
/*
4286
4200
        | FLOAT_NUM     { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
4287
4201
        ;
4288
4202
 
4289
 
real_ulong_num:
4290
 
          NUM           { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
4291
 
        | HEX_NUM       { $$= (ulong) strtol($1.str, (char**) 0, 16); }
4292
 
        | LONG_NUM      { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
4293
 
        | ULONGLONG_NUM { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
4294
 
        | dec_num_error { }
4295
 
        ;
4296
 
 
4297
4203
ulonglong_num:
4298
4204
          NUM           { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); }
4299
4205
        | ULONGLONG_NUM { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); }
5676
5582
        | VALUE_SYM                {}
5677
5583
        | WARNINGS                 {}
5678
5584
        | WEEK_SYM                 {}
5679
 
        | WEIGHT_STRING_SYM        {}
5680
5585
        | WORK_SYM                 {}
5681
5586
        | YEAR_SYM                 {}
5682
5587
        ;