xref: /titanic_53/usr/src/cmd/localedef/parser.y (revision 5aec55eb0591d2fcdd38d7dd5408a6ff3456e596)
16b5e5868SGarrett D'Amore %{
26b5e5868SGarrett D'Amore /*
36b5e5868SGarrett D'Amore  * This file and its contents are supplied under the terms of the
46b5e5868SGarrett D'Amore  * Common Development and Distribution License ("CDDL"), version 1.0.
5*5aec55ebSGarrett D'Amore  * You may only use this file in accordance with the terms of version
6*5aec55ebSGarrett D'Amore  * 1.0 of the CDDL.
76b5e5868SGarrett D'Amore  *
86b5e5868SGarrett D'Amore  * A full copy of the text of the CDDL should have accompanied this
96b5e5868SGarrett D'Amore  * source.  A copy of the CDDL is also available via the Internet at
106b5e5868SGarrett D'Amore  * http://www.illumos.org/license/CDDL.
116b5e5868SGarrett D'Amore  */
126b5e5868SGarrett D'Amore 
136b5e5868SGarrett D'Amore /*
146b5e5868SGarrett D'Amore  * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
156b5e5868SGarrett D'Amore  */
166b5e5868SGarrett D'Amore 
176b5e5868SGarrett D'Amore /*
186b5e5868SGarrett D'Amore  * POSIX localedef grammar.
196b5e5868SGarrett D'Amore  */
206b5e5868SGarrett D'Amore 
216b5e5868SGarrett D'Amore #include <wchar.h>
226b5e5868SGarrett D'Amore #include <stdio.h>
236b5e5868SGarrett D'Amore #include <limits.h>
246b5e5868SGarrett D'Amore #include "localedef.h"
256b5e5868SGarrett D'Amore 
266b5e5868SGarrett D'Amore %}
276b5e5868SGarrett D'Amore %union {
286b5e5868SGarrett D'Amore 	int		num;
296b5e5868SGarrett D'Amore 	wchar_t		wc;
306b5e5868SGarrett D'Amore 	char		*token;
316b5e5868SGarrett D'Amore 	collsym_t	*collsym;
326b5e5868SGarrett D'Amore 	collelem_t	*collelem;
336b5e5868SGarrett D'Amore }
346b5e5868SGarrett D'Amore 
356b5e5868SGarrett D'Amore %token		T_CODE_SET
366b5e5868SGarrett D'Amore %token		T_MB_CUR_MAX
376b5e5868SGarrett D'Amore %token		T_MB_CUR_MIN
386b5e5868SGarrett D'Amore %token		T_COM_CHAR
396b5e5868SGarrett D'Amore %token		T_ESC_CHAR
406b5e5868SGarrett D'Amore %token		T_LT
416b5e5868SGarrett D'Amore %token		T_GT
426b5e5868SGarrett D'Amore %token		T_NL
436b5e5868SGarrett D'Amore %token		T_SEMI
446b5e5868SGarrett D'Amore %token		T_COMMA
456b5e5868SGarrett D'Amore %token		T_ELLIPSIS
466b5e5868SGarrett D'Amore %token		T_RPAREN
476b5e5868SGarrett D'Amore %token		T_LPAREN
486b5e5868SGarrett D'Amore %token		T_QUOTE
496b5e5868SGarrett D'Amore %token		T_NULL
506b5e5868SGarrett D'Amore %token		T_WS
516b5e5868SGarrett D'Amore %token		T_END
526b5e5868SGarrett D'Amore %token		T_COPY
536b5e5868SGarrett D'Amore %token		T_CHARMAP
546b5e5868SGarrett D'Amore %token		T_WIDTH
556b5e5868SGarrett D'Amore %token		T_WIDTH_DEFAULT
566b5e5868SGarrett D'Amore %token		T_CTYPE
576b5e5868SGarrett D'Amore %token		T_ISUPPER
586b5e5868SGarrett D'Amore %token		T_ISLOWER
596b5e5868SGarrett D'Amore %token		T_ISALPHA
606b5e5868SGarrett D'Amore %token		T_ISDIGIT
616b5e5868SGarrett D'Amore %token		T_ISPUNCT
626b5e5868SGarrett D'Amore %token		T_ISXDIGIT
636b5e5868SGarrett D'Amore %token		T_ISSPACE
646b5e5868SGarrett D'Amore %token		T_ISPRINT
656b5e5868SGarrett D'Amore %token		T_ISGRAPH
666b5e5868SGarrett D'Amore %token		T_ISBLANK
676b5e5868SGarrett D'Amore %token		T_ISCNTRL
686b5e5868SGarrett D'Amore %token		T_ISALNUM
696b5e5868SGarrett D'Amore %token		T_ISSPECIAL
706b5e5868SGarrett D'Amore %token		T_ISPHONOGRAM
716b5e5868SGarrett D'Amore %token		T_ISIDEOGRAM
726b5e5868SGarrett D'Amore %token		T_ISENGLISH
736b5e5868SGarrett D'Amore %token		T_ISNUMBER
746b5e5868SGarrett D'Amore %token		T_TOUPPER
756b5e5868SGarrett D'Amore %token		T_TOLOWER
766b5e5868SGarrett D'Amore %token		T_COLLATE
776b5e5868SGarrett D'Amore %token		T_COLLATING_SYMBOL
786b5e5868SGarrett D'Amore %token		T_COLLATING_ELEMENT
796b5e5868SGarrett D'Amore %token		T_ORDER_START
806b5e5868SGarrett D'Amore %token		T_ORDER_END
816b5e5868SGarrett D'Amore %token		T_FORWARD
826b5e5868SGarrett D'Amore %token		T_BACKWARD
836b5e5868SGarrett D'Amore %token		T_POSITION
846b5e5868SGarrett D'Amore %token		T_FROM
856b5e5868SGarrett D'Amore %token		T_UNDEFINED
866b5e5868SGarrett D'Amore %token		T_IGNORE
876b5e5868SGarrett D'Amore %token		T_MESSAGES
886b5e5868SGarrett D'Amore %token		T_YESSTR
896b5e5868SGarrett D'Amore %token		T_NOSTR
906b5e5868SGarrett D'Amore %token		T_YESEXPR
916b5e5868SGarrett D'Amore %token		T_NOEXPR
926b5e5868SGarrett D'Amore %token		T_MONETARY
936b5e5868SGarrett D'Amore %token		T_INT_CURR_SYMBOL
946b5e5868SGarrett D'Amore %token		T_CURRENCY_SYMBOL
956b5e5868SGarrett D'Amore %token		T_MON_DECIMAL_POINT
966b5e5868SGarrett D'Amore %token		T_MON_THOUSANDS_SEP
976b5e5868SGarrett D'Amore %token		T_POSITIVE_SIGN
986b5e5868SGarrett D'Amore %token		T_NEGATIVE_SIGN
996b5e5868SGarrett D'Amore %token		T_MON_GROUPING
1006b5e5868SGarrett D'Amore %token		T_INT_FRAC_DIGITS
1016b5e5868SGarrett D'Amore %token		T_FRAC_DIGITS
1026b5e5868SGarrett D'Amore %token		T_P_CS_PRECEDES
1036b5e5868SGarrett D'Amore %token		T_P_SEP_BY_SPACE
1046b5e5868SGarrett D'Amore %token		T_N_CS_PRECEDES
1056b5e5868SGarrett D'Amore %token		T_N_SEP_BY_SPACE
1066b5e5868SGarrett D'Amore %token		T_P_SIGN_POSN
1076b5e5868SGarrett D'Amore %token		T_N_SIGN_POSN
1086b5e5868SGarrett D'Amore %token		T_INT_P_CS_PRECEDES
1096b5e5868SGarrett D'Amore %token		T_INT_N_CS_PRECEDES
1106b5e5868SGarrett D'Amore %token		T_INT_P_SEP_BY_SPACE
1116b5e5868SGarrett D'Amore %token		T_INT_N_SEP_BY_SPACE
1126b5e5868SGarrett D'Amore %token		T_INT_P_SIGN_POSN
1136b5e5868SGarrett D'Amore %token		T_INT_N_SIGN_POSN
1146b5e5868SGarrett D'Amore %token		T_NUMERIC
1156b5e5868SGarrett D'Amore %token		T_DECIMAL_POINT
1166b5e5868SGarrett D'Amore %token		T_THOUSANDS_SEP
1176b5e5868SGarrett D'Amore %token		T_GROUPING
1186b5e5868SGarrett D'Amore %token		T_TIME
1196b5e5868SGarrett D'Amore %token		T_ABDAY
1206b5e5868SGarrett D'Amore %token		T_DAY
1216b5e5868SGarrett D'Amore %token		T_ABMON
1226b5e5868SGarrett D'Amore %token		T_MON
1236b5e5868SGarrett D'Amore %token		T_ERA
1246b5e5868SGarrett D'Amore %token		T_ERA_D_FMT
1256b5e5868SGarrett D'Amore %token		T_ERA_T_FMT
1266b5e5868SGarrett D'Amore %token		T_ERA_D_T_FMT
1276b5e5868SGarrett D'Amore %token		T_ALT_DIGITS
1286b5e5868SGarrett D'Amore %token		T_D_T_FMT
1296b5e5868SGarrett D'Amore %token		T_D_FMT
1306b5e5868SGarrett D'Amore %token		T_T_FMT
1316b5e5868SGarrett D'Amore %token		T_AM_PM
1326b5e5868SGarrett D'Amore %token		T_T_FMT_AMPM
1336b5e5868SGarrett D'Amore %token		T_DATE_FMT
1346b5e5868SGarrett D'Amore %token	<wc>		T_CHAR
1356b5e5868SGarrett D'Amore %token	<token>		T_NAME
1366b5e5868SGarrett D'Amore %token	<num>		T_NUMBER
1376b5e5868SGarrett D'Amore %token	<token>		T_SYMBOL
1386b5e5868SGarrett D'Amore %token	<collsym>	T_COLLSYM
1396b5e5868SGarrett D'Amore %token	<collelem>	T_COLLELEM
1406b5e5868SGarrett D'Amore 
1416b5e5868SGarrett D'Amore %%
1426b5e5868SGarrett D'Amore 
1436b5e5868SGarrett D'Amore localedef	: setting_list categories
1446b5e5868SGarrett D'Amore 		| categories
1456b5e5868SGarrett D'Amore 		;
1466b5e5868SGarrett D'Amore 
1476b5e5868SGarrett D'Amore string		: T_QUOTE charlist T_QUOTE
1486b5e5868SGarrett D'Amore 		| T_QUOTE T_QUOTE
1496b5e5868SGarrett D'Amore 		;
1506b5e5868SGarrett D'Amore 
1516b5e5868SGarrett D'Amore charlist	: charlist T_CHAR
1526b5e5868SGarrett D'Amore 		{
1536b5e5868SGarrett D'Amore 			add_wcs($2);
1546b5e5868SGarrett D'Amore 		}
1556b5e5868SGarrett D'Amore 		| T_CHAR
1566b5e5868SGarrett D'Amore 		{
1576b5e5868SGarrett D'Amore 			add_wcs($1);
1586b5e5868SGarrett D'Amore 		}
1596b5e5868SGarrett D'Amore 		;
1606b5e5868SGarrett D'Amore 
1616b5e5868SGarrett D'Amore setting_list	: setting_list setting
1626b5e5868SGarrett D'Amore 		| setting
1636b5e5868SGarrett D'Amore 		;
1646b5e5868SGarrett D'Amore 
1656b5e5868SGarrett D'Amore 
1666b5e5868SGarrett D'Amore setting		: T_COM_CHAR T_CHAR T_NL
1676b5e5868SGarrett D'Amore 		{
1686b5e5868SGarrett D'Amore 			com_char = $2;
1696b5e5868SGarrett D'Amore 		}
1706b5e5868SGarrett D'Amore 		| T_ESC_CHAR T_CHAR T_NL
1716b5e5868SGarrett D'Amore 		{
1726b5e5868SGarrett D'Amore 			esc_char = $2;
1736b5e5868SGarrett D'Amore 		}
1746b5e5868SGarrett D'Amore 		| T_MB_CUR_MAX T_NUMBER T_NL
1756b5e5868SGarrett D'Amore 		{
1766b5e5868SGarrett D'Amore 			mb_cur_max = $2;
1776b5e5868SGarrett D'Amore 		}
1786b5e5868SGarrett D'Amore 		| T_MB_CUR_MIN T_NUMBER T_NL
1796b5e5868SGarrett D'Amore 		{
1806b5e5868SGarrett D'Amore 			mb_cur_min = $2;
1816b5e5868SGarrett D'Amore 		}
1826b5e5868SGarrett D'Amore 		| T_CODE_SET string T_NL
1836b5e5868SGarrett D'Amore 		{
1846b5e5868SGarrett D'Amore 			wchar_t *w = get_wcs();
1856b5e5868SGarrett D'Amore 			set_wide_encoding(to_mb_string(w));
1866b5e5868SGarrett D'Amore 			free(w);
1876b5e5868SGarrett D'Amore 		}
1886b5e5868SGarrett D'Amore 		| T_CODE_SET T_NAME T_NL
1896b5e5868SGarrett D'Amore 		{
1906b5e5868SGarrett D'Amore 			set_wide_encoding($2);
1916b5e5868SGarrett D'Amore 		}
1926b5e5868SGarrett D'Amore 		;
1936b5e5868SGarrett D'Amore 
1946b5e5868SGarrett D'Amore copycat		: T_COPY T_NAME T_NL
1956b5e5868SGarrett D'Amore 		{
1966b5e5868SGarrett D'Amore 			copy_category($2);
1976b5e5868SGarrett D'Amore 		}
1986b5e5868SGarrett D'Amore 		| T_COPY string T_NL
1996b5e5868SGarrett D'Amore 		{
2006b5e5868SGarrett D'Amore 			wchar_t *w = get_wcs();
2016b5e5868SGarrett D'Amore 			copy_category(to_mb_string(w));
2026b5e5868SGarrett D'Amore 			free(w);
2036b5e5868SGarrett D'Amore 		}
2046b5e5868SGarrett D'Amore 		;
2056b5e5868SGarrett D'Amore 
2066b5e5868SGarrett D'Amore categories	: categories category
2076b5e5868SGarrett D'Amore 		| category
2086b5e5868SGarrett D'Amore 		;
2096b5e5868SGarrett D'Amore 
2106b5e5868SGarrett D'Amore 
2116b5e5868SGarrett D'Amore category	: charmap
2126b5e5868SGarrett D'Amore 		| messages
2136b5e5868SGarrett D'Amore 		| monetary
2146b5e5868SGarrett D'Amore 		| ctype
2156b5e5868SGarrett D'Amore 		| collate
2166b5e5868SGarrett D'Amore 		| numeric
2176b5e5868SGarrett D'Amore 		| time
2186b5e5868SGarrett D'Amore 		;
2196b5e5868SGarrett D'Amore 
2206b5e5868SGarrett D'Amore 
2216b5e5868SGarrett D'Amore charmap		: T_CHARMAP T_NL charmap_list T_END T_CHARMAP T_NL
2226b5e5868SGarrett D'Amore 
2236b5e5868SGarrett D'Amore 
2246b5e5868SGarrett D'Amore charmap_list	: charmap_list charmap_entry
2256b5e5868SGarrett D'Amore 		| charmap_entry
2266b5e5868SGarrett D'Amore 		;
2276b5e5868SGarrett D'Amore 
2286b5e5868SGarrett D'Amore 
2296b5e5868SGarrett D'Amore charmap_entry	: T_SYMBOL T_CHAR
2306b5e5868SGarrett D'Amore 		{
2316b5e5868SGarrett D'Amore 			add_charmap($1, $2);
2326b5e5868SGarrett D'Amore 			scan_to_eol();
2336b5e5868SGarrett D'Amore 		}
2346b5e5868SGarrett D'Amore 		| T_SYMBOL T_ELLIPSIS T_SYMBOL T_CHAR
2356b5e5868SGarrett D'Amore 		{
2366b5e5868SGarrett D'Amore 			add_charmap_range($1, $3, $4);
2376b5e5868SGarrett D'Amore 			scan_to_eol();
2386b5e5868SGarrett D'Amore 		}
2396b5e5868SGarrett D'Amore 		| T_NL
2406b5e5868SGarrett D'Amore 		;
2416b5e5868SGarrett D'Amore 
2426b5e5868SGarrett D'Amore ctype		: T_CTYPE T_NL ctype_list T_END T_CTYPE T_NL
2436b5e5868SGarrett D'Amore 		{
2446b5e5868SGarrett D'Amore 			dump_ctype();
2456b5e5868SGarrett D'Amore 		}
2466b5e5868SGarrett D'Amore 		| T_CTYPE T_NL copycat  T_END T_CTYPE T_NL
2476b5e5868SGarrett D'Amore 		;
2486b5e5868SGarrett D'Amore 
2496b5e5868SGarrett D'Amore ctype_list	: ctype_list ctype_kw
2506b5e5868SGarrett D'Amore 		| ctype_kw
2516b5e5868SGarrett D'Amore 		;
2526b5e5868SGarrett D'Amore 
2536b5e5868SGarrett D'Amore ctype_kw	: T_ISUPPER cc_list T_NL
2546b5e5868SGarrett D'Amore 		| T_ISLOWER cc_list T_NL
2556b5e5868SGarrett D'Amore 		| T_ISALPHA cc_list T_NL
2566b5e5868SGarrett D'Amore 		| T_ISDIGIT cc_list T_NL
2576b5e5868SGarrett D'Amore 		| T_ISPUNCT cc_list T_NL
2586b5e5868SGarrett D'Amore 		| T_ISXDIGIT cc_list T_NL
2596b5e5868SGarrett D'Amore 		| T_ISSPACE cc_list T_NL
2606b5e5868SGarrett D'Amore 		| T_ISPRINT cc_list T_NL
2616b5e5868SGarrett D'Amore 		| T_ISGRAPH cc_list T_NL
2626b5e5868SGarrett D'Amore 		| T_ISBLANK cc_list T_NL
2636b5e5868SGarrett D'Amore 		| T_ISCNTRL cc_list T_NL
2646b5e5868SGarrett D'Amore 		| T_ISALNUM cc_list T_NL
2656b5e5868SGarrett D'Amore 		| T_ISSPECIAL cc_list T_NL
2666b5e5868SGarrett D'Amore 		| T_ISENGLISH cc_list T_NL
2676b5e5868SGarrett D'Amore 		| T_ISNUMBER cc_list T_NL
2686b5e5868SGarrett D'Amore 		| T_ISIDEOGRAM cc_list T_NL
2696b5e5868SGarrett D'Amore 		| T_ISPHONOGRAM cc_list T_NL
2706b5e5868SGarrett D'Amore 		| T_TOUPPER conv_list T_NL
2716b5e5868SGarrett D'Amore 		| T_TOLOWER conv_list T_NL
2726b5e5868SGarrett D'Amore 		;
2736b5e5868SGarrett D'Amore 
2746b5e5868SGarrett D'Amore 
2756b5e5868SGarrett D'Amore cc_list		: cc_list T_SEMI T_CHAR
2766b5e5868SGarrett D'Amore 		{
2776b5e5868SGarrett D'Amore 			add_ctype($3);
2786b5e5868SGarrett D'Amore 		}
2796b5e5868SGarrett D'Amore 		| cc_list T_SEMI T_SYMBOL
2806b5e5868SGarrett D'Amore 		{
2816b5e5868SGarrett D'Amore 			add_charmap_undefined($3);
2826b5e5868SGarrett D'Amore 		}
2836b5e5868SGarrett D'Amore 		| cc_list T_SEMI T_ELLIPSIS T_SEMI T_CHAR
2846b5e5868SGarrett D'Amore 		{
2856b5e5868SGarrett D'Amore 			/* note that the endpoints *must* be characters */
2866b5e5868SGarrett D'Amore 			add_ctype_range($5);
2876b5e5868SGarrett D'Amore 		}
2886b5e5868SGarrett D'Amore 		| T_CHAR
2896b5e5868SGarrett D'Amore 		{
2906b5e5868SGarrett D'Amore 			add_ctype($1);
2916b5e5868SGarrett D'Amore 		}
2926b5e5868SGarrett D'Amore 		| T_SYMBOL
2936b5e5868SGarrett D'Amore 		{
2946b5e5868SGarrett D'Amore 			add_charmap_undefined($1);
2956b5e5868SGarrett D'Amore 		}
2966b5e5868SGarrett D'Amore 		;
2976b5e5868SGarrett D'Amore 
2986b5e5868SGarrett D'Amore conv_list	: conv_list T_SEMI conv_pair
2996b5e5868SGarrett D'Amore 		| conv_pair
3006b5e5868SGarrett D'Amore 		;
3016b5e5868SGarrett D'Amore 
3026b5e5868SGarrett D'Amore 
3036b5e5868SGarrett D'Amore conv_pair	: T_LPAREN T_CHAR T_COMMA T_CHAR T_RPAREN
3046b5e5868SGarrett D'Amore 		{
3056b5e5868SGarrett D'Amore 			add_caseconv($2, $4);
3066b5e5868SGarrett D'Amore 		}
3076b5e5868SGarrett D'Amore 		| T_LPAREN T_SYMBOL T_COMMA T_CHAR T_RPAREN
3086b5e5868SGarrett D'Amore 		{
3096b5e5868SGarrett D'Amore 			add_charmap_undefined($2);
3106b5e5868SGarrett D'Amore 		}
3116b5e5868SGarrett D'Amore 		| T_LPAREN T_SYMBOL T_COMMA T_SYMBOL T_RPAREN
3126b5e5868SGarrett D'Amore 		{
3136b5e5868SGarrett D'Amore 			add_charmap_undefined($2);
3146b5e5868SGarrett D'Amore 			add_charmap_undefined($4);
3156b5e5868SGarrett D'Amore 		}
3166b5e5868SGarrett D'Amore 		| T_LPAREN T_CHAR T_COMMA T_SYMBOL T_RPAREN
3176b5e5868SGarrett D'Amore 		{
3186b5e5868SGarrett D'Amore 			add_charmap_undefined($4);
3196b5e5868SGarrett D'Amore 		}
3206b5e5868SGarrett D'Amore 		;
3216b5e5868SGarrett D'Amore 
3226b5e5868SGarrett D'Amore collate		: T_COLLATE T_NL coll_order T_END T_COLLATE T_NL
3236b5e5868SGarrett D'Amore 		{
3246b5e5868SGarrett D'Amore 			dump_collate();
3256b5e5868SGarrett D'Amore 		}
3266b5e5868SGarrett D'Amore 		| T_COLLATE T_NL coll_optional coll_order T_END T_COLLATE T_NL
3276b5e5868SGarrett D'Amore 		{
3286b5e5868SGarrett D'Amore 			dump_collate();
3296b5e5868SGarrett D'Amore 		}
3306b5e5868SGarrett D'Amore 		| T_COLLATE T_NL copycat T_END T_COLLATE T_NL
3316b5e5868SGarrett D'Amore 		;
3326b5e5868SGarrett D'Amore 
3336b5e5868SGarrett D'Amore 
3346b5e5868SGarrett D'Amore coll_optional	: coll_optional coll_symbols
3356b5e5868SGarrett D'Amore 		| coll_optional coll_elements
3366b5e5868SGarrett D'Amore 		| coll_symbols
3376b5e5868SGarrett D'Amore 		| coll_elements
3386b5e5868SGarrett D'Amore 		;
3396b5e5868SGarrett D'Amore 
3406b5e5868SGarrett D'Amore 
3416b5e5868SGarrett D'Amore coll_symbols	: T_COLLATING_SYMBOL T_SYMBOL T_NL
3426b5e5868SGarrett D'Amore 		{
3436b5e5868SGarrett D'Amore 			define_collsym($2);
3446b5e5868SGarrett D'Amore 		}
3456b5e5868SGarrett D'Amore 		;
3466b5e5868SGarrett D'Amore 
3476b5e5868SGarrett D'Amore 
3486b5e5868SGarrett D'Amore coll_elements	: T_COLLATING_ELEMENT T_SYMBOL T_FROM string T_NL
3496b5e5868SGarrett D'Amore 		{
3506b5e5868SGarrett D'Amore 			define_collelem($2, get_wcs());
3516b5e5868SGarrett D'Amore 		}
3526b5e5868SGarrett D'Amore 		;
3536b5e5868SGarrett D'Amore 
3546b5e5868SGarrett D'Amore coll_order	: T_ORDER_START T_NL order_list T_ORDER_END T_NL
3556b5e5868SGarrett D'Amore 		{
3566b5e5868SGarrett D'Amore 			/* If no order list supplied default to one forward */
3576b5e5868SGarrett D'Amore 			add_order_bit(T_FORWARD);
3586b5e5868SGarrett D'Amore 			add_order_directive();
3596b5e5868SGarrett D'Amore 		}
3606b5e5868SGarrett D'Amore 		| T_ORDER_START order_args T_NL order_list T_ORDER_END T_NL
3616b5e5868SGarrett D'Amore 		;
3626b5e5868SGarrett D'Amore 
3636b5e5868SGarrett D'Amore 
3646b5e5868SGarrett D'Amore order_args	: order_args T_SEMI order_arg
3656b5e5868SGarrett D'Amore 		{
3666b5e5868SGarrett D'Amore 			add_order_directive();
3676b5e5868SGarrett D'Amore 		}
3686b5e5868SGarrett D'Amore 		| order_arg
3696b5e5868SGarrett D'Amore 		{
3706b5e5868SGarrett D'Amore 			add_order_directive();
3716b5e5868SGarrett D'Amore 		}
3726b5e5868SGarrett D'Amore 		;
3736b5e5868SGarrett D'Amore 
3746b5e5868SGarrett D'Amore order_arg	: order_arg T_COMMA order_dir
3756b5e5868SGarrett D'Amore 		| order_dir
3766b5e5868SGarrett D'Amore 		;
3776b5e5868SGarrett D'Amore 
3786b5e5868SGarrett D'Amore order_dir	: T_FORWARD
3796b5e5868SGarrett D'Amore 		{
3806b5e5868SGarrett D'Amore 			add_order_bit(T_FORWARD);
3816b5e5868SGarrett D'Amore 		}
3826b5e5868SGarrett D'Amore 		| T_BACKWARD
3836b5e5868SGarrett D'Amore 		{
3846b5e5868SGarrett D'Amore 			add_order_bit(T_BACKWARD);
3856b5e5868SGarrett D'Amore 		}
3866b5e5868SGarrett D'Amore 		| T_POSITION
3876b5e5868SGarrett D'Amore 		{
3886b5e5868SGarrett D'Amore 			add_order_bit(T_POSITION);
3896b5e5868SGarrett D'Amore 		}
3906b5e5868SGarrett D'Amore 		;
3916b5e5868SGarrett D'Amore 
3926b5e5868SGarrett D'Amore order_list	: order_list order_item
3936b5e5868SGarrett D'Amore 		| order_item
3946b5e5868SGarrett D'Amore 		;
3956b5e5868SGarrett D'Amore 
3966b5e5868SGarrett D'Amore order_item	: T_COLLSYM T_NL
3976b5e5868SGarrett D'Amore 		{
3986b5e5868SGarrett D'Amore 			end_order_collsym($1);
3996b5e5868SGarrett D'Amore 		}
4006b5e5868SGarrett D'Amore 		| order_itemkw T_NL
4016b5e5868SGarrett D'Amore 		{
4026b5e5868SGarrett D'Amore 			end_order();
4036b5e5868SGarrett D'Amore 		}
4046b5e5868SGarrett D'Amore 		| order_itemkw order_weights T_NL
4056b5e5868SGarrett D'Amore 		{
4066b5e5868SGarrett D'Amore 			end_order();
4076b5e5868SGarrett D'Amore 		}
4086b5e5868SGarrett D'Amore 		;
4096b5e5868SGarrett D'Amore 
4106b5e5868SGarrett D'Amore order_itemkw	: T_CHAR
4116b5e5868SGarrett D'Amore 		{
4126b5e5868SGarrett D'Amore 			start_order_char($1);
4136b5e5868SGarrett D'Amore 		}
4146b5e5868SGarrett D'Amore 		| T_ELLIPSIS
4156b5e5868SGarrett D'Amore 		{
4166b5e5868SGarrett D'Amore 			start_order_ellipsis();
4176b5e5868SGarrett D'Amore 		}
4186b5e5868SGarrett D'Amore 		| T_COLLELEM
4196b5e5868SGarrett D'Amore 		{
4206b5e5868SGarrett D'Amore 			start_order_collelem($1);
4216b5e5868SGarrett D'Amore 		}
4226b5e5868SGarrett D'Amore 		| T_UNDEFINED
4236b5e5868SGarrett D'Amore 		{
4246b5e5868SGarrett D'Amore 			start_order_undefined();
4256b5e5868SGarrett D'Amore 		}
4266b5e5868SGarrett D'Amore 		| T_SYMBOL
4276b5e5868SGarrett D'Amore 		{
4286b5e5868SGarrett D'Amore 			start_order_symbol($1);
4296b5e5868SGarrett D'Amore 		}
4306b5e5868SGarrett D'Amore 		;
4316b5e5868SGarrett D'Amore 
4326b5e5868SGarrett D'Amore order_weights	: order_weights T_SEMI order_weight
4336b5e5868SGarrett D'Amore 		| order_weights T_SEMI
4346b5e5868SGarrett D'Amore 		| order_weight
4356b5e5868SGarrett D'Amore 		;
4366b5e5868SGarrett D'Amore 
4376b5e5868SGarrett D'Amore order_weight	: T_COLLELEM
4386b5e5868SGarrett D'Amore 		{
4396b5e5868SGarrett D'Amore 			add_order_collelem($1);
4406b5e5868SGarrett D'Amore 		}
4416b5e5868SGarrett D'Amore 		| T_COLLSYM
4426b5e5868SGarrett D'Amore 		{
4436b5e5868SGarrett D'Amore 			add_order_collsym($1);
4446b5e5868SGarrett D'Amore 		}
4456b5e5868SGarrett D'Amore 		| T_CHAR
4466b5e5868SGarrett D'Amore 		{
4476b5e5868SGarrett D'Amore 			add_order_char($1);
4486b5e5868SGarrett D'Amore 		}
4496b5e5868SGarrett D'Amore 		| T_ELLIPSIS
4506b5e5868SGarrett D'Amore 		{
4516b5e5868SGarrett D'Amore 			add_order_ellipsis();
4526b5e5868SGarrett D'Amore 		}
4536b5e5868SGarrett D'Amore 		| T_IGNORE
4546b5e5868SGarrett D'Amore 		{
4556b5e5868SGarrett D'Amore 			add_order_ignore();
4566b5e5868SGarrett D'Amore 		}
4576b5e5868SGarrett D'Amore 		| T_SYMBOL
4586b5e5868SGarrett D'Amore 		{
4596b5e5868SGarrett D'Amore 			add_order_symbol($1);
4606b5e5868SGarrett D'Amore 		}
4616b5e5868SGarrett D'Amore 		| T_QUOTE order_str T_QUOTE
4626b5e5868SGarrett D'Amore 		{
4636b5e5868SGarrett D'Amore 			add_order_subst();
4646b5e5868SGarrett D'Amore 		}
4656b5e5868SGarrett D'Amore 		;
4666b5e5868SGarrett D'Amore 
4676b5e5868SGarrett D'Amore order_str	: order_str order_stritem
4686b5e5868SGarrett D'Amore 		| order_stritem
4696b5e5868SGarrett D'Amore 		;
4706b5e5868SGarrett D'Amore 
4716b5e5868SGarrett D'Amore order_stritem	: T_CHAR
4726b5e5868SGarrett D'Amore 		{
4736b5e5868SGarrett D'Amore 			add_subst_char($1);
4746b5e5868SGarrett D'Amore 		}
4756b5e5868SGarrett D'Amore 		| T_COLLSYM
4766b5e5868SGarrett D'Amore 		{
4776b5e5868SGarrett D'Amore 			add_subst_collsym($1);
4786b5e5868SGarrett D'Amore 		}
4796b5e5868SGarrett D'Amore 		| T_COLLELEM
4806b5e5868SGarrett D'Amore 		{
4816b5e5868SGarrett D'Amore 			add_subst_collelem($1);
4826b5e5868SGarrett D'Amore 		}
4836b5e5868SGarrett D'Amore 		| T_SYMBOL
4846b5e5868SGarrett D'Amore 		{
4856b5e5868SGarrett D'Amore 			add_subst_symbol($1);
4866b5e5868SGarrett D'Amore 		}
4876b5e5868SGarrett D'Amore 		;
4886b5e5868SGarrett D'Amore 
4896b5e5868SGarrett D'Amore messages	: T_MESSAGES T_NL messages_list T_END T_MESSAGES T_NL
4906b5e5868SGarrett D'Amore 		{
4916b5e5868SGarrett D'Amore 			dump_messages();
4926b5e5868SGarrett D'Amore 		}
4936b5e5868SGarrett D'Amore 		| T_MESSAGES T_NL copycat T_END T_MESSAGES T_NL
4946b5e5868SGarrett D'Amore 		;
4956b5e5868SGarrett D'Amore 
4966b5e5868SGarrett D'Amore messages_list	: messages_list messages_item
4976b5e5868SGarrett D'Amore 		| messages_item
4986b5e5868SGarrett D'Amore 		;
4996b5e5868SGarrett D'Amore 
5006b5e5868SGarrett D'Amore messages_kw	: T_YESSTR
5016b5e5868SGarrett D'Amore 		| T_NOSTR
5026b5e5868SGarrett D'Amore 		| T_YESEXPR
5036b5e5868SGarrett D'Amore 		| T_NOEXPR
5046b5e5868SGarrett D'Amore 		;
5056b5e5868SGarrett D'Amore 
5066b5e5868SGarrett D'Amore messages_item	: messages_kw string T_NL
5076b5e5868SGarrett D'Amore 		{
5086b5e5868SGarrett D'Amore 			add_message(get_wcs());
5096b5e5868SGarrett D'Amore 		}
5106b5e5868SGarrett D'Amore 		;
5116b5e5868SGarrett D'Amore 
5126b5e5868SGarrett D'Amore monetary	: T_MONETARY T_NL monetary_list T_END T_MONETARY T_NL
5136b5e5868SGarrett D'Amore 		{
5146b5e5868SGarrett D'Amore 			dump_monetary();
5156b5e5868SGarrett D'Amore 		}
5166b5e5868SGarrett D'Amore 		| T_MONETARY T_NL copycat T_END T_MONETARY T_NL
5176b5e5868SGarrett D'Amore 		;
5186b5e5868SGarrett D'Amore 
5196b5e5868SGarrett D'Amore monetary_list	: monetary_list monetary_kw
5206b5e5868SGarrett D'Amore 		| monetary_kw
5216b5e5868SGarrett D'Amore 		;
5226b5e5868SGarrett D'Amore 
5236b5e5868SGarrett D'Amore monetary_strkw	: T_INT_CURR_SYMBOL
5246b5e5868SGarrett D'Amore 		| T_CURRENCY_SYMBOL
5256b5e5868SGarrett D'Amore 		| T_MON_DECIMAL_POINT
5266b5e5868SGarrett D'Amore 		| T_MON_THOUSANDS_SEP
5276b5e5868SGarrett D'Amore 		| T_POSITIVE_SIGN
5286b5e5868SGarrett D'Amore 		| T_NEGATIVE_SIGN
5296b5e5868SGarrett D'Amore 		;
5306b5e5868SGarrett D'Amore 
5316b5e5868SGarrett D'Amore monetary_numkw	: T_INT_FRAC_DIGITS
5326b5e5868SGarrett D'Amore 		| T_FRAC_DIGITS
5336b5e5868SGarrett D'Amore 		| T_P_CS_PRECEDES
5346b5e5868SGarrett D'Amore 		| T_P_SEP_BY_SPACE
5356b5e5868SGarrett D'Amore 		| T_N_CS_PRECEDES
5366b5e5868SGarrett D'Amore 		| T_N_SEP_BY_SPACE
5376b5e5868SGarrett D'Amore 		| T_P_SIGN_POSN
5386b5e5868SGarrett D'Amore 		| T_N_SIGN_POSN
5396b5e5868SGarrett D'Amore 		| T_INT_P_CS_PRECEDES
5406b5e5868SGarrett D'Amore 		| T_INT_N_CS_PRECEDES
5416b5e5868SGarrett D'Amore 		| T_INT_P_SEP_BY_SPACE
5426b5e5868SGarrett D'Amore 		| T_INT_N_SEP_BY_SPACE
5436b5e5868SGarrett D'Amore 		| T_INT_P_SIGN_POSN
5446b5e5868SGarrett D'Amore 		| T_INT_N_SIGN_POSN
5456b5e5868SGarrett D'Amore 		;
5466b5e5868SGarrett D'Amore 
5476b5e5868SGarrett D'Amore monetary_kw	: monetary_strkw string T_NL
5486b5e5868SGarrett D'Amore 		{
5496b5e5868SGarrett D'Amore 			add_monetary_str(get_wcs());
5506b5e5868SGarrett D'Amore 		}
5516b5e5868SGarrett D'Amore 		| monetary_numkw T_NUMBER T_NL
5526b5e5868SGarrett D'Amore 		{
5536b5e5868SGarrett D'Amore 			add_monetary_num($2);
5546b5e5868SGarrett D'Amore 		}
5556b5e5868SGarrett D'Amore 		| T_MON_GROUPING mon_group_list T_NL
5566b5e5868SGarrett D'Amore 		;
5576b5e5868SGarrett D'Amore 
5586b5e5868SGarrett D'Amore mon_group_list	: T_NUMBER
5596b5e5868SGarrett D'Amore 		{
5606b5e5868SGarrett D'Amore 			reset_monetary_group();
5616b5e5868SGarrett D'Amore 			add_monetary_group($1);
5626b5e5868SGarrett D'Amore 		}
5636b5e5868SGarrett D'Amore 		| mon_group_list T_SEMI T_NUMBER
5646b5e5868SGarrett D'Amore 		{
5656b5e5868SGarrett D'Amore 			add_monetary_group($3);
5666b5e5868SGarrett D'Amore 		}
5676b5e5868SGarrett D'Amore 		;
5686b5e5868SGarrett D'Amore 
5696b5e5868SGarrett D'Amore 
5706b5e5868SGarrett D'Amore numeric		: T_NUMERIC T_NL numeric_list T_END T_NUMERIC T_NL
5716b5e5868SGarrett D'Amore 		{
5726b5e5868SGarrett D'Amore 			dump_numeric();
5736b5e5868SGarrett D'Amore 		}
5746b5e5868SGarrett D'Amore 		| T_NUMERIC T_NL copycat T_END T_NUMERIC T_NL
5756b5e5868SGarrett D'Amore 		;
5766b5e5868SGarrett D'Amore 
5776b5e5868SGarrett D'Amore 
5786b5e5868SGarrett D'Amore numeric_list	: numeric_list numeric_item
5796b5e5868SGarrett D'Amore 		| numeric_item
5806b5e5868SGarrett D'Amore 		;
5816b5e5868SGarrett D'Amore 
5826b5e5868SGarrett D'Amore 
5836b5e5868SGarrett D'Amore numeric_item	: numeric_strkw string T_NL
5846b5e5868SGarrett D'Amore 		{
5856b5e5868SGarrett D'Amore 			add_numeric_str(get_wcs());
5866b5e5868SGarrett D'Amore 		}
5876b5e5868SGarrett D'Amore 		| T_GROUPING group_list T_NL
5886b5e5868SGarrett D'Amore 		;
5896b5e5868SGarrett D'Amore 
5906b5e5868SGarrett D'Amore numeric_strkw	: T_DECIMAL_POINT
5916b5e5868SGarrett D'Amore 		| T_THOUSANDS_SEP
5926b5e5868SGarrett D'Amore 		;
5936b5e5868SGarrett D'Amore 
5946b5e5868SGarrett D'Amore 
5956b5e5868SGarrett D'Amore group_list	: T_NUMBER
5966b5e5868SGarrett D'Amore 		{
5976b5e5868SGarrett D'Amore 			reset_numeric_group();
5986b5e5868SGarrett D'Amore 			add_numeric_group($1);
5996b5e5868SGarrett D'Amore 		}
6006b5e5868SGarrett D'Amore 		| group_list T_SEMI T_NUMBER
6016b5e5868SGarrett D'Amore 		{
6026b5e5868SGarrett D'Amore 			add_numeric_group($3);
6036b5e5868SGarrett D'Amore 		}
6046b5e5868SGarrett D'Amore 		;
6056b5e5868SGarrett D'Amore 
6066b5e5868SGarrett D'Amore 
6076b5e5868SGarrett D'Amore time		: T_TIME T_NL time_kwlist T_END T_TIME T_NL
6086b5e5868SGarrett D'Amore 		{
6096b5e5868SGarrett D'Amore 			dump_time();
6106b5e5868SGarrett D'Amore 		}
6116b5e5868SGarrett D'Amore 		| T_TIME T_NL copycat T_END T_NUMERIC T_NL
6126b5e5868SGarrett D'Amore 		;
6136b5e5868SGarrett D'Amore 
6146b5e5868SGarrett D'Amore time_kwlist	: time_kwlist time_kw
6156b5e5868SGarrett D'Amore 		| time_kw
6166b5e5868SGarrett D'Amore 		;
6176b5e5868SGarrett D'Amore 
6186b5e5868SGarrett D'Amore time_kw		: time_strkw string T_NL
6196b5e5868SGarrett D'Amore 		{
6206b5e5868SGarrett D'Amore 			add_time_str(get_wcs());
6216b5e5868SGarrett D'Amore 		}
6226b5e5868SGarrett D'Amore 		| time_listkw time_list T_NL
6236b5e5868SGarrett D'Amore 		{
6246b5e5868SGarrett D'Amore 			check_time_list();
6256b5e5868SGarrett D'Amore 		}
6266b5e5868SGarrett D'Amore 		;
6276b5e5868SGarrett D'Amore 
6286b5e5868SGarrett D'Amore time_listkw	: T_ABDAY
6296b5e5868SGarrett D'Amore 		| T_DAY
6306b5e5868SGarrett D'Amore 		| T_ABMON
6316b5e5868SGarrett D'Amore 		| T_MON
6326b5e5868SGarrett D'Amore 		| T_ERA
6336b5e5868SGarrett D'Amore 		| T_ALT_DIGITS
6346b5e5868SGarrett D'Amore 		| T_AM_PM
6356b5e5868SGarrett D'Amore 		;
6366b5e5868SGarrett D'Amore 
6376b5e5868SGarrett D'Amore time_strkw	: T_ERA_D_T_FMT
6386b5e5868SGarrett D'Amore 		| T_ERA_T_FMT
6396b5e5868SGarrett D'Amore 		| T_ERA_D_FMT
6406b5e5868SGarrett D'Amore 		| T_D_T_FMT
6416b5e5868SGarrett D'Amore 		| T_D_FMT
6426b5e5868SGarrett D'Amore 		| T_T_FMT
6436b5e5868SGarrett D'Amore 		| T_T_FMT_AMPM
6446b5e5868SGarrett D'Amore 		| T_DATE_FMT
6456b5e5868SGarrett D'Amore 		;
6466b5e5868SGarrett D'Amore 
6476b5e5868SGarrett D'Amore time_list	: time_list T_SEMI string
6486b5e5868SGarrett D'Amore 		{
6496b5e5868SGarrett D'Amore 			add_time_list(get_wcs());
6506b5e5868SGarrett D'Amore 		}
6516b5e5868SGarrett D'Amore 		| string
6526b5e5868SGarrett D'Amore 		{
6536b5e5868SGarrett D'Amore 			reset_time_list();
6546b5e5868SGarrett D'Amore 			add_time_list(get_wcs());
6556b5e5868SGarrett D'Amore 		}
6566b5e5868SGarrett D'Amore 		;
657