* itbl-ops.c: New file. Add support for dynamically read
[deliverable/binutils-gdb.git] / gas / itbl-lex.l
1 %{
2 #include <stdio.h>
3 #include <string.h>
4 #include <stdlib.h>
5 #include <ctype.h>
6 #include "itbl-parse.h"
7
8 #ifdef DEBUG
9 #define DBG(x) printf x
10 #define MDBG(x) printf x
11 #else
12 #define DBG(x)
13 #define MDBG(x)
14 #endif
15
16 int insntbl_line = 1;
17 %}
18
19 ALNUM [A-Za-z0-9_]
20 DIGIT [0-9]
21 ALPHA [A-Za-z_]
22 HEX [0-9A-Fa-f]
23
24 %%
25
26 "creg"|"CREG" {
27 return CREG;
28 }
29 "dreg"|"DREG" {
30 return DREG;
31 }
32 "greg"|"GREG" {
33 return GREG;
34 }
35 "immed"|"IMMED" {
36 return IMMED;
37 }
38 "addr"|"ADDR" {
39 return ADDR;
40 }
41 "insn"|"INSN" {
42 return INSN;
43 }
44 "p"{DIGIT} {
45 yytext[yyleng]=0;
46 yylval.processor = strtoul(yytext+1,0,0);
47 return PNUM;
48 }
49 {DIGIT}+ {
50 yytext[yyleng]=0;
51 yylval.num = strtoul(yytext,0,0);
52 return NUM;
53 }
54 "0x"{HEX}+ {
55 yytext[yyleng]=0;
56 yylval.num = strtoul(yytext,0,0);
57 return NUM;
58 }
59 {ALPHA}{ALNUM}* {
60 yytext[yyleng]=0;
61 yylval.str = strdup(yytext);
62 return ID;
63 }
64 ";"|"#" {
65 int c;
66 while ((c = input()) != EOF) {
67 if (c == '\n')
68 {
69 unput(c);
70 break;
71 }
72 }
73 }
74 "\n" {
75 insntbl_line++;
76 MDBG(("in lex, NL=%d (x%x)\n",NL,NL));
77 return NL;
78 }
79 " "|"\t" { }
80 . {
81 MDBG(("char=%x,%d\n",yytext[0],yytext[0]));
82 return yytext[0];
83 }
84 %%
85
86 int yywrap() { return 1; }
This page took 0.041549 seconds and 5 git commands to generate.