parser.y revision 33cf071bf2879e2693faa899bc1c16776dcbf897
%{
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright 2013 DEY Storage Systems, Inc.
*/
/*
* POSIX localedef grammar.
*/
#include <wchar.h>
#include <stdio.h>
#include <limits.h>
#include "localedef.h"
%}
%union {
int num;
char *token;
}
%%
;
;
{
add_wcs($2);
}
| T_CHAR
{
add_wcs($1);
}
;
| setting
;
{
com_char = $2;
}
{
esc_char = $2;
}
{
mb_cur_max = $2;
}
{
mb_cur_min = $2;
}
{
free(w);
}
{
set_wide_encoding($2);
}
;
{
copy_category($2);
}
{
free(w);
}
;
| category
;
| messages
| monetary
| ctype
| collate
| numeric
| time
;
;
;
{
scan_to_eol();
}
{
scan_to_eol();
}
| T_NL
;
;
{
}
{
}
{
}
{
}
{
}
{
}
| T_NL
;
{
dump_ctype();
}
;
| ctype_kw
;
;
{
add_ctype($3);
}
{
}
{
/* note that the endpoints *must* be characters */
add_ctype_range($5);
}
| T_CHAR
{
add_ctype($1);
}
| T_SYMBOL
{
}
;
;
{
}
{
}
{
}
{
}
;
{
dump_collate();
}
{
dump_collate();
}
;
;
{
define_collsym($2);
}
;
{
}
;
{
/* If no order list supplied default to one forward */
}
;
{
}
{
}
;
;
{
}
{
}
{
}
;
;
{
end_order_collsym($1);
}
{
end_order();
}
{
end_order();
}
;
{
start_order_char($1);
}
{
}
{
start_order_collelem($1);
}
{
}
| T_SYMBOL
{
start_order_symbol($1);
}
;
;
{
add_order_collelem($1);
}
{
add_order_collsym($1);
}
| T_CHAR
{
add_order_char($1);
}
{
}
| T_IGNORE
{
}
| T_SYMBOL
{
add_order_symbol($1);
}
{
}
;
;
{
add_subst_char($1);
}
{
add_subst_collsym($1);
}
{
add_subst_collelem($1);
}
| T_SYMBOL
{
add_subst_symbol($1);
}
;
{
}
;
;
| T_NOSTR
| T_NOEXPR
;
{
add_message(get_wcs());
}
;
{
}
;
;
;
;
{
}
{
add_monetary_num($2);
}
;
{
add_monetary_group($1);
}
{
add_monetary_group($3);
}
;
{
dump_numeric();
}
;
;
{
}
;
;
{
add_numeric_group($1);
}
{
add_numeric_group($3);
}
;
{
dump_time();
}
;
| time_kw
;
{
add_time_str(get_wcs());
}
{
}
;
| T_DAY
| T_ABMON
| T_MON
| T_ERA
| T_AM_PM
;
| T_D_FMT
| T_T_FMT
;
{
add_time_list(get_wcs());
}
| string
{
add_time_list(get_wcs());
}
;