mkcollate_yacc.y revision 6da5aa940d1e163c6f244b5523c22d545bfb954b
%{
/*
* Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
* at Electronni Visti IA, Kiev, Ukraine.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <err.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sysexits.h>
#include "collate.h"
#include "common.h"
int yyparse(void);
int yylex(void);
static void usage(void);
static void collate_print_tables(void);
char curr_chain[STR_LEN];
char __collate_version[STR_LEN];
int chain_index = 0;
#ifdef COLLATE_DEBUG
int debug;
#endif
const char *out_file = "LC_COLLATE";
%}
%union {
}
%%
;
;
statment :
| charmap
| order
;
}
;
if ($2 == '\0')
yyerror("NUL character can't be substituted");
}
;
}
yyerror("can't grow chain table");
sizeof(__collate_chain_pri_table[0]));
chain_index++;
#ifdef COLLATE_DEBUG
if (debug)
#endif
out_file);
"IO error writting collate version to destination file %s",
out_file);
"IO error writting chains number to destination file %s",
out_file);
"IO error writting substitute table to destination file %s",
out_file);
}
"IO error writting char table to destination file %s",
out_file);
}
"IO error writting chain table to destination file %s",
out_file);
out_file);
}
;
;
curr_chain[0] = $1;
yyerror("\\0 can't be chained");
}
static char tb[2];
tb[0] = $2;
if (tb[0] == '\0')
yyerror("\\0 can't be chained");
}
;
}
| chain {
yyerror("can't grow chain table");
sizeof(__collate_chain_pri_table[0]));
chain_index++;
}
u_int i;
if ($3 <= $1)
for (i = $1; i <= $3; i++) {
}
}
prim_pri++;
}
prim_pri++;
sec_pri = 1;
}
;
;
;
prim_sub_item : CHAR {
}
u_int i;
if ($3 <= $1)
yyerror("Illegal range 0x%02x -- 0x%02x",
$1, $3);
for (i = $1; i <= $3; i++) {
}
}
| chain {
yyerror("can't grow chain table");
sizeof(__collate_chain_pri_table[0]));
chain_index++;
}
;
sec_sub_item : CHAR {
}
u_int i;
if ($3 <= $1)
yyerror("Illegal range 0x%02x -- 0x%02x",
$1, $3);
for (i = $1; i <= $3; i++) {
}
}
| chain {
yyerror("can't grow chain table");
sizeof(__collate_chain_pri_table[0]));
chain_index++;
}
;
%%
int
{
int ch;
#ifdef COLLATE_DEBUG
#else
#endif
switch (ch)
{
#ifdef COLLATE_DEBUG
case 'd':
debug++;
break;
#endif
case 'o':
break;
case 'I':
break;
default:
usage();
}
}
if (ac > 0) {
}
yyparse();
return 0;
}
static void
usage(void)
{
}
void
{
char msg[128];
}
#ifdef COLLATE_DEBUG
static void
collate_print_tables(void)
{
int i;
printf("Substitute table:\n");
for (i = 0; i < UCHAR_MAX + 1; i++)
if (i != *__collate_substitute_table[i])
printf("\t'%c' --> \"%s\"\n", i,
printf("Chain priority table:\n");
for (i = 0; i < chain_index - 1; i++)
printf("\t\"%s\" : %d %d\n",
printf("Char priority table:\n");
for (i = 0; i < UCHAR_MAX + 1; i++)
}
#endif