OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [gas/] [itbl-lex.l] - Blame information for rev 221

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 205 julius
/* itbl-lex.l
2
   Copyright 1997, 1998, 2001, 2002, 2005, 2006, 2007
3
   Free Software Foundation, Inc.
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
9
   the Free Software Foundation; either version 3, or (at your option)
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
19
   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20
   02110-1301, USA.  */
21
 
22
%{
23
#include "as.h"
24
#include "itbl-lex.h"
25
#include 
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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.