xref: /titanic_53/usr/src/cmd/localedef/parser.y (revision 2da1cd3a39e2d3da7f9d15071ea9462919c011ac)
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.
55aec55ebSGarrett D'Amore  * You may only use this file in accordance with the terms of version
65aec55ebSGarrett 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.
15*2da1cd3aSGarrett D'Amore  * Copyright 2013 DEY Storage Systems, Inc.
166b5e5868SGarrett D'Amore  */
176b5e5868SGarrett D'Amore 
186b5e5868SGarrett D'Amore /*
196b5e5868SGarrett D'Amore  * POSIX localedef grammar.
206b5e5868SGarrett D'Amore  */
216b5e5868SGarrett D'Amore 
226b5e5868SGarrett D'Amore #include <wchar.h>
236b5e5868SGarrett D'Amore #include <stdio.h>
246b5e5868SGarrett D'Amore #include <limits.h>
256b5e5868SGarrett D'Amore #include "localedef.h"
266b5e5868SGarrett D'Amore 
276b5e5868SGarrett D'Amore %}
286b5e5868SGarrett D'Amore %union {
296b5e5868SGarrett D'Amore 	int		num;
306b5e5868SGarrett D'Amore 	wchar_t		wc;
316b5e5868SGarrett D'Amore 	char		*token;
326b5e5868SGarrett D'Amore 	collsym_t	*collsym;
336b5e5868SGarrett D'Amore 	collelem_t	*collelem;
346b5e5868SGarrett D'Amore }
356b5e5868SGarrett D'Amore 
366b5e5868SGarrett D'Amore %token		T_CODE_SET
376b5e5868SGarrett D'Amore %token		T_MB_CUR_MAX
386b5e5868SGarrett D'Amore %token		T_MB_CUR_MIN
396b5e5868SGarrett D'Amore %token		T_COM_CHAR
406b5e5868SGarrett D'Amore %token		T_ESC_CHAR
416b5e5868SGarrett D'Amore %token		T_LT
426b5e5868SGarrett D'Amore %token		T_GT
436b5e5868SGarrett D'Amore %token		T_NL
446b5e5868SGarrett D'Amore %token		T_SEMI
456b5e5868SGarrett D'Amore %token		T_COMMA
466b5e5868SGarrett D'Amore %token		T_ELLIPSIS
476b5e5868SGarrett D'Amore %token		T_RPAREN
486b5e5868SGarrett D'Amore %token		T_LPAREN
496b5e5868SGarrett D'Amore %token		T_QUOTE
506b5e5868SGarrett D'Amore %token		T_NULL
516b5e5868SGarrett D'Amore %token		T_WS
526b5e5868SGarrett D'Amore %token		T_END
536b5e5868SGarrett D'Amore %token		T_COPY
546b5e5868SGarrett D'Amore %token		T_CHARMAP
556b5e5868SGarrett D'Amore %token		T_WIDTH
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
222*2da1cd3aSGarrett D'Amore 		| T_WIDTH T_NL width_list T_END T_WIDTH T_NL
223*2da1cd3aSGarrett D'Amore 		;
2246b5e5868SGarrett D'Amore 
2256b5e5868SGarrett D'Amore 
2266b5e5868SGarrett D'Amore charmap_list	: charmap_list charmap_entry
2276b5e5868SGarrett D'Amore 		| charmap_entry
2286b5e5868SGarrett D'Amore 		;
2296b5e5868SGarrett D'Amore 
2306b5e5868SGarrett D'Amore 
2316b5e5868SGarrett D'Amore charmap_entry	: T_SYMBOL T_CHAR
2326b5e5868SGarrett D'Amore 		{
2336b5e5868SGarrett D'Amore 			add_charmap($1, $2);
2346b5e5868SGarrett D'Amore 			scan_to_eol();
2356b5e5868SGarrett D'Amore 		}
2366b5e5868SGarrett D'Amore 		| T_SYMBOL T_ELLIPSIS T_SYMBOL T_CHAR
2376b5e5868SGarrett D'Amore 		{
2386b5e5868SGarrett D'Amore 			add_charmap_range($1, $3, $4);
2396b5e5868SGarrett D'Amore 			scan_to_eol();
2406b5e5868SGarrett D'Amore 		}
2416b5e5868SGarrett D'Amore 		| T_NL
2426b5e5868SGarrett D'Amore 		;
2436b5e5868SGarrett D'Amore 
244*2da1cd3aSGarrett D'Amore width_list	: width_list width_entry
245*2da1cd3aSGarrett D'Amore 		| width_entry
246*2da1cd3aSGarrett D'Amore 		;
247*2da1cd3aSGarrett D'Amore 
248*2da1cd3aSGarrett D'Amore width_entry	: T_CHAR T_NUMBER T_NL
249*2da1cd3aSGarrett D'Amore 		{
250*2da1cd3aSGarrett D'Amore 			add_width($1, $2);
251*2da1cd3aSGarrett D'Amore 			scan_to_eol();
252*2da1cd3aSGarrett D'Amore 		}
253*2da1cd3aSGarrett D'Amore 		| T_SYMBOL T_NUMBER T_NL
254*2da1cd3aSGarrett D'Amore 		{
255*2da1cd3aSGarrett D'Amore 			add_charmap_undefined($1);
256*2da1cd3aSGarrett D'Amore 			scan_to_eol();
257*2da1cd3aSGarrett D'Amore 		}
258*2da1cd3aSGarrett D'Amore 		| T_CHAR T_ELLIPSIS T_CHAR T_NUMBER T_NL
259*2da1cd3aSGarrett D'Amore 		{
260*2da1cd3aSGarrett D'Amore 			add_width_range($1, $3, $4);
261*2da1cd3aSGarrett D'Amore 			scan_to_eol();
262*2da1cd3aSGarrett D'Amore 		}
263*2da1cd3aSGarrett D'Amore 		| T_SYMBOL T_ELLIPSIS T_SYMBOL T_NUMBER T_NL
264*2da1cd3aSGarrett D'Amore 		{
265*2da1cd3aSGarrett D'Amore 			add_charmap_undefined($1);
266*2da1cd3aSGarrett D'Amore 			add_charmap_undefined($3);
267*2da1cd3aSGarrett D'Amore 			scan_to_eol();
268*2da1cd3aSGarrett D'Amore 		}
269*2da1cd3aSGarrett D'Amore 		| T_CHAR T_ELLIPSIS T_SYMBOL T_NUMBER T_NL
270*2da1cd3aSGarrett D'Amore 		{
271*2da1cd3aSGarrett D'Amore 			add_width($1, $4);
272*2da1cd3aSGarrett D'Amore 			add_charmap_undefined($3);
273*2da1cd3aSGarrett D'Amore 			scan_to_eol();
274*2da1cd3aSGarrett D'Amore 		}
275*2da1cd3aSGarrett D'Amore 		| T_SYMBOL T_ELLIPSIS T_CHAR T_NUMBER T_NL
276*2da1cd3aSGarrett D'Amore 		{
277*2da1cd3aSGarrett D'Amore 			add_width($3, $4);
278*2da1cd3aSGarrett D'Amore 			add_charmap_undefined($1);
279*2da1cd3aSGarrett D'Amore 			scan_to_eol();
280*2da1cd3aSGarrett D'Amore 		}
281*2da1cd3aSGarrett D'Amore 		| T_NL
282*2da1cd3aSGarrett D'Amore 		;
283*2da1cd3aSGarrett D'Amore 
2846b5e5868SGarrett D'Amore ctype		: T_CTYPE T_NL ctype_list T_END T_CTYPE T_NL
2856b5e5868SGarrett D'Amore 		{
2866b5e5868SGarrett D'Amore 			dump_ctype();
2876b5e5868SGarrett D'Amore 		}
2886b5e5868SGarrett D'Amore 		| T_CTYPE T_NL copycat  T_END T_CTYPE T_NL
2896b5e5868SGarrett D'Amore 		;
2906b5e5868SGarrett D'Amore 
2916b5e5868SGarrett D'Amore ctype_list	: ctype_list ctype_kw
2926b5e5868SGarrett D'Amore 		| ctype_kw
2936b5e5868SGarrett D'Amore 		;
2946b5e5868SGarrett D'Amore 
2956b5e5868SGarrett D'Amore ctype_kw	: T_ISUPPER cc_list T_NL
2966b5e5868SGarrett D'Amore 		| T_ISLOWER cc_list T_NL
2976b5e5868SGarrett D'Amore 		| T_ISALPHA cc_list T_NL
2986b5e5868SGarrett D'Amore 		| T_ISDIGIT cc_list T_NL
2996b5e5868SGarrett D'Amore 		| T_ISPUNCT cc_list T_NL
3006b5e5868SGarrett D'Amore 		| T_ISXDIGIT cc_list T_NL
3016b5e5868SGarrett D'Amore 		| T_ISSPACE cc_list T_NL
3026b5e5868SGarrett D'Amore 		| T_ISPRINT cc_list T_NL
3036b5e5868SGarrett D'Amore 		| T_ISGRAPH cc_list T_NL
3046b5e5868SGarrett D'Amore 		| T_ISBLANK cc_list T_NL
3056b5e5868SGarrett D'Amore 		| T_ISCNTRL cc_list T_NL
3066b5e5868SGarrett D'Amore 		| T_ISALNUM cc_list T_NL
3076b5e5868SGarrett D'Amore 		| T_ISSPECIAL cc_list T_NL
3086b5e5868SGarrett D'Amore 		| T_ISENGLISH cc_list T_NL
3096b5e5868SGarrett D'Amore 		| T_ISNUMBER cc_list T_NL
3106b5e5868SGarrett D'Amore 		| T_ISIDEOGRAM cc_list T_NL
3116b5e5868SGarrett D'Amore 		| T_ISPHONOGRAM cc_list T_NL
3126b5e5868SGarrett D'Amore 		| T_TOUPPER conv_list T_NL
3136b5e5868SGarrett D'Amore 		| T_TOLOWER conv_list T_NL
3146b5e5868SGarrett D'Amore 		;
3156b5e5868SGarrett D'Amore 
3166b5e5868SGarrett D'Amore 
3176b5e5868SGarrett D'Amore cc_list		: cc_list T_SEMI T_CHAR
3186b5e5868SGarrett D'Amore 		{
3196b5e5868SGarrett D'Amore 			add_ctype($3);
3206b5e5868SGarrett D'Amore 		}
3216b5e5868SGarrett D'Amore 		| cc_list T_SEMI T_SYMBOL
3226b5e5868SGarrett D'Amore 		{
3236b5e5868SGarrett D'Amore 			add_charmap_undefined($3);
3246b5e5868SGarrett D'Amore 		}
3256b5e5868SGarrett D'Amore 		| cc_list T_SEMI T_ELLIPSIS T_SEMI T_CHAR
3266b5e5868SGarrett D'Amore 		{
3276b5e5868SGarrett D'Amore 			/* note that the endpoints *must* be characters */
3286b5e5868SGarrett D'Amore 			add_ctype_range($5);
3296b5e5868SGarrett D'Amore 		}
3306b5e5868SGarrett D'Amore 		| T_CHAR
3316b5e5868SGarrett D'Amore 		{
3326b5e5868SGarrett D'Amore 			add_ctype($1);
3336b5e5868SGarrett D'Amore 		}
3346b5e5868SGarrett D'Amore 		| T_SYMBOL
3356b5e5868SGarrett D'Amore 		{
3366b5e5868SGarrett D'Amore 			add_charmap_undefined($1);
3376b5e5868SGarrett D'Amore 		}
3386b5e5868SGarrett D'Amore 		;
3396b5e5868SGarrett D'Amore 
3406b5e5868SGarrett D'Amore conv_list	: conv_list T_SEMI conv_pair
3416b5e5868SGarrett D'Amore 		| conv_pair
3426b5e5868SGarrett D'Amore 		;
3436b5e5868SGarrett D'Amore 
3446b5e5868SGarrett D'Amore 
3456b5e5868SGarrett D'Amore conv_pair	: T_LPAREN T_CHAR T_COMMA T_CHAR T_RPAREN
3466b5e5868SGarrett D'Amore 		{
3476b5e5868SGarrett D'Amore 			add_caseconv($2, $4);
3486b5e5868SGarrett D'Amore 		}
3496b5e5868SGarrett D'Amore 		| T_LPAREN T_SYMBOL T_COMMA T_CHAR T_RPAREN
3506b5e5868SGarrett D'Amore 		{
3516b5e5868SGarrett D'Amore 			add_charmap_undefined($2);
3526b5e5868SGarrett D'Amore 		}
3536b5e5868SGarrett D'Amore 		| T_LPAREN T_SYMBOL T_COMMA T_SYMBOL T_RPAREN
3546b5e5868SGarrett D'Amore 		{
3556b5e5868SGarrett D'Amore 			add_charmap_undefined($2);
3566b5e5868SGarrett D'Amore 			add_charmap_undefined($4);
3576b5e5868SGarrett D'Amore 		}
3586b5e5868SGarrett D'Amore 		| T_LPAREN T_CHAR T_COMMA T_SYMBOL T_RPAREN
3596b5e5868SGarrett D'Amore 		{
3606b5e5868SGarrett D'Amore 			add_charmap_undefined($4);
3616b5e5868SGarrett D'Amore 		}
3626b5e5868SGarrett D'Amore 		;
3636b5e5868SGarrett D'Amore 
3646b5e5868SGarrett D'Amore collate		: T_COLLATE T_NL coll_order T_END T_COLLATE T_NL
3656b5e5868SGarrett D'Amore 		{
3666b5e5868SGarrett D'Amore 			dump_collate();
3676b5e5868SGarrett D'Amore 		}
3686b5e5868SGarrett D'Amore 		| T_COLLATE T_NL coll_optional coll_order T_END T_COLLATE T_NL
3696b5e5868SGarrett D'Amore 		{
3706b5e5868SGarrett D'Amore 			dump_collate();
3716b5e5868SGarrett D'Amore 		}
3726b5e5868SGarrett D'Amore 		| T_COLLATE T_NL copycat T_END T_COLLATE T_NL
3736b5e5868SGarrett D'Amore 		;
3746b5e5868SGarrett D'Amore 
3756b5e5868SGarrett D'Amore 
3766b5e5868SGarrett D'Amore coll_optional	: coll_optional coll_symbols
3776b5e5868SGarrett D'Amore 		| coll_optional coll_elements
3786b5e5868SGarrett D'Amore 		| coll_symbols
3796b5e5868SGarrett D'Amore 		| coll_elements
3806b5e5868SGarrett D'Amore 		;
3816b5e5868SGarrett D'Amore 
3826b5e5868SGarrett D'Amore 
3836b5e5868SGarrett D'Amore coll_symbols	: T_COLLATING_SYMBOL T_SYMBOL T_NL
3846b5e5868SGarrett D'Amore 		{
3856b5e5868SGarrett D'Amore 			define_collsym($2);
3866b5e5868SGarrett D'Amore 		}
3876b5e5868SGarrett D'Amore 		;
3886b5e5868SGarrett D'Amore 
3896b5e5868SGarrett D'Amore 
3906b5e5868SGarrett D'Amore coll_elements	: T_COLLATING_ELEMENT T_SYMBOL T_FROM string T_NL
3916b5e5868SGarrett D'Amore 		{
3926b5e5868SGarrett D'Amore 			define_collelem($2, get_wcs());
3936b5e5868SGarrett D'Amore 		}
3946b5e5868SGarrett D'Amore 		;
3956b5e5868SGarrett D'Amore 
3966b5e5868SGarrett D'Amore coll_order	: T_ORDER_START T_NL order_list T_ORDER_END T_NL
3976b5e5868SGarrett D'Amore 		{
3986b5e5868SGarrett D'Amore 			/* If no order list supplied default to one forward */
3996b5e5868SGarrett D'Amore 			add_order_bit(T_FORWARD);
4006b5e5868SGarrett D'Amore 			add_order_directive();
4016b5e5868SGarrett D'Amore 		}
4026b5e5868SGarrett D'Amore 		| T_ORDER_START order_args T_NL order_list T_ORDER_END T_NL
4036b5e5868SGarrett D'Amore 		;
4046b5e5868SGarrett D'Amore 
4056b5e5868SGarrett D'Amore 
4066b5e5868SGarrett D'Amore order_args	: order_args T_SEMI order_arg
4076b5e5868SGarrett D'Amore 		{
4086b5e5868SGarrett D'Amore 			add_order_directive();
4096b5e5868SGarrett D'Amore 		}
4106b5e5868SGarrett D'Amore 		| order_arg
4116b5e5868SGarrett D'Amore 		{
4126b5e5868SGarrett D'Amore 			add_order_directive();
4136b5e5868SGarrett D'Amore 		}
4146b5e5868SGarrett D'Amore 		;
4156b5e5868SGarrett D'Amore 
4166b5e5868SGarrett D'Amore order_arg	: order_arg T_COMMA order_dir
4176b5e5868SGarrett D'Amore 		| order_dir
4186b5e5868SGarrett D'Amore 		;
4196b5e5868SGarrett D'Amore 
4206b5e5868SGarrett D'Amore order_dir	: T_FORWARD
4216b5e5868SGarrett D'Amore 		{
4226b5e5868SGarrett D'Amore 			add_order_bit(T_FORWARD);
4236b5e5868SGarrett D'Amore 		}
4246b5e5868SGarrett D'Amore 		| T_BACKWARD
4256b5e5868SGarrett D'Amore 		{
4266b5e5868SGarrett D'Amore 			add_order_bit(T_BACKWARD);
4276b5e5868SGarrett D'Amore 		}
4286b5e5868SGarrett D'Amore 		| T_POSITION
4296b5e5868SGarrett D'Amore 		{
4306b5e5868SGarrett D'Amore 			add_order_bit(T_POSITION);
4316b5e5868SGarrett D'Amore 		}
4326b5e5868SGarrett D'Amore 		;
4336b5e5868SGarrett D'Amore 
4346b5e5868SGarrett D'Amore order_list	: order_list order_item
4356b5e5868SGarrett D'Amore 		| order_item
4366b5e5868SGarrett D'Amore 		;
4376b5e5868SGarrett D'Amore 
4386b5e5868SGarrett D'Amore order_item	: T_COLLSYM T_NL
4396b5e5868SGarrett D'Amore 		{
4406b5e5868SGarrett D'Amore 			end_order_collsym($1);
4416b5e5868SGarrett D'Amore 		}
4426b5e5868SGarrett D'Amore 		| order_itemkw T_NL
4436b5e5868SGarrett D'Amore 		{
4446b5e5868SGarrett D'Amore 			end_order();
4456b5e5868SGarrett D'Amore 		}
4466b5e5868SGarrett D'Amore 		| order_itemkw order_weights T_NL
4476b5e5868SGarrett D'Amore 		{
4486b5e5868SGarrett D'Amore 			end_order();
4496b5e5868SGarrett D'Amore 		}
4506b5e5868SGarrett D'Amore 		;
4516b5e5868SGarrett D'Amore 
4526b5e5868SGarrett D'Amore order_itemkw	: T_CHAR
4536b5e5868SGarrett D'Amore 		{
4546b5e5868SGarrett D'Amore 			start_order_char($1);
4556b5e5868SGarrett D'Amore 		}
4566b5e5868SGarrett D'Amore 		| T_ELLIPSIS
4576b5e5868SGarrett D'Amore 		{
4586b5e5868SGarrett D'Amore 			start_order_ellipsis();
4596b5e5868SGarrett D'Amore 		}
4606b5e5868SGarrett D'Amore 		| T_COLLELEM
4616b5e5868SGarrett D'Amore 		{
4626b5e5868SGarrett D'Amore 			start_order_collelem($1);
4636b5e5868SGarrett D'Amore 		}
4646b5e5868SGarrett D'Amore 		| T_UNDEFINED
4656b5e5868SGarrett D'Amore 		{
4666b5e5868SGarrett D'Amore 			start_order_undefined();
4676b5e5868SGarrett D'Amore 		}
4686b5e5868SGarrett D'Amore 		| T_SYMBOL
4696b5e5868SGarrett D'Amore 		{
4706b5e5868SGarrett D'Amore 			start_order_symbol($1);
4716b5e5868SGarrett D'Amore 		}
4726b5e5868SGarrett D'Amore 		;
4736b5e5868SGarrett D'Amore 
4746b5e5868SGarrett D'Amore order_weights	: order_weights T_SEMI order_weight
4756b5e5868SGarrett D'Amore 		| order_weights T_SEMI
4766b5e5868SGarrett D'Amore 		| order_weight
4776b5e5868SGarrett D'Amore 		;
4786b5e5868SGarrett D'Amore 
4796b5e5868SGarrett D'Amore order_weight	: T_COLLELEM
4806b5e5868SGarrett D'Amore 		{
4816b5e5868SGarrett D'Amore 			add_order_collelem($1);
4826b5e5868SGarrett D'Amore 		}
4836b5e5868SGarrett D'Amore 		| T_COLLSYM
4846b5e5868SGarrett D'Amore 		{
4856b5e5868SGarrett D'Amore 			add_order_collsym($1);
4866b5e5868SGarrett D'Amore 		}
4876b5e5868SGarrett D'Amore 		| T_CHAR
4886b5e5868SGarrett D'Amore 		{
4896b5e5868SGarrett D'Amore 			add_order_char($1);
4906b5e5868SGarrett D'Amore 		}
4916b5e5868SGarrett D'Amore 		| T_ELLIPSIS
4926b5e5868SGarrett D'Amore 		{
4936b5e5868SGarrett D'Amore 			add_order_ellipsis();
4946b5e5868SGarrett D'Amore 		}
4956b5e5868SGarrett D'Amore 		| T_IGNORE
4966b5e5868SGarrett D'Amore 		{
4976b5e5868SGarrett D'Amore 			add_order_ignore();
4986b5e5868SGarrett D'Amore 		}
4996b5e5868SGarrett D'Amore 		| T_SYMBOL
5006b5e5868SGarrett D'Amore 		{
5016b5e5868SGarrett D'Amore 			add_order_symbol($1);
5026b5e5868SGarrett D'Amore 		}
5036b5e5868SGarrett D'Amore 		| T_QUOTE order_str T_QUOTE
5046b5e5868SGarrett D'Amore 		{
5056b5e5868SGarrett D'Amore 			add_order_subst();
5066b5e5868SGarrett D'Amore 		}
5076b5e5868SGarrett D'Amore 		;
5086b5e5868SGarrett D'Amore 
5096b5e5868SGarrett D'Amore order_str	: order_str order_stritem
5106b5e5868SGarrett D'Amore 		| order_stritem
5116b5e5868SGarrett D'Amore 		;
5126b5e5868SGarrett D'Amore 
5136b5e5868SGarrett D'Amore order_stritem	: T_CHAR
5146b5e5868SGarrett D'Amore 		{
5156b5e5868SGarrett D'Amore 			add_subst_char($1);
5166b5e5868SGarrett D'Amore 		}
5176b5e5868SGarrett D'Amore 		| T_COLLSYM
5186b5e5868SGarrett D'Amore 		{
5196b5e5868SGarrett D'Amore 			add_subst_collsym($1);
5206b5e5868SGarrett D'Amore 		}
5216b5e5868SGarrett D'Amore 		| T_COLLELEM
5226b5e5868SGarrett D'Amore 		{
5236b5e5868SGarrett D'Amore 			add_subst_collelem($1);
5246b5e5868SGarrett D'Amore 		}
5256b5e5868SGarrett D'Amore 		| T_SYMBOL
5266b5e5868SGarrett D'Amore 		{
5276b5e5868SGarrett D'Amore 			add_subst_symbol($1);
5286b5e5868SGarrett D'Amore 		}
5296b5e5868SGarrett D'Amore 		;
5306b5e5868SGarrett D'Amore 
5316b5e5868SGarrett D'Amore messages	: T_MESSAGES T_NL messages_list T_END T_MESSAGES T_NL
5326b5e5868SGarrett D'Amore 		{
5336b5e5868SGarrett D'Amore 			dump_messages();
5346b5e5868SGarrett D'Amore 		}
5356b5e5868SGarrett D'Amore 		| T_MESSAGES T_NL copycat T_END T_MESSAGES T_NL
5366b5e5868SGarrett D'Amore 		;
5376b5e5868SGarrett D'Amore 
5386b5e5868SGarrett D'Amore messages_list	: messages_list messages_item
5396b5e5868SGarrett D'Amore 		| messages_item
5406b5e5868SGarrett D'Amore 		;
5416b5e5868SGarrett D'Amore 
5426b5e5868SGarrett D'Amore messages_kw	: T_YESSTR
5436b5e5868SGarrett D'Amore 		| T_NOSTR
5446b5e5868SGarrett D'Amore 		| T_YESEXPR
5456b5e5868SGarrett D'Amore 		| T_NOEXPR
5466b5e5868SGarrett D'Amore 		;
5476b5e5868SGarrett D'Amore 
5486b5e5868SGarrett D'Amore messages_item	: messages_kw string T_NL
5496b5e5868SGarrett D'Amore 		{
5506b5e5868SGarrett D'Amore 			add_message(get_wcs());
5516b5e5868SGarrett D'Amore 		}
5526b5e5868SGarrett D'Amore 		;
5536b5e5868SGarrett D'Amore 
5546b5e5868SGarrett D'Amore monetary	: T_MONETARY T_NL monetary_list T_END T_MONETARY T_NL
5556b5e5868SGarrett D'Amore 		{
5566b5e5868SGarrett D'Amore 			dump_monetary();
5576b5e5868SGarrett D'Amore 		}
5586b5e5868SGarrett D'Amore 		| T_MONETARY T_NL copycat T_END T_MONETARY T_NL
5596b5e5868SGarrett D'Amore 		;
5606b5e5868SGarrett D'Amore 
5616b5e5868SGarrett D'Amore monetary_list	: monetary_list monetary_kw
5626b5e5868SGarrett D'Amore 		| monetary_kw
5636b5e5868SGarrett D'Amore 		;
5646b5e5868SGarrett D'Amore 
5656b5e5868SGarrett D'Amore monetary_strkw	: T_INT_CURR_SYMBOL
5666b5e5868SGarrett D'Amore 		| T_CURRENCY_SYMBOL
5676b5e5868SGarrett D'Amore 		| T_MON_DECIMAL_POINT
5686b5e5868SGarrett D'Amore 		| T_MON_THOUSANDS_SEP
5696b5e5868SGarrett D'Amore 		| T_POSITIVE_SIGN
5706b5e5868SGarrett D'Amore 		| T_NEGATIVE_SIGN
5716b5e5868SGarrett D'Amore 		;
5726b5e5868SGarrett D'Amore 
5736b5e5868SGarrett D'Amore monetary_numkw	: T_INT_FRAC_DIGITS
5746b5e5868SGarrett D'Amore 		| T_FRAC_DIGITS
5756b5e5868SGarrett D'Amore 		| T_P_CS_PRECEDES
5766b5e5868SGarrett D'Amore 		| T_P_SEP_BY_SPACE
5776b5e5868SGarrett D'Amore 		| T_N_CS_PRECEDES
5786b5e5868SGarrett D'Amore 		| T_N_SEP_BY_SPACE
5796b5e5868SGarrett D'Amore 		| T_P_SIGN_POSN
5806b5e5868SGarrett D'Amore 		| T_N_SIGN_POSN
5816b5e5868SGarrett D'Amore 		| T_INT_P_CS_PRECEDES
5826b5e5868SGarrett D'Amore 		| T_INT_N_CS_PRECEDES
5836b5e5868SGarrett D'Amore 		| T_INT_P_SEP_BY_SPACE
5846b5e5868SGarrett D'Amore 		| T_INT_N_SEP_BY_SPACE
5856b5e5868SGarrett D'Amore 		| T_INT_P_SIGN_POSN
5866b5e5868SGarrett D'Amore 		| T_INT_N_SIGN_POSN
5876b5e5868SGarrett D'Amore 		;
5886b5e5868SGarrett D'Amore 
5896b5e5868SGarrett D'Amore monetary_kw	: monetary_strkw string T_NL
5906b5e5868SGarrett D'Amore 		{
5916b5e5868SGarrett D'Amore 			add_monetary_str(get_wcs());
5926b5e5868SGarrett D'Amore 		}
5936b5e5868SGarrett D'Amore 		| monetary_numkw T_NUMBER T_NL
5946b5e5868SGarrett D'Amore 		{
5956b5e5868SGarrett D'Amore 			add_monetary_num($2);
5966b5e5868SGarrett D'Amore 		}
5976b5e5868SGarrett D'Amore 		| T_MON_GROUPING mon_group_list T_NL
5986b5e5868SGarrett D'Amore 		;
5996b5e5868SGarrett D'Amore 
6006b5e5868SGarrett D'Amore mon_group_list	: T_NUMBER
6016b5e5868SGarrett D'Amore 		{
6026b5e5868SGarrett D'Amore 			reset_monetary_group();
6036b5e5868SGarrett D'Amore 			add_monetary_group($1);
6046b5e5868SGarrett D'Amore 		}
6056b5e5868SGarrett D'Amore 		| mon_group_list T_SEMI T_NUMBER
6066b5e5868SGarrett D'Amore 		{
6076b5e5868SGarrett D'Amore 			add_monetary_group($3);
6086b5e5868SGarrett D'Amore 		}
6096b5e5868SGarrett D'Amore 		;
6106b5e5868SGarrett D'Amore 
6116b5e5868SGarrett D'Amore 
6126b5e5868SGarrett D'Amore numeric		: T_NUMERIC T_NL numeric_list T_END T_NUMERIC T_NL
6136b5e5868SGarrett D'Amore 		{
6146b5e5868SGarrett D'Amore 			dump_numeric();
6156b5e5868SGarrett D'Amore 		}
6166b5e5868SGarrett D'Amore 		| T_NUMERIC T_NL copycat T_END T_NUMERIC T_NL
6176b5e5868SGarrett D'Amore 		;
6186b5e5868SGarrett D'Amore 
6196b5e5868SGarrett D'Amore 
6206b5e5868SGarrett D'Amore numeric_list	: numeric_list numeric_item
6216b5e5868SGarrett D'Amore 		| numeric_item
6226b5e5868SGarrett D'Amore 		;
6236b5e5868SGarrett D'Amore 
6246b5e5868SGarrett D'Amore 
6256b5e5868SGarrett D'Amore numeric_item	: numeric_strkw string T_NL
6266b5e5868SGarrett D'Amore 		{
6276b5e5868SGarrett D'Amore 			add_numeric_str(get_wcs());
6286b5e5868SGarrett D'Amore 		}
6296b5e5868SGarrett D'Amore 		| T_GROUPING group_list T_NL
6306b5e5868SGarrett D'Amore 		;
6316b5e5868SGarrett D'Amore 
6326b5e5868SGarrett D'Amore numeric_strkw	: T_DECIMAL_POINT
6336b5e5868SGarrett D'Amore 		| T_THOUSANDS_SEP
6346b5e5868SGarrett D'Amore 		;
6356b5e5868SGarrett D'Amore 
6366b5e5868SGarrett D'Amore 
6376b5e5868SGarrett D'Amore group_list	: T_NUMBER
6386b5e5868SGarrett D'Amore 		{
6396b5e5868SGarrett D'Amore 			reset_numeric_group();
6406b5e5868SGarrett D'Amore 			add_numeric_group($1);
6416b5e5868SGarrett D'Amore 		}
6426b5e5868SGarrett D'Amore 		| group_list T_SEMI T_NUMBER
6436b5e5868SGarrett D'Amore 		{
6446b5e5868SGarrett D'Amore 			add_numeric_group($3);
6456b5e5868SGarrett D'Amore 		}
6466b5e5868SGarrett D'Amore 		;
6476b5e5868SGarrett D'Amore 
6486b5e5868SGarrett D'Amore 
6496b5e5868SGarrett D'Amore time		: T_TIME T_NL time_kwlist T_END T_TIME T_NL
6506b5e5868SGarrett D'Amore 		{
6516b5e5868SGarrett D'Amore 			dump_time();
6526b5e5868SGarrett D'Amore 		}
6536b5e5868SGarrett D'Amore 		| T_TIME T_NL copycat T_END T_NUMERIC T_NL
6546b5e5868SGarrett D'Amore 		;
6556b5e5868SGarrett D'Amore 
6566b5e5868SGarrett D'Amore time_kwlist	: time_kwlist time_kw
6576b5e5868SGarrett D'Amore 		| time_kw
6586b5e5868SGarrett D'Amore 		;
6596b5e5868SGarrett D'Amore 
6606b5e5868SGarrett D'Amore time_kw		: time_strkw string T_NL
6616b5e5868SGarrett D'Amore 		{
6626b5e5868SGarrett D'Amore 			add_time_str(get_wcs());
6636b5e5868SGarrett D'Amore 		}
6646b5e5868SGarrett D'Amore 		| time_listkw time_list T_NL
6656b5e5868SGarrett D'Amore 		{
6666b5e5868SGarrett D'Amore 			check_time_list();
6676b5e5868SGarrett D'Amore 		}
6686b5e5868SGarrett D'Amore 		;
6696b5e5868SGarrett D'Amore 
6706b5e5868SGarrett D'Amore time_listkw	: T_ABDAY
6716b5e5868SGarrett D'Amore 		| T_DAY
6726b5e5868SGarrett D'Amore 		| T_ABMON
6736b5e5868SGarrett D'Amore 		| T_MON
6746b5e5868SGarrett D'Amore 		| T_ERA
6756b5e5868SGarrett D'Amore 		| T_ALT_DIGITS
6766b5e5868SGarrett D'Amore 		| T_AM_PM
6776b5e5868SGarrett D'Amore 		;
6786b5e5868SGarrett D'Amore 
6796b5e5868SGarrett D'Amore time_strkw	: T_ERA_D_T_FMT
6806b5e5868SGarrett D'Amore 		| T_ERA_T_FMT
6816b5e5868SGarrett D'Amore 		| T_ERA_D_FMT
6826b5e5868SGarrett D'Amore 		| T_D_T_FMT
6836b5e5868SGarrett D'Amore 		| T_D_FMT
6846b5e5868SGarrett D'Amore 		| T_T_FMT
6856b5e5868SGarrett D'Amore 		| T_T_FMT_AMPM
6866b5e5868SGarrett D'Amore 		| T_DATE_FMT
6876b5e5868SGarrett D'Amore 		;
6886b5e5868SGarrett D'Amore 
6896b5e5868SGarrett D'Amore time_list	: time_list T_SEMI string
6906b5e5868SGarrett D'Amore 		{
6916b5e5868SGarrett D'Amore 			add_time_list(get_wcs());
6926b5e5868SGarrett D'Amore 		}
6936b5e5868SGarrett D'Amore 		| string
6946b5e5868SGarrett D'Amore 		{
6956b5e5868SGarrett D'Amore 			reset_time_list();
6966b5e5868SGarrett D'Amore 			add_time_list(get_wcs());
6976b5e5868SGarrett D'Amore 		}
6986b5e5868SGarrett D'Amore 		;
699