3 * This file and its contents are supplied under the terms of the
4 * Common Development and Distribution License ("CDDL"), version 1.0.
5 * You may only use this file in accordance with the terms of version
8 * A full copy of the text of the CDDL should have accompanied this
9 * source. A copy of the CDDL is also available via the Internet at
10 * http://www.illumos.org/license/CDDL.
14 * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
15 * Copyright 2013 DEY Storage Systems, Inc.
19 * POSIX localedef grammar.
25 #include "localedef.h"
77 %token T_COLLATING_SYMBOL
78 %token T_COLLATING_ELEMENT
93 %token T_INT_CURR_SYMBOL
94 %token T_CURRENCY_SYMBOL
95 %token T_MON_DECIMAL_POINT
96 %token T_MON_THOUSANDS_SEP
97 %token T_POSITIVE_SIGN
98 %token T_NEGATIVE_SIGN
100 %token T_INT_FRAC_DIGITS
102 %token T_P_CS_PRECEDES
103 %token T_P_SEP_BY_SPACE
104 %token T_N_CS_PRECEDES
105 %token T_N_SEP_BY_SPACE
108 %token T_INT_P_CS_PRECEDES
109 %token T_INT_N_CS_PRECEDES
110 %token T_INT_P_SEP_BY_SPACE
111 %token T_INT_N_SEP_BY_SPACE
112 %token T_INT_P_SIGN_POSN
113 %token T_INT_N_SIGN_POSN
115 %token T_DECIMAL_POINT
116 %token T_THOUSANDS_SEP
135 %token
<token
> T_NAME
136 %token
<num
> T_NUMBER
137 %token
<token
> T_SYMBOL
138 %token
<collsym
> T_COLLSYM
139 %token
<collelem
> T_COLLELEM
143 localedef
: setting_list categories
147 string : T_QUOTE charlist T_QUOTE
151 charlist
: charlist T_CHAR
161 setting_list
: setting_list setting
166 setting
: T_COM_CHAR T_CHAR T_NL
170 | T_ESC_CHAR T_CHAR T_NL
174 | T_MB_CUR_MAX T_NUMBER T_NL
178 | T_MB_CUR_MIN T_NUMBER T_NL
182 | T_CODE_SET
string T_NL
184 wchar_t *w
= get_wcs
();
185 set_wide_encoding
(to_mb_string
(w
));
188 | T_CODE_SET T_NAME T_NL
190 set_wide_encoding
($2);
194 copycat
: T_COPY T_NAME T_NL
200 wchar_t *w
= get_wcs
();
201 copy_category
(to_mb_string
(w
));
206 categories
: categories category
221 charmap
: T_CHARMAP T_NL charmap_list T_END T_CHARMAP T_NL
222 | T_WIDTH T_NL width_list T_END T_WIDTH T_NL
226 charmap_list
: charmap_list charmap_entry
231 charmap_entry
: T_SYMBOL T_CHAR
236 | T_SYMBOL T_ELLIPSIS T_SYMBOL T_CHAR
238 add_charmap_range
($1, $3, $4);
244 width_list
: width_list width_entry
248 width_entry
: T_CHAR T_NUMBER T_NL
252 | T_SYMBOL T_NUMBER T_NL
254 add_charmap_undefined
($1);
256 | T_CHAR T_ELLIPSIS T_CHAR T_NUMBER T_NL
258 add_width_range
($1, $3, $4);
260 | T_SYMBOL T_ELLIPSIS T_SYMBOL T_NUMBER T_NL
262 add_charmap_undefined
($1);
263 add_charmap_undefined
($3);
265 | T_CHAR T_ELLIPSIS T_SYMBOL T_NUMBER T_NL
268 add_charmap_undefined
($3);
270 | T_SYMBOL T_ELLIPSIS T_CHAR T_NUMBER T_NL
273 add_charmap_undefined
($1);
278 ctype
: T_CTYPE T_NL ctype_list T_END T_CTYPE T_NL
282 | T_CTYPE T_NL copycat T_END T_CTYPE T_NL
285 ctype_list
: ctype_list ctype_kw
289 ctype_kw
: T_ISUPPER cc_list T_NL
290 | T_ISLOWER cc_list T_NL
291 | T_ISALPHA cc_list T_NL
292 | T_ISDIGIT cc_list T_NL
293 | T_ISPUNCT cc_list T_NL
294 | T_ISXDIGIT cc_list T_NL
295 | T_ISSPACE cc_list T_NL
296 | T_ISPRINT cc_list T_NL
297 | T_ISGRAPH cc_list T_NL
298 | T_ISBLANK cc_list T_NL
299 | T_ISCNTRL cc_list T_NL
300 | T_ISALNUM cc_list T_NL
301 | T_ISSPECIAL cc_list T_NL
302 | T_ISENGLISH cc_list T_NL
303 | T_ISNUMBER cc_list T_NL
304 | T_ISIDEOGRAM cc_list T_NL
305 | T_ISPHONOGRAM cc_list T_NL
306 | T_TOUPPER conv_list T_NL
307 | T_TOLOWER conv_list T_NL
310 cc_list
: cc_list T_SEMI cc_range_end
311 | cc_list T_SEMI cc_char
315 cc_range_end
: T_ELLIPSIS T_SEMI T_CHAR
327 add_charmap_undefined
($1);
331 conv_list
: conv_list T_SEMI conv_pair
336 conv_pair
: T_LPAREN T_CHAR T_COMMA T_CHAR T_RPAREN
338 add_caseconv
($2, $4);
340 | T_LPAREN T_SYMBOL T_COMMA T_CHAR T_RPAREN
342 add_charmap_undefined
($2);
344 | T_LPAREN T_SYMBOL T_COMMA T_SYMBOL T_RPAREN
346 add_charmap_undefined
($2);
347 add_charmap_undefined
($4);
349 | T_LPAREN T_CHAR T_COMMA T_SYMBOL T_RPAREN
351 add_charmap_undefined
($4);
355 collate
: T_COLLATE T_NL coll_order T_END T_COLLATE T_NL
359 | T_COLLATE T_NL coll_optional coll_order T_END T_COLLATE T_NL
363 | T_COLLATE T_NL copycat T_END T_COLLATE T_NL
367 coll_optional
: coll_optional coll_symbols
368 | coll_optional coll_elements
374 coll_symbols
: T_COLLATING_SYMBOL T_SYMBOL T_NL
381 coll_elements
: T_COLLATING_ELEMENT T_SYMBOL T_FROM
string T_NL
383 define_collelem
($2, get_wcs
());
387 coll_order
: T_ORDER_START T_NL order_list T_ORDER_END T_NL
389 /* If no order list supplied default to one forward */
390 add_order_bit
(T_FORWARD
);
391 add_order_directive
();
393 | T_ORDER_START order_args T_NL order_list T_ORDER_END T_NL
397 order_args
: order_args T_SEMI order_arg
399 add_order_directive
();
403 add_order_directive
();
407 order_arg
: order_arg T_COMMA order_dir
411 order_dir
: T_FORWARD
413 add_order_bit
(T_FORWARD
);
417 add_order_bit
(T_BACKWARD
);
421 add_order_bit
(T_POSITION
);
425 order_list
: order_list order_item
429 order_item
: T_COLLSYM T_NL
431 end_order_collsym
($1);
437 | order_itemkw order_weights T_NL
443 order_itemkw
: T_CHAR
445 start_order_char
($1);
449 start_order_ellipsis
();
453 start_order_collelem
($1);
457 start_order_undefined
();
461 start_order_symbol
($1);
465 order_weights
: order_weights T_SEMI order_weight
466 | order_weights T_SEMI
470 order_weight
: T_COLLELEM
472 add_order_collelem
($1);
476 add_order_collsym
($1);
484 add_order_ellipsis
();
492 add_order_symbol
($1);
494 | T_QUOTE order_str T_QUOTE
500 order_str
: order_str order_stritem
504 order_stritem
: T_CHAR
510 add_subst_collsym
($1);
514 add_subst_collelem
($1);
518 add_subst_symbol
($1);
522 messages
: T_MESSAGES T_NL messages_list T_END T_MESSAGES T_NL
526 | T_MESSAGES T_NL copycat T_END T_MESSAGES T_NL
529 messages_list
: messages_list messages_item
533 messages_kw
: T_YESSTR
539 messages_item
: messages_kw
string T_NL
541 add_message
(get_wcs
());
545 monetary
: T_MONETARY T_NL monetary_list T_END T_MONETARY T_NL
549 | T_MONETARY T_NL copycat T_END T_MONETARY T_NL
552 monetary_list
: monetary_list monetary_kw
556 monetary_strkw
: T_INT_CURR_SYMBOL
558 | T_MON_DECIMAL_POINT
559 | T_MON_THOUSANDS_SEP
564 monetary_numkw
: T_INT_FRAC_DIGITS
572 | T_INT_P_CS_PRECEDES
573 | T_INT_N_CS_PRECEDES
574 | T_INT_P_SEP_BY_SPACE
575 | T_INT_N_SEP_BY_SPACE
580 monetary_kw
: monetary_strkw
string T_NL
582 add_monetary_str
(get_wcs
());
584 | monetary_numkw T_NUMBER T_NL
586 add_monetary_num
($2);
588 | T_MON_GROUPING mon_group_list T_NL
591 mon_group_list
: T_NUMBER
593 reset_monetary_group
();
594 add_monetary_group
($1);
596 | mon_group_list T_SEMI T_NUMBER
598 add_monetary_group
($3);
603 numeric
: T_NUMERIC T_NL numeric_list T_END T_NUMERIC T_NL
607 | T_NUMERIC T_NL copycat T_END T_NUMERIC T_NL
611 numeric_list
: numeric_list numeric_item
616 numeric_item
: numeric_strkw
string T_NL
618 add_numeric_str
(get_wcs
());
620 | T_GROUPING group_list T_NL
623 numeric_strkw
: T_DECIMAL_POINT
628 group_list
: T_NUMBER
630 reset_numeric_group
();
631 add_numeric_group
($1);
633 | group_list T_SEMI T_NUMBER
635 add_numeric_group
($3);
640 time
: T_TIME T_NL time_kwlist T_END T_TIME T_NL
644 | T_TIME T_NL copycat T_END T_NUMERIC T_NL
647 time_kwlist
: time_kwlist time_kw
651 time_kw
: time_strkw
string T_NL
653 add_time_str
(get_wcs
());
655 | time_listkw time_list T_NL
661 time_listkw
: T_ABDAY
670 time_strkw
: T_ERA_D_T_FMT
680 time_list
: time_list T_SEMI
string
682 add_time_list
(get_wcs
());
687 add_time_list
(get_wcs
());