133965Sjdp/* itbl-lex.l 2218822Sdim Copyright 1997, 1998, 2001, 2002, 2005, 2006 3218822Sdim Free Software Foundation, Inc. 433965Sjdp 533965Sjdp This file is part of GAS, the GNU Assembler. 633965Sjdp 733965Sjdp GAS is free software; you can redistribute it and/or modify 833965Sjdp it under the terms of the GNU General Public License as published by 933965Sjdp the Free Software Foundation; either version 2, or (at your option) 1033965Sjdp any later version. 1133965Sjdp 1233965Sjdp GAS is distributed in the hope that it will be useful, 1333965Sjdp but WITHOUT ANY WARRANTY; without even the implied warranty of 1433965Sjdp MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1533965Sjdp GNU General Public License for more details. 1633965Sjdp 1733965Sjdp You should have received a copy of the GNU General Public License 1833965Sjdp along with GAS; see the file COPYING. If not, write to the Free 19218822Sdim Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 20218822Sdim 02110-1301, USA. */ 2133965Sjdp 2233965Sjdp%{ 23218822Sdim#include "as.h" 24218822Sdim#include "itbl-lex.h" 25107492Sobrien#include <itbl-parse.h> 26107492Sobrien 2733965Sjdp#ifdef DEBUG 2833965Sjdp#define DBG(x) printf x 2933965Sjdp#define MDBG(x) printf x 3033965Sjdp#else 3133965Sjdp#define DBG(x) 3233965Sjdp#define MDBG(x) 3333965Sjdp#endif 3433965Sjdp 3533965Sjdpint insntbl_line = 1; 3633965Sjdp%} 3733965Sjdp 3833965SjdpALNUM [A-Za-z0-9_] 3933965SjdpDIGIT [0-9] 4033965SjdpALPHA [A-Za-z_] 4133965SjdpHEX [0-9A-Fa-f] 4233965Sjdp 4333965Sjdp%% 4433965Sjdp 4533965Sjdp"creg"|"CREG" { 4633965Sjdp return CREG; 4733965Sjdp } 4833965Sjdp"dreg"|"DREG" { 4933965Sjdp return DREG; 5033965Sjdp } 5133965Sjdp"greg"|"GREG" { 5233965Sjdp return GREG; 5333965Sjdp } 5433965Sjdp"immed"|"IMMED" { 5533965Sjdp return IMMED; 5633965Sjdp } 5733965Sjdp"addr"|"ADDR" { 5833965Sjdp return ADDR; 5933965Sjdp } 6033965Sjdp"insn"|"INSN" { 6133965Sjdp return INSN; 6233965Sjdp } 6333965Sjdp"p"{DIGIT} { 6433965Sjdp yytext[yyleng] = 0; 6533965Sjdp yylval.processor = strtoul (yytext+1, 0, 0); 6633965Sjdp return PNUM; 6733965Sjdp } 6833965Sjdp{DIGIT}+ { 6933965Sjdp yytext[yyleng] = 0; 7033965Sjdp yylval.num = strtoul (yytext, 0, 0); 7133965Sjdp return NUM; 7233965Sjdp } 7333965Sjdp"0x"{HEX}+ { 7433965Sjdp yytext[yyleng] = 0; 7533965Sjdp yylval.num = strtoul (yytext, 0, 0); 7633965Sjdp return NUM; 7733965Sjdp } 7833965Sjdp{ALPHA}{ALNUM}* { 7933965Sjdp yytext[yyleng] = 0; 8033965Sjdp yylval.str = strdup (yytext); 8133965Sjdp return ID; 8233965Sjdp } 8333965Sjdp";"|"#" { 8433965Sjdp int c; 8533965Sjdp while ((c = input ()) != EOF) 8633965Sjdp { 8733965Sjdp if (c == '\n') 8833965Sjdp { 8933965Sjdp unput (c); 9033965Sjdp break; 9133965Sjdp } 9233965Sjdp } 9333965Sjdp } 9433965Sjdp"\n" { 9533965Sjdp insntbl_line++; 9633965Sjdp MDBG (("in lex, NL = %d (x%x)\n", NL, NL)); 9733965Sjdp return NL; 9833965Sjdp } 9933965Sjdp" "|"\t" { 10033965Sjdp } 10133965Sjdp. { 10233965Sjdp MDBG (("char = %x, %d\n", yytext[0], yytext[0])); 10333965Sjdp return yytext[0]; 10433965Sjdp } 10533965Sjdp%% 10633965Sjdp 10738889Sjdp#ifndef yywrap 10833965Sjdpint 10933965Sjdpyywrap () 11033965Sjdp { 11133965Sjdp return 1; 11233965Sjdp } 11338889Sjdp#endif 114