1*6b5e5868SGarrett D'Amore %{ 2*6b5e5868SGarrett D'Amore /* 3*6b5e5868SGarrett D'Amore * This file and its contents are supplied under the terms of the 4*6b5e5868SGarrett D'Amore * Common Development and Distribution License ("CDDL"), version 1.0. 5*6b5e5868SGarrett D'Amore * You may only use this file in accordance with the terms version 1.0 6*6b5e5868SGarrett D'Amore * of the CDDL. 7*6b5e5868SGarrett D'Amore * 8*6b5e5868SGarrett D'Amore * A full copy of the text of the CDDL should have accompanied this 9*6b5e5868SGarrett D'Amore * source. A copy of the CDDL is also available via the Internet at 10*6b5e5868SGarrett D'Amore * http://www.illumos.org/license/CDDL. 11*6b5e5868SGarrett D'Amore */ 12*6b5e5868SGarrett D'Amore 13*6b5e5868SGarrett D'Amore /* 14*6b5e5868SGarrett D'Amore * Copyright 2010 Nexenta Systems, Inc. All rights reserved. 15*6b5e5868SGarrett D'Amore */ 16*6b5e5868SGarrett D'Amore 17*6b5e5868SGarrett D'Amore /* 18*6b5e5868SGarrett D'Amore * POSIX localedef grammar. 19*6b5e5868SGarrett D'Amore */ 20*6b5e5868SGarrett D'Amore 21*6b5e5868SGarrett D'Amore #include <wchar.h> 22*6b5e5868SGarrett D'Amore #include <stdio.h> 23*6b5e5868SGarrett D'Amore #include <limits.h> 24*6b5e5868SGarrett D'Amore #include "localedef.h" 25*6b5e5868SGarrett D'Amore 26*6b5e5868SGarrett D'Amore %} 27*6b5e5868SGarrett D'Amore %union { 28*6b5e5868SGarrett D'Amore int num; 29*6b5e5868SGarrett D'Amore wchar_t wc; 30*6b5e5868SGarrett D'Amore char *token; 31*6b5e5868SGarrett D'Amore collsym_t *collsym; 32*6b5e5868SGarrett D'Amore collelem_t *collelem; 33*6b5e5868SGarrett D'Amore } 34*6b5e5868SGarrett D'Amore 35*6b5e5868SGarrett D'Amore %token T_CODE_SET 36*6b5e5868SGarrett D'Amore %token T_MB_CUR_MAX 37*6b5e5868SGarrett D'Amore %token T_MB_CUR_MIN 38*6b5e5868SGarrett D'Amore %token T_COM_CHAR 39*6b5e5868SGarrett D'Amore %token T_ESC_CHAR 40*6b5e5868SGarrett D'Amore %token T_LT 41*6b5e5868SGarrett D'Amore %token T_GT 42*6b5e5868SGarrett D'Amore %token T_NL 43*6b5e5868SGarrett D'Amore %token T_SEMI 44*6b5e5868SGarrett D'Amore %token T_COMMA 45*6b5e5868SGarrett D'Amore %token T_ELLIPSIS 46*6b5e5868SGarrett D'Amore %token T_RPAREN 47*6b5e5868SGarrett D'Amore %token T_LPAREN 48*6b5e5868SGarrett D'Amore %token T_QUOTE 49*6b5e5868SGarrett D'Amore %token T_NULL 50*6b5e5868SGarrett D'Amore %token T_WS 51*6b5e5868SGarrett D'Amore %token T_END 52*6b5e5868SGarrett D'Amore %token T_COPY 53*6b5e5868SGarrett D'Amore %token T_CHARMAP 54*6b5e5868SGarrett D'Amore %token T_WIDTH 55*6b5e5868SGarrett D'Amore %token T_WIDTH_DEFAULT 56*6b5e5868SGarrett D'Amore %token T_CTYPE 57*6b5e5868SGarrett D'Amore %token T_ISUPPER 58*6b5e5868SGarrett D'Amore %token T_ISLOWER 59*6b5e5868SGarrett D'Amore %token T_ISALPHA 60*6b5e5868SGarrett D'Amore %token T_ISDIGIT 61*6b5e5868SGarrett D'Amore %token T_ISPUNCT 62*6b5e5868SGarrett D'Amore %token T_ISXDIGIT 63*6b5e5868SGarrett D'Amore %token T_ISSPACE 64*6b5e5868SGarrett D'Amore %token T_ISPRINT 65*6b5e5868SGarrett D'Amore %token T_ISGRAPH 66*6b5e5868SGarrett D'Amore %token T_ISBLANK 67*6b5e5868SGarrett D'Amore %token T_ISCNTRL 68*6b5e5868SGarrett D'Amore %token T_ISALNUM 69*6b5e5868SGarrett D'Amore %token T_ISSPECIAL 70*6b5e5868SGarrett D'Amore %token T_ISPHONOGRAM 71*6b5e5868SGarrett D'Amore %token T_ISIDEOGRAM 72*6b5e5868SGarrett D'Amore %token T_ISENGLISH 73*6b5e5868SGarrett D'Amore %token T_ISNUMBER 74*6b5e5868SGarrett D'Amore %token T_TOUPPER 75*6b5e5868SGarrett D'Amore %token T_TOLOWER 76*6b5e5868SGarrett D'Amore %token T_COLLATE 77*6b5e5868SGarrett D'Amore %token T_COLLATING_SYMBOL 78*6b5e5868SGarrett D'Amore %token T_COLLATING_ELEMENT 79*6b5e5868SGarrett D'Amore %token T_ORDER_START 80*6b5e5868SGarrett D'Amore %token T_ORDER_END 81*6b5e5868SGarrett D'Amore %token T_FORWARD 82*6b5e5868SGarrett D'Amore %token T_BACKWARD 83*6b5e5868SGarrett D'Amore %token T_POSITION 84*6b5e5868SGarrett D'Amore %token T_FROM 85*6b5e5868SGarrett D'Amore %token T_UNDEFINED 86*6b5e5868SGarrett D'Amore %token T_IGNORE 87*6b5e5868SGarrett D'Amore %token T_MESSAGES 88*6b5e5868SGarrett D'Amore %token T_YESSTR 89*6b5e5868SGarrett D'Amore %token T_NOSTR 90*6b5e5868SGarrett D'Amore %token T_YESEXPR 91*6b5e5868SGarrett D'Amore %token T_NOEXPR 92*6b5e5868SGarrett D'Amore %token T_MONETARY 93*6b5e5868SGarrett D'Amore %token T_INT_CURR_SYMBOL 94*6b5e5868SGarrett D'Amore %token T_CURRENCY_SYMBOL 95*6b5e5868SGarrett D'Amore %token T_MON_DECIMAL_POINT 96*6b5e5868SGarrett D'Amore %token T_MON_THOUSANDS_SEP 97*6b5e5868SGarrett D'Amore %token T_POSITIVE_SIGN 98*6b5e5868SGarrett D'Amore %token T_NEGATIVE_SIGN 99*6b5e5868SGarrett D'Amore %token T_MON_GROUPING 100*6b5e5868SGarrett D'Amore %token T_INT_FRAC_DIGITS 101*6b5e5868SGarrett D'Amore %token T_FRAC_DIGITS 102*6b5e5868SGarrett D'Amore %token T_P_CS_PRECEDES 103*6b5e5868SGarrett D'Amore %token T_P_SEP_BY_SPACE 104*6b5e5868SGarrett D'Amore %token T_N_CS_PRECEDES 105*6b5e5868SGarrett D'Amore %token T_N_SEP_BY_SPACE 106*6b5e5868SGarrett D'Amore %token T_P_SIGN_POSN 107*6b5e5868SGarrett D'Amore %token T_N_SIGN_POSN 108*6b5e5868SGarrett D'Amore %token T_INT_P_CS_PRECEDES 109*6b5e5868SGarrett D'Amore %token T_INT_N_CS_PRECEDES 110*6b5e5868SGarrett D'Amore %token T_INT_P_SEP_BY_SPACE 111*6b5e5868SGarrett D'Amore %token T_INT_N_SEP_BY_SPACE 112*6b5e5868SGarrett D'Amore %token T_INT_P_SIGN_POSN 113*6b5e5868SGarrett D'Amore %token T_INT_N_SIGN_POSN 114*6b5e5868SGarrett D'Amore %token T_NUMERIC 115*6b5e5868SGarrett D'Amore %token T_DECIMAL_POINT 116*6b5e5868SGarrett D'Amore %token T_THOUSANDS_SEP 117*6b5e5868SGarrett D'Amore %token T_GROUPING 118*6b5e5868SGarrett D'Amore %token T_TIME 119*6b5e5868SGarrett D'Amore %token T_ABDAY 120*6b5e5868SGarrett D'Amore %token T_DAY 121*6b5e5868SGarrett D'Amore %token T_ABMON 122*6b5e5868SGarrett D'Amore %token T_MON 123*6b5e5868SGarrett D'Amore %token T_ERA 124*6b5e5868SGarrett D'Amore %token T_ERA_D_FMT 125*6b5e5868SGarrett D'Amore %token T_ERA_T_FMT 126*6b5e5868SGarrett D'Amore %token T_ERA_D_T_FMT 127*6b5e5868SGarrett D'Amore %token T_ALT_DIGITS 128*6b5e5868SGarrett D'Amore %token T_D_T_FMT 129*6b5e5868SGarrett D'Amore %token T_D_FMT 130*6b5e5868SGarrett D'Amore %token T_T_FMT 131*6b5e5868SGarrett D'Amore %token T_AM_PM 132*6b5e5868SGarrett D'Amore %token T_T_FMT_AMPM 133*6b5e5868SGarrett D'Amore %token T_DATE_FMT 134*6b5e5868SGarrett D'Amore %token <wc> T_CHAR 135*6b5e5868SGarrett D'Amore %token <token> T_NAME 136*6b5e5868SGarrett D'Amore %token <num> T_NUMBER 137*6b5e5868SGarrett D'Amore %token <token> T_SYMBOL 138*6b5e5868SGarrett D'Amore %token <collsym> T_COLLSYM 139*6b5e5868SGarrett D'Amore %token <collelem> T_COLLELEM 140*6b5e5868SGarrett D'Amore 141*6b5e5868SGarrett D'Amore %% 142*6b5e5868SGarrett D'Amore 143*6b5e5868SGarrett D'Amore localedef : setting_list categories 144*6b5e5868SGarrett D'Amore | categories 145*6b5e5868SGarrett D'Amore ; 146*6b5e5868SGarrett D'Amore 147*6b5e5868SGarrett D'Amore string : T_QUOTE charlist T_QUOTE 148*6b5e5868SGarrett D'Amore | T_QUOTE T_QUOTE 149*6b5e5868SGarrett D'Amore ; 150*6b5e5868SGarrett D'Amore 151*6b5e5868SGarrett D'Amore charlist : charlist T_CHAR 152*6b5e5868SGarrett D'Amore { 153*6b5e5868SGarrett D'Amore add_wcs($2); 154*6b5e5868SGarrett D'Amore } 155*6b5e5868SGarrett D'Amore | T_CHAR 156*6b5e5868SGarrett D'Amore { 157*6b5e5868SGarrett D'Amore add_wcs($1); 158*6b5e5868SGarrett D'Amore } 159*6b5e5868SGarrett D'Amore ; 160*6b5e5868SGarrett D'Amore 161*6b5e5868SGarrett D'Amore setting_list : setting_list setting 162*6b5e5868SGarrett D'Amore | setting 163*6b5e5868SGarrett D'Amore ; 164*6b5e5868SGarrett D'Amore 165*6b5e5868SGarrett D'Amore 166*6b5e5868SGarrett D'Amore setting : T_COM_CHAR T_CHAR T_NL 167*6b5e5868SGarrett D'Amore { 168*6b5e5868SGarrett D'Amore com_char = $2; 169*6b5e5868SGarrett D'Amore } 170*6b5e5868SGarrett D'Amore | T_ESC_CHAR T_CHAR T_NL 171*6b5e5868SGarrett D'Amore { 172*6b5e5868SGarrett D'Amore esc_char = $2; 173*6b5e5868SGarrett D'Amore } 174*6b5e5868SGarrett D'Amore | T_MB_CUR_MAX T_NUMBER T_NL 175*6b5e5868SGarrett D'Amore { 176*6b5e5868SGarrett D'Amore mb_cur_max = $2; 177*6b5e5868SGarrett D'Amore } 178*6b5e5868SGarrett D'Amore | T_MB_CUR_MIN T_NUMBER T_NL 179*6b5e5868SGarrett D'Amore { 180*6b5e5868SGarrett D'Amore mb_cur_min = $2; 181*6b5e5868SGarrett D'Amore } 182*6b5e5868SGarrett D'Amore | T_CODE_SET string T_NL 183*6b5e5868SGarrett D'Amore { 184*6b5e5868SGarrett D'Amore wchar_t *w = get_wcs(); 185*6b5e5868SGarrett D'Amore set_wide_encoding(to_mb_string(w)); 186*6b5e5868SGarrett D'Amore free(w); 187*6b5e5868SGarrett D'Amore } 188*6b5e5868SGarrett D'Amore | T_CODE_SET T_NAME T_NL 189*6b5e5868SGarrett D'Amore { 190*6b5e5868SGarrett D'Amore set_wide_encoding($2); 191*6b5e5868SGarrett D'Amore } 192*6b5e5868SGarrett D'Amore ; 193*6b5e5868SGarrett D'Amore 194*6b5e5868SGarrett D'Amore copycat : T_COPY T_NAME T_NL 195*6b5e5868SGarrett D'Amore { 196*6b5e5868SGarrett D'Amore copy_category($2); 197*6b5e5868SGarrett D'Amore } 198*6b5e5868SGarrett D'Amore | T_COPY string T_NL 199*6b5e5868SGarrett D'Amore { 200*6b5e5868SGarrett D'Amore wchar_t *w = get_wcs(); 201*6b5e5868SGarrett D'Amore copy_category(to_mb_string(w)); 202*6b5e5868SGarrett D'Amore free(w); 203*6b5e5868SGarrett D'Amore } 204*6b5e5868SGarrett D'Amore ; 205*6b5e5868SGarrett D'Amore 206*6b5e5868SGarrett D'Amore categories : categories category 207*6b5e5868SGarrett D'Amore | category 208*6b5e5868SGarrett D'Amore ; 209*6b5e5868SGarrett D'Amore 210*6b5e5868SGarrett D'Amore 211*6b5e5868SGarrett D'Amore category : charmap 212*6b5e5868SGarrett D'Amore | messages 213*6b5e5868SGarrett D'Amore | monetary 214*6b5e5868SGarrett D'Amore | ctype 215*6b5e5868SGarrett D'Amore | collate 216*6b5e5868SGarrett D'Amore | numeric 217*6b5e5868SGarrett D'Amore | time 218*6b5e5868SGarrett D'Amore ; 219*6b5e5868SGarrett D'Amore 220*6b5e5868SGarrett D'Amore 221*6b5e5868SGarrett D'Amore charmap : T_CHARMAP T_NL charmap_list T_END T_CHARMAP T_NL 222*6b5e5868SGarrett D'Amore 223*6b5e5868SGarrett D'Amore 224*6b5e5868SGarrett D'Amore charmap_list : charmap_list charmap_entry 225*6b5e5868SGarrett D'Amore | charmap_entry 226*6b5e5868SGarrett D'Amore ; 227*6b5e5868SGarrett D'Amore 228*6b5e5868SGarrett D'Amore 229*6b5e5868SGarrett D'Amore charmap_entry : T_SYMBOL T_CHAR 230*6b5e5868SGarrett D'Amore { 231*6b5e5868SGarrett D'Amore add_charmap($1, $2); 232*6b5e5868SGarrett D'Amore scan_to_eol(); 233*6b5e5868SGarrett D'Amore } 234*6b5e5868SGarrett D'Amore | T_SYMBOL T_ELLIPSIS T_SYMBOL T_CHAR 235*6b5e5868SGarrett D'Amore { 236*6b5e5868SGarrett D'Amore add_charmap_range($1, $3, $4); 237*6b5e5868SGarrett D'Amore scan_to_eol(); 238*6b5e5868SGarrett D'Amore } 239*6b5e5868SGarrett D'Amore | T_NL 240*6b5e5868SGarrett D'Amore ; 241*6b5e5868SGarrett D'Amore 242*6b5e5868SGarrett D'Amore ctype : T_CTYPE T_NL ctype_list T_END T_CTYPE T_NL 243*6b5e5868SGarrett D'Amore { 244*6b5e5868SGarrett D'Amore dump_ctype(); 245*6b5e5868SGarrett D'Amore } 246*6b5e5868SGarrett D'Amore | T_CTYPE T_NL copycat T_END T_CTYPE T_NL 247*6b5e5868SGarrett D'Amore ; 248*6b5e5868SGarrett D'Amore 249*6b5e5868SGarrett D'Amore ctype_list : ctype_list ctype_kw 250*6b5e5868SGarrett D'Amore | ctype_kw 251*6b5e5868SGarrett D'Amore ; 252*6b5e5868SGarrett D'Amore 253*6b5e5868SGarrett D'Amore ctype_kw : T_ISUPPER cc_list T_NL 254*6b5e5868SGarrett D'Amore | T_ISLOWER cc_list T_NL 255*6b5e5868SGarrett D'Amore | T_ISALPHA cc_list T_NL 256*6b5e5868SGarrett D'Amore | T_ISDIGIT cc_list T_NL 257*6b5e5868SGarrett D'Amore | T_ISPUNCT cc_list T_NL 258*6b5e5868SGarrett D'Amore | T_ISXDIGIT cc_list T_NL 259*6b5e5868SGarrett D'Amore | T_ISSPACE cc_list T_NL 260*6b5e5868SGarrett D'Amore | T_ISPRINT cc_list T_NL 261*6b5e5868SGarrett D'Amore | T_ISGRAPH cc_list T_NL 262*6b5e5868SGarrett D'Amore | T_ISBLANK cc_list T_NL 263*6b5e5868SGarrett D'Amore | T_ISCNTRL cc_list T_NL 264*6b5e5868SGarrett D'Amore | T_ISALNUM cc_list T_NL 265*6b5e5868SGarrett D'Amore | T_ISSPECIAL cc_list T_NL 266*6b5e5868SGarrett D'Amore | T_ISENGLISH cc_list T_NL 267*6b5e5868SGarrett D'Amore | T_ISNUMBER cc_list T_NL 268*6b5e5868SGarrett D'Amore | T_ISIDEOGRAM cc_list T_NL 269*6b5e5868SGarrett D'Amore | T_ISPHONOGRAM cc_list T_NL 270*6b5e5868SGarrett D'Amore | T_TOUPPER conv_list T_NL 271*6b5e5868SGarrett D'Amore | T_TOLOWER conv_list T_NL 272*6b5e5868SGarrett D'Amore ; 273*6b5e5868SGarrett D'Amore 274*6b5e5868SGarrett D'Amore 275*6b5e5868SGarrett D'Amore cc_list : cc_list T_SEMI T_CHAR 276*6b5e5868SGarrett D'Amore { 277*6b5e5868SGarrett D'Amore add_ctype($3); 278*6b5e5868SGarrett D'Amore } 279*6b5e5868SGarrett D'Amore | cc_list T_SEMI T_SYMBOL 280*6b5e5868SGarrett D'Amore { 281*6b5e5868SGarrett D'Amore add_charmap_undefined($3); 282*6b5e5868SGarrett D'Amore } 283*6b5e5868SGarrett D'Amore | cc_list T_SEMI T_ELLIPSIS T_SEMI T_CHAR 284*6b5e5868SGarrett D'Amore { 285*6b5e5868SGarrett D'Amore /* note that the endpoints *must* be characters */ 286*6b5e5868SGarrett D'Amore add_ctype_range($5); 287*6b5e5868SGarrett D'Amore } 288*6b5e5868SGarrett D'Amore | T_CHAR 289*6b5e5868SGarrett D'Amore { 290*6b5e5868SGarrett D'Amore add_ctype($1); 291*6b5e5868SGarrett D'Amore } 292*6b5e5868SGarrett D'Amore | T_SYMBOL 293*6b5e5868SGarrett D'Amore { 294*6b5e5868SGarrett D'Amore add_charmap_undefined($1); 295*6b5e5868SGarrett D'Amore } 296*6b5e5868SGarrett D'Amore ; 297*6b5e5868SGarrett D'Amore 298*6b5e5868SGarrett D'Amore conv_list : conv_list T_SEMI conv_pair 299*6b5e5868SGarrett D'Amore | conv_pair 300*6b5e5868SGarrett D'Amore ; 301*6b5e5868SGarrett D'Amore 302*6b5e5868SGarrett D'Amore 303*6b5e5868SGarrett D'Amore conv_pair : T_LPAREN T_CHAR T_COMMA T_CHAR T_RPAREN 304*6b5e5868SGarrett D'Amore { 305*6b5e5868SGarrett D'Amore add_caseconv($2, $4); 306*6b5e5868SGarrett D'Amore } 307*6b5e5868SGarrett D'Amore | T_LPAREN T_SYMBOL T_COMMA T_CHAR T_RPAREN 308*6b5e5868SGarrett D'Amore { 309*6b5e5868SGarrett D'Amore add_charmap_undefined($2); 310*6b5e5868SGarrett D'Amore } 311*6b5e5868SGarrett D'Amore | T_LPAREN T_SYMBOL T_COMMA T_SYMBOL T_RPAREN 312*6b5e5868SGarrett D'Amore { 313*6b5e5868SGarrett D'Amore add_charmap_undefined($2); 314*6b5e5868SGarrett D'Amore add_charmap_undefined($4); 315*6b5e5868SGarrett D'Amore } 316*6b5e5868SGarrett D'Amore | T_LPAREN T_CHAR T_COMMA T_SYMBOL T_RPAREN 317*6b5e5868SGarrett D'Amore { 318*6b5e5868SGarrett D'Amore add_charmap_undefined($4); 319*6b5e5868SGarrett D'Amore } 320*6b5e5868SGarrett D'Amore ; 321*6b5e5868SGarrett D'Amore 322*6b5e5868SGarrett D'Amore collate : T_COLLATE T_NL coll_order T_END T_COLLATE T_NL 323*6b5e5868SGarrett D'Amore { 324*6b5e5868SGarrett D'Amore dump_collate(); 325*6b5e5868SGarrett D'Amore } 326*6b5e5868SGarrett D'Amore | T_COLLATE T_NL coll_optional coll_order T_END T_COLLATE T_NL 327*6b5e5868SGarrett D'Amore { 328*6b5e5868SGarrett D'Amore dump_collate(); 329*6b5e5868SGarrett D'Amore } 330*6b5e5868SGarrett D'Amore | T_COLLATE T_NL copycat T_END T_COLLATE T_NL 331*6b5e5868SGarrett D'Amore ; 332*6b5e5868SGarrett D'Amore 333*6b5e5868SGarrett D'Amore 334*6b5e5868SGarrett D'Amore coll_optional : coll_optional coll_symbols 335*6b5e5868SGarrett D'Amore | coll_optional coll_elements 336*6b5e5868SGarrett D'Amore | coll_symbols 337*6b5e5868SGarrett D'Amore | coll_elements 338*6b5e5868SGarrett D'Amore ; 339*6b5e5868SGarrett D'Amore 340*6b5e5868SGarrett D'Amore 341*6b5e5868SGarrett D'Amore coll_symbols : T_COLLATING_SYMBOL T_SYMBOL T_NL 342*6b5e5868SGarrett D'Amore { 343*6b5e5868SGarrett D'Amore define_collsym($2); 344*6b5e5868SGarrett D'Amore } 345*6b5e5868SGarrett D'Amore ; 346*6b5e5868SGarrett D'Amore 347*6b5e5868SGarrett D'Amore 348*6b5e5868SGarrett D'Amore coll_elements : T_COLLATING_ELEMENT T_SYMBOL T_FROM string T_NL 349*6b5e5868SGarrett D'Amore { 350*6b5e5868SGarrett D'Amore define_collelem($2, get_wcs()); 351*6b5e5868SGarrett D'Amore } 352*6b5e5868SGarrett D'Amore ; 353*6b5e5868SGarrett D'Amore 354*6b5e5868SGarrett D'Amore coll_order : T_ORDER_START T_NL order_list T_ORDER_END T_NL 355*6b5e5868SGarrett D'Amore { 356*6b5e5868SGarrett D'Amore /* If no order list supplied default to one forward */ 357*6b5e5868SGarrett D'Amore add_order_bit(T_FORWARD); 358*6b5e5868SGarrett D'Amore add_order_directive(); 359*6b5e5868SGarrett D'Amore } 360*6b5e5868SGarrett D'Amore | T_ORDER_START order_args T_NL order_list T_ORDER_END T_NL 361*6b5e5868SGarrett D'Amore ; 362*6b5e5868SGarrett D'Amore 363*6b5e5868SGarrett D'Amore 364*6b5e5868SGarrett D'Amore order_args : order_args T_SEMI order_arg 365*6b5e5868SGarrett D'Amore { 366*6b5e5868SGarrett D'Amore add_order_directive(); 367*6b5e5868SGarrett D'Amore } 368*6b5e5868SGarrett D'Amore | order_arg 369*6b5e5868SGarrett D'Amore { 370*6b5e5868SGarrett D'Amore add_order_directive(); 371*6b5e5868SGarrett D'Amore } 372*6b5e5868SGarrett D'Amore ; 373*6b5e5868SGarrett D'Amore 374*6b5e5868SGarrett D'Amore order_arg : order_arg T_COMMA order_dir 375*6b5e5868SGarrett D'Amore | order_dir 376*6b5e5868SGarrett D'Amore ; 377*6b5e5868SGarrett D'Amore 378*6b5e5868SGarrett D'Amore order_dir : T_FORWARD 379*6b5e5868SGarrett D'Amore { 380*6b5e5868SGarrett D'Amore add_order_bit(T_FORWARD); 381*6b5e5868SGarrett D'Amore } 382*6b5e5868SGarrett D'Amore | T_BACKWARD 383*6b5e5868SGarrett D'Amore { 384*6b5e5868SGarrett D'Amore add_order_bit(T_BACKWARD); 385*6b5e5868SGarrett D'Amore } 386*6b5e5868SGarrett D'Amore | T_POSITION 387*6b5e5868SGarrett D'Amore { 388*6b5e5868SGarrett D'Amore add_order_bit(T_POSITION); 389*6b5e5868SGarrett D'Amore } 390*6b5e5868SGarrett D'Amore ; 391*6b5e5868SGarrett D'Amore 392*6b5e5868SGarrett D'Amore order_list : order_list order_item 393*6b5e5868SGarrett D'Amore | order_item 394*6b5e5868SGarrett D'Amore ; 395*6b5e5868SGarrett D'Amore 396*6b5e5868SGarrett D'Amore order_item : T_COLLSYM T_NL 397*6b5e5868SGarrett D'Amore { 398*6b5e5868SGarrett D'Amore end_order_collsym($1); 399*6b5e5868SGarrett D'Amore } 400*6b5e5868SGarrett D'Amore | order_itemkw T_NL 401*6b5e5868SGarrett D'Amore { 402*6b5e5868SGarrett D'Amore end_order(); 403*6b5e5868SGarrett D'Amore } 404*6b5e5868SGarrett D'Amore | order_itemkw order_weights T_NL 405*6b5e5868SGarrett D'Amore { 406*6b5e5868SGarrett D'Amore end_order(); 407*6b5e5868SGarrett D'Amore } 408*6b5e5868SGarrett D'Amore ; 409*6b5e5868SGarrett D'Amore 410*6b5e5868SGarrett D'Amore order_itemkw : T_CHAR 411*6b5e5868SGarrett D'Amore { 412*6b5e5868SGarrett D'Amore start_order_char($1); 413*6b5e5868SGarrett D'Amore } 414*6b5e5868SGarrett D'Amore | T_ELLIPSIS 415*6b5e5868SGarrett D'Amore { 416*6b5e5868SGarrett D'Amore start_order_ellipsis(); 417*6b5e5868SGarrett D'Amore } 418*6b5e5868SGarrett D'Amore | T_COLLELEM 419*6b5e5868SGarrett D'Amore { 420*6b5e5868SGarrett D'Amore start_order_collelem($1); 421*6b5e5868SGarrett D'Amore } 422*6b5e5868SGarrett D'Amore | T_UNDEFINED 423*6b5e5868SGarrett D'Amore { 424*6b5e5868SGarrett D'Amore start_order_undefined(); 425*6b5e5868SGarrett D'Amore } 426*6b5e5868SGarrett D'Amore | T_SYMBOL 427*6b5e5868SGarrett D'Amore { 428*6b5e5868SGarrett D'Amore start_order_symbol($1); 429*6b5e5868SGarrett D'Amore } 430*6b5e5868SGarrett D'Amore ; 431*6b5e5868SGarrett D'Amore 432*6b5e5868SGarrett D'Amore order_weights : order_weights T_SEMI order_weight 433*6b5e5868SGarrett D'Amore | order_weights T_SEMI 434*6b5e5868SGarrett D'Amore | order_weight 435*6b5e5868SGarrett D'Amore ; 436*6b5e5868SGarrett D'Amore 437*6b5e5868SGarrett D'Amore order_weight : T_COLLELEM 438*6b5e5868SGarrett D'Amore { 439*6b5e5868SGarrett D'Amore add_order_collelem($1); 440*6b5e5868SGarrett D'Amore } 441*6b5e5868SGarrett D'Amore | T_COLLSYM 442*6b5e5868SGarrett D'Amore { 443*6b5e5868SGarrett D'Amore add_order_collsym($1); 444*6b5e5868SGarrett D'Amore } 445*6b5e5868SGarrett D'Amore | T_CHAR 446*6b5e5868SGarrett D'Amore { 447*6b5e5868SGarrett D'Amore add_order_char($1); 448*6b5e5868SGarrett D'Amore } 449*6b5e5868SGarrett D'Amore | T_ELLIPSIS 450*6b5e5868SGarrett D'Amore { 451*6b5e5868SGarrett D'Amore add_order_ellipsis(); 452*6b5e5868SGarrett D'Amore } 453*6b5e5868SGarrett D'Amore | T_IGNORE 454*6b5e5868SGarrett D'Amore { 455*6b5e5868SGarrett D'Amore add_order_ignore(); 456*6b5e5868SGarrett D'Amore } 457*6b5e5868SGarrett D'Amore | T_SYMBOL 458*6b5e5868SGarrett D'Amore { 459*6b5e5868SGarrett D'Amore add_order_symbol($1); 460*6b5e5868SGarrett D'Amore } 461*6b5e5868SGarrett D'Amore | T_QUOTE order_str T_QUOTE 462*6b5e5868SGarrett D'Amore { 463*6b5e5868SGarrett D'Amore add_order_subst(); 464*6b5e5868SGarrett D'Amore } 465*6b5e5868SGarrett D'Amore ; 466*6b5e5868SGarrett D'Amore 467*6b5e5868SGarrett D'Amore order_str : order_str order_stritem 468*6b5e5868SGarrett D'Amore | order_stritem 469*6b5e5868SGarrett D'Amore ; 470*6b5e5868SGarrett D'Amore 471*6b5e5868SGarrett D'Amore order_stritem : T_CHAR 472*6b5e5868SGarrett D'Amore { 473*6b5e5868SGarrett D'Amore add_subst_char($1); 474*6b5e5868SGarrett D'Amore } 475*6b5e5868SGarrett D'Amore | T_COLLSYM 476*6b5e5868SGarrett D'Amore { 477*6b5e5868SGarrett D'Amore add_subst_collsym($1); 478*6b5e5868SGarrett D'Amore } 479*6b5e5868SGarrett D'Amore | T_COLLELEM 480*6b5e5868SGarrett D'Amore { 481*6b5e5868SGarrett D'Amore add_subst_collelem($1); 482*6b5e5868SGarrett D'Amore } 483*6b5e5868SGarrett D'Amore | T_SYMBOL 484*6b5e5868SGarrett D'Amore { 485*6b5e5868SGarrett D'Amore add_subst_symbol($1); 486*6b5e5868SGarrett D'Amore } 487*6b5e5868SGarrett D'Amore ; 488*6b5e5868SGarrett D'Amore 489*6b5e5868SGarrett D'Amore messages : T_MESSAGES T_NL messages_list T_END T_MESSAGES T_NL 490*6b5e5868SGarrett D'Amore { 491*6b5e5868SGarrett D'Amore dump_messages(); 492*6b5e5868SGarrett D'Amore } 493*6b5e5868SGarrett D'Amore | T_MESSAGES T_NL copycat T_END T_MESSAGES T_NL 494*6b5e5868SGarrett D'Amore ; 495*6b5e5868SGarrett D'Amore 496*6b5e5868SGarrett D'Amore messages_list : messages_list messages_item 497*6b5e5868SGarrett D'Amore | messages_item 498*6b5e5868SGarrett D'Amore ; 499*6b5e5868SGarrett D'Amore 500*6b5e5868SGarrett D'Amore messages_kw : T_YESSTR 501*6b5e5868SGarrett D'Amore | T_NOSTR 502*6b5e5868SGarrett D'Amore | T_YESEXPR 503*6b5e5868SGarrett D'Amore | T_NOEXPR 504*6b5e5868SGarrett D'Amore ; 505*6b5e5868SGarrett D'Amore 506*6b5e5868SGarrett D'Amore messages_item : messages_kw string T_NL 507*6b5e5868SGarrett D'Amore { 508*6b5e5868SGarrett D'Amore add_message(get_wcs()); 509*6b5e5868SGarrett D'Amore } 510*6b5e5868SGarrett D'Amore ; 511*6b5e5868SGarrett D'Amore 512*6b5e5868SGarrett D'Amore monetary : T_MONETARY T_NL monetary_list T_END T_MONETARY T_NL 513*6b5e5868SGarrett D'Amore { 514*6b5e5868SGarrett D'Amore dump_monetary(); 515*6b5e5868SGarrett D'Amore } 516*6b5e5868SGarrett D'Amore | T_MONETARY T_NL copycat T_END T_MONETARY T_NL 517*6b5e5868SGarrett D'Amore ; 518*6b5e5868SGarrett D'Amore 519*6b5e5868SGarrett D'Amore monetary_list : monetary_list monetary_kw 520*6b5e5868SGarrett D'Amore | monetary_kw 521*6b5e5868SGarrett D'Amore ; 522*6b5e5868SGarrett D'Amore 523*6b5e5868SGarrett D'Amore monetary_strkw : T_INT_CURR_SYMBOL 524*6b5e5868SGarrett D'Amore | T_CURRENCY_SYMBOL 525*6b5e5868SGarrett D'Amore | T_MON_DECIMAL_POINT 526*6b5e5868SGarrett D'Amore | T_MON_THOUSANDS_SEP 527*6b5e5868SGarrett D'Amore | T_POSITIVE_SIGN 528*6b5e5868SGarrett D'Amore | T_NEGATIVE_SIGN 529*6b5e5868SGarrett D'Amore ; 530*6b5e5868SGarrett D'Amore 531*6b5e5868SGarrett D'Amore monetary_numkw : T_INT_FRAC_DIGITS 532*6b5e5868SGarrett D'Amore | T_FRAC_DIGITS 533*6b5e5868SGarrett D'Amore | T_P_CS_PRECEDES 534*6b5e5868SGarrett D'Amore | T_P_SEP_BY_SPACE 535*6b5e5868SGarrett D'Amore | T_N_CS_PRECEDES 536*6b5e5868SGarrett D'Amore | T_N_SEP_BY_SPACE 537*6b5e5868SGarrett D'Amore | T_P_SIGN_POSN 538*6b5e5868SGarrett D'Amore | T_N_SIGN_POSN 539*6b5e5868SGarrett D'Amore | T_INT_P_CS_PRECEDES 540*6b5e5868SGarrett D'Amore | T_INT_N_CS_PRECEDES 541*6b5e5868SGarrett D'Amore | T_INT_P_SEP_BY_SPACE 542*6b5e5868SGarrett D'Amore | T_INT_N_SEP_BY_SPACE 543*6b5e5868SGarrett D'Amore | T_INT_P_SIGN_POSN 544*6b5e5868SGarrett D'Amore | T_INT_N_SIGN_POSN 545*6b5e5868SGarrett D'Amore ; 546*6b5e5868SGarrett D'Amore 547*6b5e5868SGarrett D'Amore monetary_kw : monetary_strkw string T_NL 548*6b5e5868SGarrett D'Amore { 549*6b5e5868SGarrett D'Amore add_monetary_str(get_wcs()); 550*6b5e5868SGarrett D'Amore } 551*6b5e5868SGarrett D'Amore | monetary_numkw T_NUMBER T_NL 552*6b5e5868SGarrett D'Amore { 553*6b5e5868SGarrett D'Amore add_monetary_num($2); 554*6b5e5868SGarrett D'Amore } 555*6b5e5868SGarrett D'Amore | T_MON_GROUPING mon_group_list T_NL 556*6b5e5868SGarrett D'Amore ; 557*6b5e5868SGarrett D'Amore 558*6b5e5868SGarrett D'Amore mon_group_list : T_NUMBER 559*6b5e5868SGarrett D'Amore { 560*6b5e5868SGarrett D'Amore reset_monetary_group(); 561*6b5e5868SGarrett D'Amore add_monetary_group($1); 562*6b5e5868SGarrett D'Amore } 563*6b5e5868SGarrett D'Amore | mon_group_list T_SEMI T_NUMBER 564*6b5e5868SGarrett D'Amore { 565*6b5e5868SGarrett D'Amore add_monetary_group($3); 566*6b5e5868SGarrett D'Amore } 567*6b5e5868SGarrett D'Amore ; 568*6b5e5868SGarrett D'Amore 569*6b5e5868SGarrett D'Amore 570*6b5e5868SGarrett D'Amore numeric : T_NUMERIC T_NL numeric_list T_END T_NUMERIC T_NL 571*6b5e5868SGarrett D'Amore { 572*6b5e5868SGarrett D'Amore dump_numeric(); 573*6b5e5868SGarrett D'Amore } 574*6b5e5868SGarrett D'Amore | T_NUMERIC T_NL copycat T_END T_NUMERIC T_NL 575*6b5e5868SGarrett D'Amore ; 576*6b5e5868SGarrett D'Amore 577*6b5e5868SGarrett D'Amore 578*6b5e5868SGarrett D'Amore numeric_list : numeric_list numeric_item 579*6b5e5868SGarrett D'Amore | numeric_item 580*6b5e5868SGarrett D'Amore ; 581*6b5e5868SGarrett D'Amore 582*6b5e5868SGarrett D'Amore 583*6b5e5868SGarrett D'Amore numeric_item : numeric_strkw string T_NL 584*6b5e5868SGarrett D'Amore { 585*6b5e5868SGarrett D'Amore add_numeric_str(get_wcs()); 586*6b5e5868SGarrett D'Amore } 587*6b5e5868SGarrett D'Amore | T_GROUPING group_list T_NL 588*6b5e5868SGarrett D'Amore ; 589*6b5e5868SGarrett D'Amore 590*6b5e5868SGarrett D'Amore numeric_strkw : T_DECIMAL_POINT 591*6b5e5868SGarrett D'Amore | T_THOUSANDS_SEP 592*6b5e5868SGarrett D'Amore ; 593*6b5e5868SGarrett D'Amore 594*6b5e5868SGarrett D'Amore 595*6b5e5868SGarrett D'Amore group_list : T_NUMBER 596*6b5e5868SGarrett D'Amore { 597*6b5e5868SGarrett D'Amore reset_numeric_group(); 598*6b5e5868SGarrett D'Amore add_numeric_group($1); 599*6b5e5868SGarrett D'Amore } 600*6b5e5868SGarrett D'Amore | group_list T_SEMI T_NUMBER 601*6b5e5868SGarrett D'Amore { 602*6b5e5868SGarrett D'Amore add_numeric_group($3); 603*6b5e5868SGarrett D'Amore } 604*6b5e5868SGarrett D'Amore ; 605*6b5e5868SGarrett D'Amore 606*6b5e5868SGarrett D'Amore 607*6b5e5868SGarrett D'Amore time : T_TIME T_NL time_kwlist T_END T_TIME T_NL 608*6b5e5868SGarrett D'Amore { 609*6b5e5868SGarrett D'Amore dump_time(); 610*6b5e5868SGarrett D'Amore } 611*6b5e5868SGarrett D'Amore | T_TIME T_NL copycat T_END T_NUMERIC T_NL 612*6b5e5868SGarrett D'Amore ; 613*6b5e5868SGarrett D'Amore 614*6b5e5868SGarrett D'Amore time_kwlist : time_kwlist time_kw 615*6b5e5868SGarrett D'Amore | time_kw 616*6b5e5868SGarrett D'Amore ; 617*6b5e5868SGarrett D'Amore 618*6b5e5868SGarrett D'Amore time_kw : time_strkw string T_NL 619*6b5e5868SGarrett D'Amore { 620*6b5e5868SGarrett D'Amore add_time_str(get_wcs()); 621*6b5e5868SGarrett D'Amore } 622*6b5e5868SGarrett D'Amore | time_listkw time_list T_NL 623*6b5e5868SGarrett D'Amore { 624*6b5e5868SGarrett D'Amore check_time_list(); 625*6b5e5868SGarrett D'Amore } 626*6b5e5868SGarrett D'Amore ; 627*6b5e5868SGarrett D'Amore 628*6b5e5868SGarrett D'Amore time_listkw : T_ABDAY 629*6b5e5868SGarrett D'Amore | T_DAY 630*6b5e5868SGarrett D'Amore | T_ABMON 631*6b5e5868SGarrett D'Amore | T_MON 632*6b5e5868SGarrett D'Amore | T_ERA 633*6b5e5868SGarrett D'Amore | T_ALT_DIGITS 634*6b5e5868SGarrett D'Amore | T_AM_PM 635*6b5e5868SGarrett D'Amore ; 636*6b5e5868SGarrett D'Amore 637*6b5e5868SGarrett D'Amore time_strkw : T_ERA_D_T_FMT 638*6b5e5868SGarrett D'Amore | T_ERA_T_FMT 639*6b5e5868SGarrett D'Amore | T_ERA_D_FMT 640*6b5e5868SGarrett D'Amore | T_D_T_FMT 641*6b5e5868SGarrett D'Amore | T_D_FMT 642*6b5e5868SGarrett D'Amore | T_T_FMT 643*6b5e5868SGarrett D'Amore | T_T_FMT_AMPM 644*6b5e5868SGarrett D'Amore | T_DATE_FMT 645*6b5e5868SGarrett D'Amore ; 646*6b5e5868SGarrett D'Amore 647*6b5e5868SGarrett D'Amore time_list : time_list T_SEMI string 648*6b5e5868SGarrett D'Amore { 649*6b5e5868SGarrett D'Amore add_time_list(get_wcs()); 650*6b5e5868SGarrett D'Amore } 651*6b5e5868SGarrett D'Amore | string 652*6b5e5868SGarrett D'Amore { 653*6b5e5868SGarrett D'Amore reset_time_list(); 654*6b5e5868SGarrett D'Amore add_time_list(get_wcs()); 655*6b5e5868SGarrett D'Amore } 656*6b5e5868SGarrett D'Amore ; 657