This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / gas / itbl-lex.l
1 /* itbl-lex.l
2 Copyright 1997, 1998, 2001 Free Software Foundation, Inc.
3
4 This file is part of GAS, the GNU Assembler.
5
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
20
21 %{
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdlib.h>
25 #include "itbl-parse.h"
26
27 #ifdef DEBUG
28 #define DBG(x) printf x
29 #define MDBG(x) printf x
30 #else
31 #define DBG(x)
32 #define MDBG(x)
33 #endif
34
35 int insntbl_line = 1;
36 %}
37
38 ALNUM [A-Za-z0-9_]
39 DIGIT [0-9]
40 ALPHA [A-Za-z_]
41 HEX [0-9A-Fa-f]
42
43 %%
44
45 "creg"|"CREG" {
46 return CREG;
47 }
48 "dreg"|"DREG" {
49 return DREG;
50 }
51 "greg"|"GREG" {
52 return GREG;
53 }
54 "immed"|"IMMED" {
55 return IMMED;
56 }
57 "addr"|"ADDR" {
58 return ADDR;
59 }
60 "insn"|"INSN" {
61 return INSN;
62 }
63 "p"{DIGIT} {
64 yytext[yyleng] = 0;
65 yylval.processor = strtoul (yytext+1, 0, 0);
66 return PNUM;
67 }
68 {DIGIT}+ {
69 yytext[yyleng] = 0;
70 yylval.num = strtoul (yytext, 0, 0);
71 return NUM;
72 }
73 "0x"{HEX}+ {
74 yytext[yyleng] = 0;
75 yylval.num = strtoul (yytext, 0, 0);
76 return NUM;
77 }
78 {ALPHA}{ALNUM}* {
79 yytext[yyleng] = 0;
80 yylval.str = strdup (yytext);
81 return ID;
82 }
83 ";"|"#" {
84 int c;
85 while ((c = input ()) != EOF)
86 {
87 if (c == '\n')
88 {
89 unput (c);
90 break;
91 }
92 }
93 }
94 "\n" {
95 insntbl_line++;
96 MDBG (("in lex, NL = %d (x%x)\n", NL, NL));
97 return NL;
98 }
99 " "|"\t" {
100 }
101 . {
102 MDBG (("char = %x, %d\n", yytext[0], yytext[0]));
103 return yytext[0];
104 }
105 %%
106
107 #ifndef yywrap
108 int
109 yywrap ()
110 {
111 return 1;
112 }
113 #endif
This page took 0.034076 seconds and 5 git commands to generate.