gcc/gcc/gengtype-lex.l

218 lines
4.6 KiB
Plaintext
Raw Normal View History

/* -*- indented-text -*- */
/* Process source files and output type information.
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
%option noinput
%{
#ifdef GENERATOR_FILE
#include "bconfig.h"
#else
#include "config.h"
#endif
#include "system.h"
#define malloc xmalloc
#define realloc xrealloc
#include "gengtype.h"
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
#define YY_DECL int yylex (const char **yylval)
#define yyterminate() return EOF_TOKEN
struct fileloc lexer_line;
int lexer_toplevel_done;
static void
update_lineno (const char *l, size_t len)
{
while (len-- > 0)
if (*l++ == '\n')
lexer_line.line++;
}
%}
ID [[:alpha:]_][[:alnum:]_]*
WS [[:space:]]+
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
HWS [ \t\r\v\f]*
IWORD short|long|(un)?signed|char|int|HOST_WIDE_INT|HOST_WIDEST_INT|bool|size_t|BOOL_BITFIELD|CPPCHAR_SIGNED_T|ino_t|dev_t|HARD_REG_SET
ITYPE {IWORD}({WS}{IWORD})*
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
EOID [^[:alnum:]_]
%x in_struct in_struct_comment in_comment
%option warn noyywrap nounput nodefault perf-report
%option 8bit never-interactive
%%
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
/* Do this on entry to yylex(): */
*yylval = 0;
if (lexer_toplevel_done)
{
BEGIN(INITIAL);
lexer_toplevel_done = 0;
}
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
/* Things we look for in skipping mode: */
<INITIAL>{
^{HWS}typedef/{EOID} {
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
BEGIN(in_struct);
return TYPEDEF;
}
^{HWS}struct/{EOID} {
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
BEGIN(in_struct);
return STRUCT;
}
^{HWS}union/{EOID} {
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
BEGIN(in_struct);
return UNION;
}
^{HWS}extern/{EOID} {
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
BEGIN(in_struct);
return EXTERN;
}
^{HWS}static/{EOID} {
BEGIN(in_struct);
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
return STATIC;
}
^{HWS}DEF_VEC_[OP]/{EOID} {
BEGIN(in_struct);
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
return DEFVEC_OP;
}
^{HWS}DEF_VEC_I/{EOID} {
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
BEGIN(in_struct);
return DEFVEC_I;
}
^{HWS}DEF_VEC_ALLOC_[IOP]/{EOID} {
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
BEGIN(in_struct);
return DEFVEC_ALLOC;
}
}
<in_struct>{
"/*" { BEGIN(in_struct_comment); }
{WS} { update_lineno (yytext, yyleng); }
\\\n { lexer_line.line++; }
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
"const"/{EOID} /* don't care */
"GTY"/{EOID} { return GTY_TOKEN; }
"VEC"/{EOID} { return VEC_TOKEN; }
"union"/{EOID} { return UNION; }
"struct"/{EOID} { return STRUCT; }
"enum"/{EOID} { return ENUM; }
"ptr_alias"/{EOID} { return PTR_ALIAS; }
"nested_ptr"/{EOID} { return NESTED_PTR; }
[0-9]+ { return NUM; }
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
"param"[0-9]*"_is"/{EOID} {
cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * gcc.c (process_command): Likewise. * genattrtab.c (oballoc): Use XOBNEW. (oballocvec): Define. (attr_hash_add_rtx, attr_hash_add_string, attr_string, get_attr_value, fill_attr, make_length_attrs, gen_attr, gen_insn, gen_delay, find_attr, gen_insn_reserv, gen_bypass_1): Fix -Wc++-compat and/or -Wcast-qual warnings. * genautomata.c (XCREATENODE, XCREATENODEVEC, XCREATENODEVAR, XCOPYNODE, XCOPYNODEVEC, XCOPYNODEVAR): New. (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, gen_presence_absence_set, gen_automaton, gen_regexp_el, gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, gen_regexp_sequence, gen_reserv, gen_insn_reserv, process_excls, add_excls, process_presence_absence_names, process_presence_absence_patterns, add_presence_absence, process_regexp, add_advance_cycle_insn_decl, get_free_alt_state, get_free_state, add_arc, get_free_automata_list_el, form_reserv_sets_list, copy_insn_regexp, transform_1, transform_2, transform_3, cache_presence, create_ainsns, create_automata, create_state_ainsn_table, dfa_insn_code_enlarge, output_trans_func, output_min_issue_delay_func, output_dead_lock_func, output_reset_func, output_get_cpu_unit_code_func, output_dfa_start_func, expand_automata): Likewise. * genextract.c (gen_insn): Likewise. * gengtype-lex.l: Likewise. * gengtype.c (read_input_list, adjust_field_type, process_gc_options): Likewise. * genoutput.c (note_constraint): Likewise. * genpreds.c (mangle, add_constraint): Likewise. * genrecog.c (process_define_predicate, new_decision, add_to_sequence): Likewise. * gensupport.c (record_insn_name): Likewise. From-SVN: r137135
2008-06-26 02:22:12 +02:00
*yylval = XDUPVAR (const char, yytext, yyleng, yyleng+1);
Index: gcc/ChangeLog 2002-09-12 Geoffrey Keating <geoffk@apple.com> * ggc-common.c (ggc_mark_rtx_children_1): Update for changed name mangling. The following changes are merged from pch-branch: * doc/gty.texi (GTY Options): Document %a. * gengtype.c (do_scalar_typedef): New function. (process_gc_options): Handle `length' option. (set_gc_used_type): A pointer to an array of structures doesn't qualify as a pointer to a structure. (output_escaped_param): Add `%a' escape. (write_gc_structure_fields): Allow 'desc' on array of unions. (main): Define `uint8', `jword' and `JCF_u2' as scalars; use do_scalar_typedef. * gengtype.c (enum rtx_code): Make global. (rtx_format): Make global. (rtx_next): New. (gen_rtx_next): New. (write_rtx_next): New. (adjust_field_rtx_def): Skip fields marked by chain_next. (open_base_files): Delete redundant prototype. (write_enum_defn): New. (output_mangled_typename): Correct abort call. (write_gc_marker_routine_for_structure): Handle chain_next and chain_prev options. (finish_root_table): Don't output redundant \n. (main): Call gen_rtx_next, write_rtx_next, write_enum_defn. * c-tree.h (union lang_tree_node): Add chain_next option. * gengtype.h (NUM_PARAM): New definition. (struct type): For TYPE_PARAM_STRUCT, allow multiple parameters. * gengtype.c (find_param_structure): New. (adjust_field_type): Handle param<n>_is option. (process_gc_options): Detect use_params option. Update callers. (set_gc_used_type): Add 'param' parameter, update callers. Handle 'use_params' option. (open_base_files): Add splay-tree.h to list of files included. (output_mangled_typename): New. (write_gc_structure_fields): Update 'param' parameter to support multiple parameters. Change name mangling. Allow parameterized fields to have an apparent scalar type. Handle param<n>_is options, use_param option. (write_gc_marker_routine_for_structure): Update for change to name mangling. Better guess the output file for parameterized types. (write_gc_types): Update for change to name mangling. (write_gc_root): Update for change to name mangling. Handle (ignore) param<n>_is options. * doc/gty.texi (GTY Options): Add description of param<n>_is options, use_params option. * ggc.h (ggc_mark_rtx): Update for changed name mangling. * gengtype-lex.l: Produce token for param<n>_is. * gengtype-yacc.y: Parse param<n>_is. * gengtype.c (adjust_field_tree_exp): Don't name a variable 'rindex'. * rtl.c: Update comment describing rtx_format. * rtl.h (union rtunion): Separate definition and typedef. (struct rtx_def): Use gengtype to mark. * Makefile.in (gengtype.o): Also depend on rtl.def. * ggc.h (ggc_mark_rtx_children): Delete prototype. (ggc_mark_rtx): Change to alias of gengtype-generated routine. * ggc-common.c (ggc_mark_rtx_children): Delete. (ggc_mark_rtx_children_1): Delete. (gt_ggc_m_rtx_def): Delete. * gengtype.c (adjust_field_rtx_def): New. (adjust_field_type): Call adjust_field_rtx_def. (write_gc_structure_fields): Add 'default' case to switch if none is specified; remove unused code. * tree.h (struct tree_exp): Update for change to meaning of special. * gengtype.c (adjust_field_tree_exp): New function. (adjust_field_type): Handle `tree_exp' special here. (write_gc_structure_fields): Don't handle `tree_exp' special here. Handle new `dot' option. * gengtype.h: Make `info' a pointer-to-const. * gengtype-yacc.y (yacc_ids): Use xasprintf. * gengtype.c (write_gc_structure_fields): Remove implementation of `always' option, add `default' option. * doc/gty.texi (GTY Options): Remove documentation of `always', add `default'. Index: gcc/cp/ChangeLog 2002-09-12 Geoffrey Keating <geoffk@apple.com> * cp-tree.h (union lang_tree_node): Add chain_next option. Index: gcc/f/ChangeLog 2002-09-12 Geoffrey Keating <geoffk@apple.com> * com.c (union lang_tree_node): Add chain_next option. Index: gcc/java/ChangeLog 2002-09-12 Geoffrey Keating <geoffk@apple.com> * java-tree.h (union lang_tree_node): Add chain_next option. From-SVN: r57206
2002-09-16 20:33:23 +02:00
return PARAM_IS;
}
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
{IWORD}({WS}{IWORD})*/{EOID} |
"ENUM_BITFIELD"{WS}?"("{WS}?{ID}{WS}?")" {
size_t len;
for (len = yyleng; ISSPACE (yytext[len-1]); len--)
;
cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * gcc.c (process_command): Likewise. * genattrtab.c (oballoc): Use XOBNEW. (oballocvec): Define. (attr_hash_add_rtx, attr_hash_add_string, attr_string, get_attr_value, fill_attr, make_length_attrs, gen_attr, gen_insn, gen_delay, find_attr, gen_insn_reserv, gen_bypass_1): Fix -Wc++-compat and/or -Wcast-qual warnings. * genautomata.c (XCREATENODE, XCREATENODEVEC, XCREATENODEVAR, XCOPYNODE, XCOPYNODEVEC, XCOPYNODEVAR): New. (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, gen_presence_absence_set, gen_automaton, gen_regexp_el, gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, gen_regexp_sequence, gen_reserv, gen_insn_reserv, process_excls, add_excls, process_presence_absence_names, process_presence_absence_patterns, add_presence_absence, process_regexp, add_advance_cycle_insn_decl, get_free_alt_state, get_free_state, add_arc, get_free_automata_list_el, form_reserv_sets_list, copy_insn_regexp, transform_1, transform_2, transform_3, cache_presence, create_ainsns, create_automata, create_state_ainsn_table, dfa_insn_code_enlarge, output_trans_func, output_min_issue_delay_func, output_dead_lock_func, output_reset_func, output_get_cpu_unit_code_func, output_dfa_start_func, expand_automata): Likewise. * genextract.c (gen_insn): Likewise. * gengtype-lex.l: Likewise. * gengtype.c (read_input_list, adjust_field_type, process_gc_options): Likewise. * genoutput.c (note_constraint): Likewise. * genpreds.c (mangle, add_constraint): Likewise. * genrecog.c (process_define_predicate, new_decision, add_to_sequence): Likewise. * gensupport.c (record_insn_name): Likewise. From-SVN: r137135
2008-06-26 02:22:12 +02:00
*yylval = XDUPVAR (const char, yytext, len, len+1);
update_lineno (yytext, yyleng);
return SCALAR;
}
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
{ID}/{EOID} {
cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * gcc.c (process_command): Likewise. * genattrtab.c (oballoc): Use XOBNEW. (oballocvec): Define. (attr_hash_add_rtx, attr_hash_add_string, attr_string, get_attr_value, fill_attr, make_length_attrs, gen_attr, gen_insn, gen_delay, find_attr, gen_insn_reserv, gen_bypass_1): Fix -Wc++-compat and/or -Wcast-qual warnings. * genautomata.c (XCREATENODE, XCREATENODEVEC, XCREATENODEVAR, XCOPYNODE, XCOPYNODEVEC, XCOPYNODEVAR): New. (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, gen_presence_absence_set, gen_automaton, gen_regexp_el, gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, gen_regexp_sequence, gen_reserv, gen_insn_reserv, process_excls, add_excls, process_presence_absence_names, process_presence_absence_patterns, add_presence_absence, process_regexp, add_advance_cycle_insn_decl, get_free_alt_state, get_free_state, add_arc, get_free_automata_list_el, form_reserv_sets_list, copy_insn_regexp, transform_1, transform_2, transform_3, cache_presence, create_ainsns, create_automata, create_state_ainsn_table, dfa_insn_code_enlarge, output_trans_func, output_min_issue_delay_func, output_dead_lock_func, output_reset_func, output_get_cpu_unit_code_func, output_dfa_start_func, expand_automata): Likewise. * genextract.c (gen_insn): Likewise. * gengtype-lex.l: Likewise. * gengtype.c (read_input_list, adjust_field_type, process_gc_options): Likewise. * genoutput.c (note_constraint): Likewise. * genpreds.c (mangle, add_constraint): Likewise. * genrecog.c (process_define_predicate, new_decision, add_to_sequence): Likewise. * gensupport.c (record_insn_name): Likewise. From-SVN: r137135
2008-06-26 02:22:12 +02:00
*yylval = XDUPVAR (const char, yytext, yyleng, yyleng+1);
return ID;
}
\"([^"\\]|\\.)*\" {
cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * gcc.c (process_command): Likewise. * genattrtab.c (oballoc): Use XOBNEW. (oballocvec): Define. (attr_hash_add_rtx, attr_hash_add_string, attr_string, get_attr_value, fill_attr, make_length_attrs, gen_attr, gen_insn, gen_delay, find_attr, gen_insn_reserv, gen_bypass_1): Fix -Wc++-compat and/or -Wcast-qual warnings. * genautomata.c (XCREATENODE, XCREATENODEVEC, XCREATENODEVAR, XCOPYNODE, XCOPYNODEVEC, XCOPYNODEVAR): New. (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, gen_presence_absence_set, gen_automaton, gen_regexp_el, gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, gen_regexp_sequence, gen_reserv, gen_insn_reserv, process_excls, add_excls, process_presence_absence_names, process_presence_absence_patterns, add_presence_absence, process_regexp, add_advance_cycle_insn_decl, get_free_alt_state, get_free_state, add_arc, get_free_automata_list_el, form_reserv_sets_list, copy_insn_regexp, transform_1, transform_2, transform_3, cache_presence, create_ainsns, create_automata, create_state_ainsn_table, dfa_insn_code_enlarge, output_trans_func, output_min_issue_delay_func, output_dead_lock_func, output_reset_func, output_get_cpu_unit_code_func, output_dfa_start_func, expand_automata): Likewise. * genextract.c (gen_insn): Likewise. * gengtype-lex.l: Likewise. * gengtype.c (read_input_list, adjust_field_type, process_gc_options): Likewise. * genoutput.c (note_constraint): Likewise. * genpreds.c (mangle, add_constraint): Likewise. * genrecog.c (process_define_predicate, new_decision, add_to_sequence): Likewise. * gensupport.c (record_insn_name): Likewise. From-SVN: r137135
2008-06-26 02:22:12 +02:00
*yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng-1);
return STRING;
}
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
/* This "terminal" avoids having to parse integer constant expressions. */
"["[^\[\]]*"]" {
cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * gcc.c (process_command): Likewise. * genattrtab.c (oballoc): Use XOBNEW. (oballocvec): Define. (attr_hash_add_rtx, attr_hash_add_string, attr_string, get_attr_value, fill_attr, make_length_attrs, gen_attr, gen_insn, gen_delay, find_attr, gen_insn_reserv, gen_bypass_1): Fix -Wc++-compat and/or -Wcast-qual warnings. * genautomata.c (XCREATENODE, XCREATENODEVEC, XCREATENODEVAR, XCOPYNODE, XCOPYNODEVEC, XCOPYNODEVAR): New. (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, gen_presence_absence_set, gen_automaton, gen_regexp_el, gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, gen_regexp_sequence, gen_reserv, gen_insn_reserv, process_excls, add_excls, process_presence_absence_names, process_presence_absence_patterns, add_presence_absence, process_regexp, add_advance_cycle_insn_decl, get_free_alt_state, get_free_state, add_arc, get_free_automata_list_el, form_reserv_sets_list, copy_insn_regexp, transform_1, transform_2, transform_3, cache_presence, create_ainsns, create_automata, create_state_ainsn_table, dfa_insn_code_enlarge, output_trans_func, output_min_issue_delay_func, output_dead_lock_func, output_reset_func, output_get_cpu_unit_code_func, output_dfa_start_func, expand_automata): Likewise. * genextract.c (gen_insn): Likewise. * gengtype-lex.l: Likewise. * gengtype.c (read_input_list, adjust_field_type, process_gc_options): Likewise. * genoutput.c (note_constraint): Likewise. * genpreds.c (mangle, add_constraint): Likewise. * genrecog.c (process_define_predicate, new_decision, add_to_sequence): Likewise. * gensupport.c (record_insn_name): Likewise. From-SVN: r137135
2008-06-26 02:22:12 +02:00
*yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng-1);
return ARRAY;
}
"'"("\\".|[^\\])"'" {
cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * gcc.c (process_command): Likewise. * genattrtab.c (oballoc): Use XOBNEW. (oballocvec): Define. (attr_hash_add_rtx, attr_hash_add_string, attr_string, get_attr_value, fill_attr, make_length_attrs, gen_attr, gen_insn, gen_delay, find_attr, gen_insn_reserv, gen_bypass_1): Fix -Wc++-compat and/or -Wcast-qual warnings. * genautomata.c (XCREATENODE, XCREATENODEVEC, XCREATENODEVAR, XCOPYNODE, XCOPYNODEVEC, XCOPYNODEVAR): New. (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, gen_presence_absence_set, gen_automaton, gen_regexp_el, gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, gen_regexp_sequence, gen_reserv, gen_insn_reserv, process_excls, add_excls, process_presence_absence_names, process_presence_absence_patterns, add_presence_absence, process_regexp, add_advance_cycle_insn_decl, get_free_alt_state, get_free_state, add_arc, get_free_automata_list_el, form_reserv_sets_list, copy_insn_regexp, transform_1, transform_2, transform_3, cache_presence, create_ainsns, create_automata, create_state_ainsn_table, dfa_insn_code_enlarge, output_trans_func, output_min_issue_delay_func, output_dead_lock_func, output_reset_func, output_get_cpu_unit_code_func, output_dfa_start_func, expand_automata): Likewise. * genextract.c (gen_insn): Likewise. * gengtype-lex.l: Likewise. * gengtype.c (read_input_list, adjust_field_type, process_gc_options): Likewise. * genoutput.c (note_constraint): Likewise. * genpreds.c (mangle, add_constraint): Likewise. * genrecog.c (process_define_predicate, new_decision, add_to_sequence): Likewise. * gensupport.c (record_insn_name): Likewise. From-SVN: r137135
2008-06-26 02:22:12 +02:00
*yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng);
return CHAR;
}
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
"..." { return ELLIPSIS; }
[(){},*:<>;=%|-] { return yytext[0]; }
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
/* ignore pp-directives */
^{HWS}"#"{HWS}[a-z_]+[^\n]*\n {lexer_line.line++;}
. {
error_at_line (&lexer_line, "unexpected character `%s'", yytext);
}
}
"/*" { BEGIN(in_comment); }
\n { lexer_line.line++; }
{ID} |
"'"("\\".|[^\\])"'" |
[^"/\n] /* do nothing */
\"([^"\\]|\\.|\\\n)*\" { update_lineno (yytext, yyleng); }
"/"/[^*] /* do nothing */
<in_comment,in_struct_comment>{
\n { lexer_line.line++; }
[^*\n]{16} |
[^*\n] /* do nothing */
"*"/[^/] /* do nothing */
}
<in_comment>"*/" { BEGIN(INITIAL); }
<in_struct_comment>"*/" { BEGIN(in_struct); }
["/] |
<in_struct_comment,in_comment>"*" {
error_at_line (&lexer_line,
"unterminated comment or string; unexpected EOF");
}
^{HWS}"#"{HWS}"define"{WS}"GTY(" /* do nothing */
%%
void
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
yybegin (const char *fname)
{
yyin = fopen (fname, "r");
if (yyin == NULL)
{
perror (fname);
exit (1);
}
lexer_line.file = input_file_by_name (fname);
gengtype-parse.c: New file. * gengtype-parse.c: New file. * gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. From-SVN: r123235
2007-03-26 23:18:43 +02:00
lexer_line.line = 1;
}
void
yyend (void)
{
fclose (yyin);
}