X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fgengtype-lex.l;h=ad70ba82e6301e753ed6bdded59997497a3208f5;hb=ec2603a9d9d70cbeb69893922211cbc3967b98e5;hp=24e0ad4798121d9a5a48e5b0f5298420a0ae40d6;hpb=776c30b832ece6ccc124c8c06a049d24cb063c16;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/gengtype-lex.l b/gcc/gengtype-lex.l index 24e0ad47981..ad70ba82e63 100644 --- a/gcc/gengtype-lex.l +++ b/gcc/gengtype-lex.l @@ -1,6 +1,6 @@ /* -*- indented-text -*- */ /* Process source files and output type information. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of GCC. @@ -20,23 +20,26 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ %{ +#include "bconfig.h" +#include "coretypes.h" +#include "system.h" + #define malloc xmalloc #define realloc xrealloc -#include "hconfig.h" -#include "system.h" #include "gengtype.h" #include "gengtype-yacc.h" -static void update_lineno PARAMS ((const char *l, size_t len)); +#undef YY_USE_PROTOS +#define YY_DECL int yylex () + +static void update_lineno (const char *l, size_t len); struct fileloc lexer_line; int lexer_toplevel_done; static void -update_lineno (l, len) - const char *l; - size_t len; +update_lineno (const char *l, size_t len) { while (len-- > 0) if (*l++ == '\n') @@ -45,9 +48,9 @@ update_lineno (l, len) %} -ID [[:alpha:]][[:alnum:]_]* +ID [[:alpha:]_][[:alnum:]_]* WS [[:space:]]+ -IWORD short|long|(un)?signed|char|int|HOST_WIDE_INT|bool|size_t +IWORD short|long|(un)?signed|char|int|HOST_WIDE_INT|bool|size_t|CHAR_BITFIELD ITYPE {IWORD}({WS}{IWORD})* %x in_struct in_struct_comment in_comment in_yacc_escape @@ -200,8 +203,11 @@ ITYPE {IWORD}({WS}{IWORD})* "struct"/[^[:alnum:]_] { return STRUCT; } "enum"/[^[:alnum:]_] { return ENUM; } "ptr_alias"/[^[:alnum:]_] { return ALIAS; } -"param_is"/[^[:alnum:]_] { return PARAM_IS; } [0-9]+ { return NUM; } +"param"[0-9]*"_is"/[^[:alnum:]_] { + yylval.s = xmemdup (yytext, yyleng, yyleng+1); + return PARAM_IS; +} {IWORD}({WS}{IWORD})*/[^[:alnum:]_] | "ENUM_BITFIELD"{WS}?"("{WS}?{ID}{WS}?")" { @@ -297,15 +303,13 @@ ITYPE {IWORD}({WS}{IWORD})* %% void -yyerror (s) - const char *s; +yyerror (const char *s) { error_at_line (&lexer_line, s); } void -parse_file (fname) - const char *fname; +parse_file (const char *fname) { yyin = fopen (fname, "r"); lexer_line.file = fname;