gengtype-lex.l: Remove all rules and states relating to yacc input files.

* gengtype-lex.l: Remove all rules and states relating to yacc
	input files.
	* gengtype-yacc.y: Similarly.
	* gengtype.c (note_yacc_type): Delete function.
	* gengtype.h: Update prototypes.

From-SVN: r123226
This commit is contained in:
Zack Weinberg 2007-03-26 20:45:01 +00:00
parent 0227f9b9b2
commit cff4720f62
5 changed files with 49 additions and 201 deletions

View File

@ -1,3 +1,11 @@
2007-03-26 Zack Weinberg <zackw@panix.com>
* gengtype-lex.l: Remove all rules and states relating to yacc
input files.
* gengtype-yacc.y: Similarly.
* gengtype.c (note_yacc_type): Delete function.
* gengtype.h: Update prototypes.
2007-03-26 Joseph Myers <joseph@codesourcery.com>
* tree-pretty-print.c (dump_generic_node): Report precision of
@ -84,8 +92,8 @@
2007-03-25 Revital Eres <eres@il.ibm.com>
* tree-if-conv.c (if_convertible_gimple_modify_stmt_p):
Fold movement_possibility function into it.
* tree-if-conv.c (if_convertible_gimple_modify_stmt_p):
Fold movement_possibility function into it.
2007-03-25 David Edelsohn <edelsohn@gnu.org>

View File

