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.
7 *
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.
11 */
12
13 /*
14 * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
15 */
16
17 /*
18 * POSIX charmap grammar.
19 */
20
21 #include <wchar.h>
22 #include <stdio.h>
23 #include <limits.h>
24 #include "iconv.h"
25
26 %}
27 %union {
28 int num;
29 wchar_t wc;
30 char *token;
31 }
32
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_WS
49 %token T_END
50 %token T_COPY
51 %token T_CHARMAP
52 %token T_WIDTH
53 %token T_WIDTH_DEFAULT
54 %token <wc> T_CHAR
55 %token <token> T_NAME
56 %token <num> T_NUMBER
57 %token <token> T_SYMBOL
58
59 %%
60
61 charmap : T_CHARMAP T_NL charmap_list T_END T_CHARMAP T_NL
62
63
64 charmap_list : charmap_list charmap_entry
65 | charmap_entry
66 ;
67
68
69 charmap_entry : T_SYMBOL T_CHAR
70 {
71 add_charmap($1, $2);
72 scan_to_eol();
73 }
74 | T_SYMBOL T_ELLIPSIS T_SYMBOL T_CHAR
75 {
76 add_charmap_range($1, $3, $4);
77 scan_to_eol();
78 }
79 | T_NL
80 ;