9804 hal-set-property should support --direct option
[unleashed.git] / usr / src / cmd / iconv / parser.y
blob5abd7e2024c48e5d6da16bcc6a6f16ba4c3cea1a
1 %{
2 /*
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
6 * 1.0 of the CDDL.
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 2011 Nexenta Systems, Inc. All rights reserved.
18 * POSIX iconv charmap grammar.
21 #include <wchar.h>
22 #include <stdio.h>
23 #include <limits.h>
24 #include "charmap.h"
27 %union {
28 char *token;
29 int num;
30 char mbs[MB_LEN_MAX + 2]; /* NB: [0] is length! */
33 %token T_CODE_SET
34 %token T_MB_CUR_MAX
35 %token T_MB_CUR_MIN
36 %token T_COM_CHAR
37 %token T_ESC_CHAR
38 %token T_LT
39 %token T_GT
40 %token T_NL
41 %token T_SEMI
42 %token T_COMMA
43 %token T_ELLIPSIS
44 %token T_RPAREN
45 %token T_LPAREN
46 %token T_QUOTE
47 %token T_NULL
48 %token T_END
49 %token T_CHARMAP
50 %token T_WIDTH
51 %token T_WIDTH_DEFAULT
52 %token <mbs> T_CHAR
53 %token <token> T_NAME
54 %token <num> T_NUMBER
55 %token <token> T_SYMBOL
59 goal : setting_list charmap
60 | charmap
63 string : T_QUOTE charlist T_QUOTE
64 | T_QUOTE T_QUOTE
67 charlist : charlist T_CHAR
68 | T_CHAR
71 setting_list : setting_list setting
72 | setting
75 setting : T_COM_CHAR T_CHAR T_NL
77 com_char = $2[1];
79 | T_ESC_CHAR T_CHAR T_NL
81 esc_char = $2[1];
83 | T_MB_CUR_MAX T_NUMBER T_NL
85 mb_cur_max = $2;
87 | T_MB_CUR_MIN T_NUMBER T_NL
89 mb_cur_min = $2;
91 | T_CODE_SET T_NAME T_NL
93 /* ignore */
95 | T_CODE_SET string T_NL
97 /* ignore */
101 charmap : T_CHARMAP T_NL charmap_list T_END T_CHARMAP T_NL
103 charmap_list : charmap_list charmap_entry
104 | charmap_entry
107 charmap_entry : T_SYMBOL T_CHAR
109 add_charmap($1, $2);
110 scan_to_eol();
112 | T_SYMBOL T_ELLIPSIS T_SYMBOL T_CHAR
114 add_charmap_range($1, $3, $4);
115 scan_to_eol();
117 | T_NL