binutils-gdb/gas/itbl-lex.l

106 lines
2.0 KiB
Plaintext
Raw Normal View History

%option noyywrap
1999-05-03 15:29:11 +08:00
/* itbl-lex.l
Copyright (C) 1997-2021 Free Software Foundation, Inc.
1999-05-03 15:29:11 +08:00
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
2007-07-03 19:01:12 +08:00
the Free Software Foundation; either version 3, or (at your option)
1999-05-03 15:29:11 +08:00
any later version.
2015-08-12 19:40:42 +08:00
GAS is distributed in the hope that it will be useful,
1999-05-03 15:29:11 +08:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
1999-05-03 15:29:11 +08:00
%{
* tc.h (struct relax_type, relax_typeS): Move from here.. * as.h: ..to here. Make rlx_forward and rlx_backward an offsetT. * ecoff.c (ecoff_new_file): Add appfile param. * ecoff.h (ecoff_new_file): Likewise. * itbl-lex.h: New file. * itbl-lex.l: Include itbl-lex.h. * itbl-parse.y: Likewise. (insntbl_line, yyparse, yylex): Move to itbl-lex.h. * read.c (s_app_file_string): Mark appfile possibly unused. * subsegs.c (seg_not_empty_p): Make sec possibly unused. * subsegs.h (struct seg_info_trash): Delete. (seg_info): Use segment_info_type instead. * config/obj-coff.c (struct filename_list): Make filename const char *. * config/obj-ecoff.h (obj_app_file): Pass app to ecoff_new_file. * config/obj-elf.c (elf_file_symbol): Similarly. * config/tc-a29k.c (md_apply_fix3): Make val a valueT. Don't use signed right shift. * config/tc-arc.c (md_operand): Warning fix. * config/tc-arm.c (arm_parse_reloc): Only define when OBJ_ELF. (md_begin): Rearrange #if defined OBJ_COFF || defined OBJ_ELF. * config/tc-cris.h (TC_IMPLICIT_LCOMM_ALIGNMENT): Use do while. * config/tc-frv.c (frv_force_relocation): Warning fix. * config/tc-m68k.c (md_parse_option): Delete unused var. * config/tc-mcore.c (mylog2): Rename from log2 throughout. * config/tc-sparc.c: Likewise. (s_common): Warning fix. * config/tc-mips.c (append_insn): Use unsigned long long expressions. * config/tc-mmix.c (PUSHJSTUB_MAX, PUSHJSTUB_MIN): Define from addressT. * config/tc-s390.c (s390_insn): Delete test of unsigned >= 0. * config/tc-sh.c (sh_cfi_frame_initial_instructions, sh_regname_to_dw2regnum): Only define for OBJ_ELF. * config/tc-tic4x.c (tic4x_insert_reg): Use ISLOWER. (tic4x_do_align): Use TIC_NOP_OPCODE. * config/tc-tic4x.h (TIC_NOP_OPCODE): Rename from NOP_OPCODE. * config/tc-vax.c: Include netinet/in.h. (tc_headers_hook): Formatting. * config/tc-xstormy16.c (md_pcrel_from_section): Correct parens.
2005-02-17 21:46:05 +08:00
#include "itbl-lex.h"
#include <itbl-parse.h>
1999-05-03 15:29:11 +08:00
#ifdef DEBUG
#define DBG(x) printf x
#define MDBG(x) printf x
#else
#define DBG(x)
#define MDBG(x)
#endif
int insntbl_line = 1;
%}
ALNUM [A-Za-z0-9_]
DIGIT [0-9]
ALPHA [A-Za-z_]
HEX [0-9A-Fa-f]
%%
"creg"|"CREG" {
return CREG;
}
"dreg"|"DREG" {
return DREG;
}
"greg"|"GREG" {
return GREG;
}
"immed"|"IMMED" {
return IMMED;
}
"addr"|"ADDR" {
return ADDR;
}
"insn"|"INSN" {
return INSN;
}
"p"{DIGIT} {
yytext[yyleng] = 0;
yylval.processor = strtoul (yytext+1, 0, 0);
return PNUM;
}
{DIGIT}+ {
yytext[yyleng] = 0;
yylval.num = strtoul (yytext, 0, 0);
return NUM;
}
"0x"{HEX}+ {
yytext[yyleng] = 0;
yylval.num = strtoul (yytext, 0, 0);
return NUM;
}
{ALPHA}{ALNUM}* {
yytext[yyleng] = 0;
yylval.str = strdup (yytext);
return ID;
}
";"|"#" {
int c;
2015-08-12 19:40:42 +08:00
while ((c = input ()) != EOF)
1999-05-03 15:29:11 +08:00
{
2015-08-12 19:40:42 +08:00
if (c == '\n')
1999-05-03 15:29:11 +08:00
{
unput (c);
break;
}
}
}
2015-08-12 19:40:42 +08:00
"\n" {
insntbl_line++;
1999-05-03 15:29:11 +08:00
MDBG (("in lex, NL = %d (x%x)\n", NL, NL));
2015-08-12 19:40:42 +08:00
return NL;
1999-05-03 15:29:11 +08:00
}
2015-08-12 19:40:42 +08:00
" "|"\t" {
1999-05-03 15:29:11 +08:00
}
. {
MDBG (("char = %x, %d\n", yytext[0], yytext[0]));
return yytext[0];
}
%%