PR binutils/16218
[deliverable/binutils-gdb.git] / gas / itbl-lex.l
CommitLineData
252b5132 1/* itbl-lex.l
ec2655a6 2 Copyright 1997, 1998, 2001, 2002, 2005, 2006, 2007
ebd1c875 3 Free Software Foundation, Inc.
252b5132
RH
4
5 This file is part of GAS, the GNU Assembler.
6
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
ec2655a6 9 the Free Software Foundation; either version 3, or (at your option)
252b5132
RH
10 any later version.
11
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
4b4da160
NC
19 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
252b5132
RH
21
22%{
ebd1c875 23#include "as.h"
f17c130b 24#include "itbl-lex.h"
3d82a647 25#include <itbl-parse.h>
252b5132
RH
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
35int insntbl_line = 1;
36%}
37
38ALNUM [A-Za-z0-9_]
39DIGIT [0-9]
40ALPHA [A-Za-z_]
41HEX [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
108int
109yywrap ()
110 {
111 return 1;
112 }
113#endif
This page took 0.574877 seconds and 4 git commands to generate.