1999-09-29 03:50:35 +02:00
|
|
|
%{
|
|
|
|
|
/* Command-line: gperf -o -i 1 -C -k 1-3,$ -L C -H keyword_hash -N check_identifier -tT lexor_keyword.gperf */
|
|
|
|
|
|
|
|
|
|
#include "parse_misc.h"
|
|
|
|
|
#include "parse.h"
|
|
|
|
|
#include <string.h>
|
2000-03-12 18:09:40 +01:00
|
|
|
#include "lexor_keyword.h"
|
1999-09-29 03:50:35 +02:00
|
|
|
|
|
|
|
|
%}
|
2000-03-12 18:09:40 +01:00
|
|
|
struct lexor_keyword { const char*name; int tokenType; };
|
1999-09-29 03:50:35 +02:00
|
|
|
%%
|
|
|
|
|
always, K_always
|
|
|
|
|
and, K_and
|
|
|
|
|
assign, K_assign
|
|
|
|
|
begin, K_begin
|
|
|
|
|
buf, K_buf
|
|
|
|
|
bufif0, K_bufif0
|
|
|
|
|
bufif1, K_bufif1
|
|
|
|
|
case, K_case
|
|
|
|
|
casex, K_casex
|
|
|
|
|
casez, K_casez
|
|
|
|
|
cmos, K_cmos
|
|
|
|
|
deassign, K_deassign
|
|
|
|
|
default, K_default
|
|
|
|
|
defparam, K_defparam
|
|
|
|
|
disable, K_disable
|
|
|
|
|
edge, K_edge
|
|
|
|
|
else, K_else
|
|
|
|
|
end, K_end
|
|
|
|
|
endcase, K_endcase
|
|
|
|
|
endfunction, K_endfunction
|
|
|
|
|
endmodule, K_endmodule
|
|
|
|
|
endprimitive, K_endprimitive
|
|
|
|
|
endspecify, K_endspecify
|
|
|
|
|
endtable, K_endtable
|
|
|
|
|
endtask, K_endtask
|
|
|
|
|
event, K_event
|
|
|
|
|
for, K_for
|
|
|
|
|
force, K_force
|
|
|
|
|
forever, K_forever
|
|
|
|
|
fork, K_fork
|
|
|
|
|
function, K_function
|
|
|
|
|
highz0, K_highz0
|
|
|
|
|
highz1, K_highz1
|
|
|
|
|
if, K_if
|
|
|
|
|
initial, K_initial
|
|
|
|
|
inout, K_inout
|
|
|
|
|
input, K_input
|
|
|
|
|
integer, K_integer
|
|
|
|
|
join, K_join
|
|
|
|
|
large, K_large
|
2000-03-12 18:09:40 +01:00
|
|
|
localparam, K_localparam
|
1999-09-29 03:50:35 +02:00
|
|
|
macromodule, K_macromodule
|
|
|
|
|
medium, K_medium
|
|
|
|
|
module, K_module
|
|
|
|
|
nand, K_nand
|
|
|
|
|
negedge, K_negedge
|
|
|
|
|
nmos, K_nmos
|
|
|
|
|
nor, K_nor
|
|
|
|
|
not, K_not
|
|
|
|
|
notif0, K_notif0
|
|
|
|
|
notif1, K_notif1
|
|
|
|
|
or, K_or
|
|
|
|
|
output, K_output
|
|
|
|
|
parameter, K_parameter
|
|
|
|
|
pmos, K_pmos
|
|
|
|
|
posedge, K_posedge
|
|
|
|
|
primitive, K_primitive
|
|
|
|
|
pull0, K_pull0
|
|
|
|
|
pull1, K_pull1
|
|
|
|
|
pulldown, K_pulldown
|
|
|
|
|
pullup, K_pullup
|
|
|
|
|
rcmos, K_rcmos
|
2000-12-05 23:32:05 +01:00
|
|
|
real, K_real
|
|
|
|
|
realtime, K_realtime
|
1999-09-29 03:50:35 +02:00
|
|
|
reg, K_reg
|
|
|
|
|
release, K_release
|
|
|
|
|
repeat, K_repeat
|
|
|
|
|
rnmos, K_rnmos
|
|
|
|
|
rpmos, K_rpmos
|
|
|
|
|
rtran, K_rtran
|
|
|
|
|
rtranif0, K_rtranif0
|
|
|
|
|
rtranif1, K_rtranif1
|
|
|
|
|
scalered, K_scalered
|
2000-04-02 06:25:39 +02:00
|
|
|
signed, K_signed
|
1999-09-29 03:50:35 +02:00
|
|
|
small, K_small
|
|
|
|
|
specify, K_specify
|
|
|
|
|
specparam, K_specparam
|
|
|
|
|
strong0, K_strong0
|
|
|
|
|
strong1, K_strong1
|
|
|
|
|
supply0, K_supply0
|
|
|
|
|
supply1, K_supply1
|
|
|
|
|
table, K_table
|
|
|
|
|
task, K_task
|
|
|
|
|
time, K_time
|
|
|
|
|
tran, K_tran
|
|
|
|
|
tranif0, K_tranif0
|
|
|
|
|
tranif1, K_tranif1
|
|
|
|
|
tri, K_tri
|
|
|
|
|
tri0, K_tri0
|
|
|
|
|
tri1, K_tri1
|
|
|
|
|
triand, K_triand
|
|
|
|
|
trior, K_trior
|
|
|
|
|
trireg, K_trireg
|
|
|
|
|
vectored, K_vectored
|
|
|
|
|
wait, K_wait
|
|
|
|
|
wand, K_wand
|
|
|
|
|
weak0, K_weak0
|
|
|
|
|
weak1, K_weak1
|
|
|
|
|
while, K_while
|
|
|
|
|
wire, K_wire
|
|
|
|
|
wor, K_wor
|
|
|
|
|
xnor, K_xnor
|
2000-03-12 18:09:40 +01:00
|
|
|
xor, K_xor
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
int lexor_keyword_code(const char*str, unsigned nstr)
|
|
|
|
|
{
|
|
|
|
|
const struct lexor_keyword*rc = check_identifier(str, nstr);
|
|
|
|
|
if (rc == 0)
|
|
|
|
|
return IDENTIFIER;
|
|
|
|
|
else
|
|
|
|
|
return rc->tokenType;
|
|
|
|
|
}
|