@ -57,7 +57,7 @@ WS [[:space:]]+
IWORD short|long|(un)?signed|char|int|HOST_WIDE_INT|HOST_WIDEST_INT|bool|size_t|BOOL_BITFIELD
ITYPE {IWORD}({WS}{IWORD})*
%x in_struct in_struct_comment in_comment in_yacc_escape
%x in_struct in_struct_comment in_comment
%option warn noyywrap nounput nodefault perf-report
%option 8bit never-interactive
%%
@ -233,12 +233,6 @@ ITYPE {IWORD}({WS}{IWORD})*
return ENT_EXTERNSTATIC;
}
^"%union"{WS}"{"{WS}/"GTY" {
BEGIN(in_struct);
update_lineno (yytext, yyleng);
return ENT_YACCUNION;
}
^"DEF_VEC_"[[:alnum:]_]*{WS}?"("{WS}?{ID}{WS}?(","{WS}?{ID}{WS}?)*")" {
char *macro, *arg;
unsigned macro_len, arg_len;
@ -279,8 +273,6 @@ ITYPE {IWORD}({WS}{IWORD})*
"/*" { BEGIN(in_struct_comment); }
^"%{" { BEGIN(in_yacc_escape); } /* } */
{WS} { update_lineno (yytext, yyleng); }
"const"/[^[:alnum:]_] /* don't care */
@ -342,10 +334,6 @@ ITYPE {IWORD}({WS}{IWORD})*
yylval.s = (const char *) xmemdup (yytext+1, yyleng-2, yyleng-1);
return ARRAY;
}
^"%"{ID} {
yylval.s = (const char *) xmemdup (yytext+1, yyleng-1, yyleng);
return PERCENT_ID;
}
"'"("\\".|[^\\])"'" {
yylval.s = (const char *) xmemdup (yytext+1, yyleng-2, yyleng);
return CHAR;
@ -362,11 +350,6 @@ ITYPE {IWORD}({WS}{IWORD})*
return yytext[0];
}
^"%%" {
BEGIN(INITIAL);
return PERCENTPERCENT;
}
"#define"[^\n]*\n {lexer_line.line++;}
. {
@ -391,19 +374,6 @@ ITYPE {IWORD}({WS}{IWORD})*
<in_comment>"*/" { BEGIN(INITIAL); }
<in_struct_comment>"*/" { BEGIN(in_struct); }
<in_yacc_escape>{
\n { lexer_line.line++; }
[^%]{16} |
[^%] /* do nothing */
"%"/[^}] /* do nothing */
"%}" { BEGIN(in_struct); }
"%" {
error_at_line (&lexer_line,
"unterminated %%{; unexpected EOF");
}
}
["/] |
<in_struct_comment,in_comment>"*" {
error_at_line (&lexer_line,

View File

@ -38,7 +38,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
%token <t>ENT_TYPEDEF_STRUCT
%token <t>ENT_STRUCT
%token ENT_EXTERNSTATIC
%token ENT_YACCUNION
%token GTY_TOKEN
%token UNION
%token STRUCT
@ -47,15 +46,13 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
%token NESTED_PTR
%token <s>PARAM_IS
%token NUM
%token PERCENTPERCENT "%%"
%token <t>SCALAR
%token <s>ID
%token <s>STRING
%token <s>ARRAY
%token <s>PERCENT_ID
%token <s>CHAR
%type <p> struct_fields yacc_ids yacc_typematch
%type <p> struct_fields
%type <t> type lasttype
%type <o> optionsopt options option optionseq optionseqopt
%type <s> type_option stringseq
@ -65,7 +62,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
start: /* empty */
| typedef_struct start
| externstatic start
| yacc_union start
| start
;
typedef_struct: ENT_TYPEDEF_STRUCT options '{' struct_fields '}' ID
@ -116,72 +113,6 @@ semiequal: ';'
| '='
;
yacc_union: ENT_YACCUNION options struct_fields '}' yacc_typematch
PERCENTPERCENT
{
note_yacc_type ($2, $3, $5, &lexer_line);
}
;
yacc_typematch: /* empty */
{ $$ = NULL; }
| yacc_typematch PERCENT_ID yacc_ids
{
pair_p p;
for (p = $3; p->next != NULL; p = p->next)
{
p->name = NULL;
p->type = NULL;
}
p->name = NULL;
p->type = NULL;
p->next = $1;
$$ = $3;
}
| yacc_typematch PERCENT_ID '<' ID '>' yacc_ids
{
pair_p p;
type_p newtype = NULL;
if (strcmp ($2, "type") == 0)
newtype = (type_p) 1;
for (p = $6; p->next != NULL; p = p->next)
{
p->name = $4;
p->type = newtype;
}
p->name = $4;
p->next = $1;
p->type = newtype;
$$ = $6;
}
;
yacc_ids: /* empty */
{ $$ = NULL; }
| yacc_ids ID
{
pair_p p = XCNEW (struct pair);
p->next = $1;
p->line = lexer_line;
p->opt = XNEW (struct options);
p->opt->name = "tag";
p->opt->next = NULL;
p->opt->info = (char *)$2;
$$ = p;
}
| yacc_ids CHAR
{
pair_p p = XCNEW (struct pair);
p->next = $1;
p->line = lexer_line;
p->opt = XNEW (struct options);
p->opt->name = "tag";
p->opt->next = NULL;
p->opt->info = xasprintf ("'%s'", $2);
$$ = p;
}
;
struct_fields: { $$ = NULL; }
| type optionsopt ID bitfieldopt ';' struct_fields
{

View File

@ -810,65 +810,6 @@ adjust_field_type (type_p t, options_p opt)
return t;
}
/* Create a union for YYSTYPE, as yacc would do it, given a fieldlist FIELDS
and information about the correspondence between token types and fields
in TYPEINFO. POS is used for error messages. */
void
note_yacc_type (options_p o, pair_p fields, pair_p typeinfo,
struct fileloc *pos)
{
pair_p p;
pair_p *p_p;
for (p = typeinfo; p; p = p->next)
{
pair_p m;
if (p->name == NULL)
continue;
if (p->type == (type_p) 1)
{
pair_p pp;
int ok = 0;
for (pp = typeinfo; pp; pp = pp->next)
if (pp->type != (type_p) 1
&& strcmp (pp->opt->info, p->opt->info) == 0)
{
ok = 1;
break;
}
if (! ok)
continue;
}
for (m = fields; m; m = m->next)
if (strcmp (m->name, p->name) == 0)
p->type = m->type;
if (p->type == NULL)
{
error_at_line (&p->line,
"couldn't match fieldname `%s'", p->name);
p->name = NULL;
}
}
p_p = &typeinfo;
while (*p_p)
{
pair_p p = *p_p;
if (p->name == NULL
|| p->type == (type_p) 1)
*p_p = p->next;
else
p_p = &p->next;
}
do_typedef ("YYSTYPE", new_structure ("yy_union", 1, pos, typeinfo, o), pos);
}
static void set_gc_used_type (type_p, enum gc_used_enum, type_p *);
static void set_gc_used (pair_p);

View File

@ -144,8 +144,6 @@ extern options_p create_option (options_p, const char *name, const void *info);
extern type_p adjust_field_type (type_p, options_p);
extern void note_variable (const char *s, type_p t, options_p o,
struct fileloc *pos);
extern void note_yacc_type (options_p o, pair_p fields,
pair_p typeinfo, struct fileloc *pos);
/* Lexer and parser routines, most automatically generated. */
extern int yylex (void);