Bochs/bochs/debug/lexer.l
Bryce Denney 0a7cb3a43c - apply patch.ifdef-disabled-options. Comments from that patch are below:
For a whole lot of configure options, I put #if...#endif around code that
  is specific to the option, even in files which are normally only compiled
  when the option is on.  This allows me to create a MS Visual C++ 6.0
  workspace that supports many of these options.  The workspace will basically
  compile every file all the time, but the code for disabled options will
  be commented out by the #if...#endif.

  This may one day lead to simplification of the Makefiles and configure
  scripts, but for the moment I'm leaving Makefiles and configure scripts
  alone.

  Affected options:
    BX_SUPPORT_APIC (cpu/apic.cc)
    BX_SUPPORT_X86_64 (cpu/*64.cc)
    BX_DEBUGGER (debug/*)
    BX_DISASM (disasm/*)
    BX_WITH_nameofgui (gui/*)
    BX_SUPPORT_CDROM (iodev/cdrom.cc)
    BX_NE2K_SUPPORT (iodev/eth*.cc, iodev/ne2k.cc)
    BX_SUPPORT_APIC (iodev/ioapic.cc)
    BX_IODEBUG_SUPPORT (iodev/iodebug.cc)
    BX_PCI_SUPPORT (iodev/pci*.cc)
    BX_SUPPORT_SB16 (iodev/sb*.cc)

Modified Files:
  cpu/apic.cc cpu/arith64.cc cpu/ctrl_xfer64.cc
  cpu/data_xfer64.cc cpu/fetchdecode64.cc cpu/logical64.cc
  cpu/mult64.cc cpu/resolve64.cc cpu/shift64.cc cpu/stack64.cc
  debug/Makefile.in debug/crc.cc debug/dbg_main.cc debug/lexer.l
  debug/linux.cc debug/parser.c debug/parser.y
  disasm/dis_decode.cc disasm/dis_groups.cc gui/amigaos.cc
  gui/beos.cc gui/carbon.cc gui/macintosh.cc gui/rfb.cc
  gui/sdl.cc gui/term.cc gui/win32.cc gui/wx.cc gui/wxdialog.cc
  gui/wxmain.cc gui/x.cc iodev/cdrom.cc iodev/eth.cc
  iodev/eth_arpback.cc iodev/eth_fbsd.cc iodev/eth_linux.cc
  iodev/eth_null.cc iodev/eth_packetmaker.cc iodev/eth_tap.cc
  iodev/eth_tuntap.cc iodev/eth_win32.cc iodev/ioapic.cc
  iodev/iodebug.cc iodev/ne2k.cc iodev/pci.cc iodev/pci2isa.cc
  iodev/sb16.cc iodev/soundlnx.cc iodev/soundwin.cc
2002-11-19 05:47:45 +00:00

178 lines
9.1 KiB
Plaintext

%{
/////////////////////////////////////////////////////////////////////////
// $Id: lexer.l,v 1.10 2002-11-19 05:47:44 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <string.h>
#include "debug.h"
#if BX_DEBUGGER
#include "parser.h"
int bx_yyinput(char *buf, int max_size);
#undef YY_INPUT
#define YY_INPUT(buf, ret, max_size) (ret = bx_yyinput(buf, max_size))
static char *lex_input_ptr = NULL;
static unsigned lex_input_size = 0;
%}
%%
[ \t]+ ; // eat up whitespace
set { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SET); }
dis { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DIS); }
on { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ON); }
off { bxlval.sval = strdup(bxtext); return(BX_TOKEN_OFF); }
crc { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CRC); }
c { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTINUE); }
stepi |
step |
si |
s { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STEPN); }
vb { bxlval.sval = strdup(bxtext); return(BX_TOKEN_VBREAKPOINT); }
vbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_VBREAKPOINT); }
lb { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LBREAKPOINT); }
lbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LBREAKPOINT); }
pb { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PBREAKPOINT); }
pbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PBREAKPOINT); }
info { bxlval.sval = strdup(bxtext); return(BX_TOKEN_INFO); }
break { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PBREAKPOINT); }
b { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PBREAKPOINT); }
program { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PROGRAM); }
cr |
creg |
cregs { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTROL_REGS); }
r |
reg |
registers { bxlval.sval = strdup(bxtext); return(BX_TOKEN_REGISTERS); }
fpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_FPU); }
all { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ALL); }
idt { bxlval.sval = strdup(bxtext); return(BX_TOKEN_IDT); }
gdt { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GDT); }
ldt { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LDT); }
tss { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TSS); }
dirty { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DIRTY); }
linux { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LINUX); }
dump_cpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DUMP_CPU); }
delete { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DEL_BREAKPOINT); }
del { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DEL_BREAKPOINT); }
d { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DEL_BREAKPOINT); }
quit { bxlval.sval = strdup(bxtext); return(BX_TOKEN_QUIT); }
q { bxlval.sval = strdup(bxtext); return(BX_TOKEN_QUIT); }
x { bxlval.sval = strdup(bxtext); return(BX_TOKEN_EXAMINE); }
xp { bxlval.sval = strdup(bxtext); return(BX_TOKEN_EXAMINE); }
setpmem { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SETPMEM); }
query { bxlval.sval = strdup(bxtext); return(BX_TOKEN_QUERY); }
pending { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PENDING); }
take { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TAKE); }
dma { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DMA); }
irq { bxlval.sval = strdup(bxtext); return(BX_TOKEN_IRQ); }
set_cpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SET_CPU); }
disas |
disassemble { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DISASSEMBLE); }
maths { bxlval.sval = strdup(bxtext); return(BX_TOKEN_MATHS); }
add { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ADD); }
sub { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SUB); }
mul { bxlval.sval = strdup(bxtext); return(BX_TOKEN_MUL); }
div { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DIV); }
instrument { bxlval.sval = strdup(bxtext); return(BX_TOKEN_INSTRUMENT); }
start { bxlval.sval = strdup(bxtext); return(BX_TOKEN_START); }
stop { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STOP); }
reset { bxlval.sval = strdup(bxtext); return(BX_TOKEN_RESET); }
print { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PRINT); }
loader { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LOADER); }
doit { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DOIT); }
trace-on { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TRACEON); }
trace-off { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TRACEOFF); }
trace-reg-on { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TRACEREGON); }
trace-reg-off { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TRACEREGOFF); }
ptime { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PTIME); }
sb { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TIMEBP); }
sba { bxlval.sval = strdup(bxtext); return(BX_TOKEN_TIMEBP_ABSOLUTE); }
record { bxlval.sval = strdup(bxtext); return(BX_TOKEN_RECORD); }
playback { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PLAYBACK); }
modebp { bxlval.sval = strdup(bxtext); return(BX_TOKEN_MODEBP); }
print-stack { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PRINT_STACK); }
watch { bxlval.sval = strdup(bxtext); return(BX_TOKEN_WATCH); }
unwatch { bxlval.sval = strdup(bxtext); return(BX_TOKEN_UNWATCH); }
read { bxlval.sval = strdup(bxtext); return(BX_TOKEN_READ); }
write { bxlval.sval = strdup(bxtext); return(BX_TOKEN_WRITE); }
continue { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTINUE); }
show { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SHOW); }
load-symbols { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYMBOL); }
global { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GLOBAL); }
where { bxlval.sval = strdup(bxtext); return(BX_TOKEN_WHERE); }
print-string { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PRINT_STRING); }
diff-memory { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DIFF_MEMORY); }
sync-memory { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYNC_MEMORY); }
sync-cpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYNC_CPU); }
fast-forward { bxlval.sval = strdup(bxtext); return(BX_TOKEN_FAST_FORWARD); }
phy2log { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PHY_2_LOG); }
addr-info { bxlval.sval = strdup(bxtext); return(BX_TOKEN_INFO_ADDRESS); }
ne2k { bxlval.sval = strdup(bxtext); return(BX_TOKEN_NE2000); }
ne2000 { bxlval.sval = strdup(bxtext); return(BX_TOKEN_NE2000); }
page { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PAGE); }
cs { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CS); }
es { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ES); }
ss { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SS); }
ds { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DS); }
fs { bxlval.sval = strdup(bxtext); return(BX_TOKEN_FS); }
gs { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GS); }
force-check { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ALWAYS_CHECK); }
v2l { bxlval.sval = strdup(bxtext); return(BX_TOKEN_V2L); }
help { bxlval.sval = strdup(bxtext); return(BX_TOKEN_HELP); }
\"[^\"\n]*\" { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STRING); }
\/[0-9]*[xduotcsibhwg][xduotcsibhwg] { bxlval.sval = strdup(bxtext); return(BX_TOKEN_XFORMAT); }
\/[0-9]*[xduotcsibhwg] { bxlval.sval = strdup(bxtext); return(BX_TOKEN_XFORMAT); }
\/[0-9]+ { bxlval.sval = strdup(bxtext); return(BX_TOKEN_XFORMAT); }
0x[0-9a-fA-F]+ { bxlval.uval = strtoul(bxtext+2, NULL, 16); return(BX_TOKEN_NUMERIC); }
0[0-7]+ { bxlval.uval = strtoul(bxtext+1, NULL, 8); return(BX_TOKEN_NUMERIC); }
[0-9]+L { bxlval.ulval = strtoull(bxtext, NULL, 10); return(BX_TOKEN_LONG_NUMERIC); }
[0-9]+ { bxlval.uval = strtoul(bxtext, NULL, 10); return(BX_TOKEN_NUMERIC); }
$[a-zA-Z_][a-zA-Z0-9_]* { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYMBOLNAME); }
\n { return('\n'); }
[#][^\n]* ; // eat up comments '//'
. { return(bxtext[0]); }
%%
// [A-Za-z_][A-Za-z0-9_]* { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERIC); }
int
bx_yyinput(char *buf, int max_size)
{
int len;
if (lex_input_size == 0) {
fprintf(stderr, "lex: no characters in string input buffer.\n");
exit(1);
}
len = strlen(lex_input_ptr);
if (len > max_size)
max_size = len;
memcpy(buf, lex_input_ptr, max_size);
lex_input_size -= max_size;
return(max_size);
}
void
bx_add_lex_input(char *buf)
{
lex_input_ptr = buf;
lex_input_size = strlen(buf);
// Since we're parsing from strings, flush out
// all current buffer state, so the next read
// requests from yyinput
bx_flush_buffer( YY_CURRENT_BUFFER );
}
#endif /* if BX_DEBUGGER */