summaryrefslogtreecommitdiff
path: root/board/MAI/bios_emulator/scitech/src/v86bios/lex.l
blob: 3a3391c7b410d877a02a52ef2db4a9d6b8d00183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
%{
#include "parser.h"

#include <string.h>
#include <stdio.h>

 void getline(char *buf,int *num,int max_num);
    
#define YY_INPUT(buf,result,max_size) {\
      getline(buf,&result,max_size);\
      }

 void
 yyerror (char *s)  
 {
     printf ("%s\n", s);
 }

%}

DIGIT [0-9a-fA-F]

%%

"0x"?{DIGIT}+ { yylval = strtol(yytext,NULL,0); return TOK_NUM; }
"ax"          { return TOK_REG_AX; }
"bx"          { return TOK_REG_BX; }
"cx"          { return TOK_REG_CX; }
"dx"          { return TOK_REG_DX; }
"di"          { return TOK_REG_SI; }
"si"          { return TOK_REG_DI; }
"ds"          { return TOK_SEG_DS; }
"es"          { return TOK_SEG_ES; }
":"           { return TOK_SEP;}
"$"{DIGIT}{1,2} { yylval = strtol(yytext+1,NULL,0); return TOK_VAR; }
"$mem"        { return TOK_VAR_MEM; }
[ \t]+
"#".*[\n]   { return TOK_END; }
"boot"        { return TOK_COMMAND_BOOT; }
"do"          { return TOK_COMMAND_EXEC; }
"\"".*"\""    { yylval = (unsigned long) yytext; return TOK_STRING; }
"byte"        { return TOK_BYTE; }
"word"        { return TOK_WORD; }
"long"        { return TOK_LONG; }
"setmem"      { return TOK_COMMAND_MEMSET; }
"dumpmem"     { return TOK_COMMAND_MEMDUMP; }
"quit"        { return TOK_COMMAND_QUIT; }
"\n"          { return TOK_END; }
"select"      { return TOK_SELECT; }
"isa"         { return TOK_ISA; }
"pci"         { return TOK_PCI; }
"pport"       { return TOK_PRINT_PORT; }
"iostat"      { return TOK_IOSTAT; }
"pirq"        { return TOK_PRINT_IRQ; }
"ppci"        { return TOK_PPCI; }
"pip"         { return TOK_PIP; }
"trace"       { return TOK_TRACE; }
"on"          { return TOK_ON; }
"off"         { return TOK_OFF; }
"verbose"     { return TOK_VERBOSE; }
"log"         { return TOK_LOG; }
"print"       { return TOK_STDOUT; }
"clstat"      { return TOK_CLSTAT; }
"hlt"         { return TOK_HLT; }
"del"         { return TOK_DEL; }
"ioperm"      { return TOK_IOPERM; }
"lpci"        { return TOK_DUMP_PCI; }
"bootbios"    { return TOK_BOOT_BIOS; }
"?"           { return '?'; }
.             { return TOK_ERROR; }
    
%%