]>
Commit | Line | Data |
---|---|---|
1239777d AD |
1 | /* -*- C -*- */ |
2 | /* Scan Bison Skeletons. | |
3 | Copyright (C) 2001 Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of Bison, the GNU Compiler Compiler. | |
6 | ||
7 | Bison is free software; you can redistribute it and/or modify it | |
8 | under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2, or (at your option) | |
10 | any later version. | |
11 | ||
12 | Bison is distributed in the hope that it will be useful, but | |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | General Public License for more details. | |
9b3add5b | 16 | |
1239777d AD |
17 | You should have received a copy of the GNU General Public License |
18 | along with Bison; see the file COPYING. If not, write to the Free | |
19 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
9b3add5b | 21 | |
1239777d | 22 | %{ |
1239777d AD |
23 | #include "system.h" |
24 | #include "skeleton.h" | |
9b3add5b | 25 | #include "parse-skel.h" |
9b3add5b RA |
26 | %} |
27 | ||
28 | %option nounput | |
29 | %option noyywrap | |
1239777d AD |
30 | /* If we enable |
31 | ||
32 | %option yylineno | |
33 | ||
34 | Then we have warning: `yy_flex_realloc' defined but not used. | |
35 | Seems like a Flex bug to me: Why the heck yylineno would trigger | |
36 | the REJECT exception??? */ | |
9b3add5b RA |
37 | |
38 | %% | |
39 | ||
40 | "%%{line}" { return LINE; } | |
41 | "%%{skeleton-line}" { return SLINE; } | |
42 | ||
43 | "%%{yacc}" { return YACC; } | |
44 | "%%{section}" { return SECTION; } | |
45 | ||
46 | "%%{guards}" { return GUARDS; } | |
47 | "%%{actions}" { return ACTIONS; } | |
48 | "%%{tokendef}" { return TOKENS; } | |
49 | ||
a4b36db4 AD |
50 | /* Muscle. */ |
51 | "%%{"[a-zA-Z][0-9a-zA-Z_-]+"}" { | |
52 | yylval.muscle = xstrndup (yytext + 3, yyleng - 4); | |
9b3add5b RA |
53 | return MUSCLE; |
54 | } | |
55 | ||
a4b36db4 AD |
56 | /* String. */ |
57 | "%%\"".*"\"" { | |
58 | yylval.string = xstrndup (yytext + 3, yyleng - 4); | |
9b3add5b RA |
59 | return STRING; |
60 | } | |
61 | ||
a4b36db4 AD |
62 | /* End of line. */ |
63 | "\n" { | |
9b3add5b RA |
64 | return '\n'; |
65 | } | |
66 | ||
a4b36db4 AD |
67 | /* Plain Character. */ |
68 | . { | |
9b3add5b RA |
69 | yylval.character = *yytext; |
70 | return CHARACTER; | |
71 | } | |
72 | ||
73 | %% |