%{
/* Command-line: gperf -o -i 1 -C -k 1-3,$ -L C -H keyword_hash -N check_identifier -tT lexor_keyword.gperf */

#include "config.h"
#include "parse_misc.h"
#include "parse.h"
#include <string.h>
#include "lexor_keyword.h"

%}
struct lexor_keyword { const char*name; int tokenType; };
%%
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
localparam,	K_localparam
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
real,		K_real
realtime,	K_realtime
reg,		K_reg
release,	K_release
repeat,		K_repeat
rnmos,		K_rnmos
rpmos,		K_rpmos
rtran,		K_rtran
rtranif0,	K_rtranif0
rtranif1,	K_rtranif1
scalared,	K_scalared
signed,		K_signed
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
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;
}
