Merge branch 'master' into verilog-ams
[sverilog.git] / lexor_keyword.gperf
blob980b33c8931360c6ac99130e72f40d7ab290e559
1 %{
2 /* Command-line: gperf -o -i 1 -C -k 1-3,$ -L C -H keyword_hash -N check_identifier -tT lexor_keyword.gperf */
4 #include "config.h"
5 #include "parse_misc.h"
6 #include "parse.h"
7 #include <string.h>
8 #include "lexor_keyword.h"
9 #include "compiler.h"
12 struct lexor_keyword { const char*name; int mask; int tokenType; };
14 abs,            GN_KEYWORDS_VAMS_2_3,   K_abs
15 abstol,         GN_KEYWORDS_VAMS_2_3,   K_abstol
16 access,         GN_KEYWORDS_VAMS_2_3,   K_access
17 acos,           GN_KEYWORDS_VAMS_2_3,   K_acos
18 acosh,          GN_KEYWORDS_VAMS_2_3,   K_acosh
19 always,         GN_KEYWORDS_1364_1995,  K_always
20 analog,         GN_KEYWORDS_VAMS_2_3,   K_analog
21 and,            GN_KEYWORDS_1364_1995,  K_and
22 asin,           GN_KEYWORDS_VAMS_2_3,   K_asin
23 asinh,          GN_KEYWORDS_VAMS_2_3,   K_asinh
24 assign,         GN_KEYWORDS_1364_1995,  K_assign
25 atan,           GN_KEYWORDS_VAMS_2_3,   K_atan
26 atan2,          GN_KEYWORDS_VAMS_2_3,   K_atan2
27 atanh,          GN_KEYWORDS_VAMS_2_3,   K_atanh
28 begin,          GN_KEYWORDS_1364_1995,  K_begin
29 bool,           GN_KEYWORDS_ICARUS,     K_bool
30 buf,            GN_KEYWORDS_1364_1995,  K_buf
31 bufif0,         GN_KEYWORDS_1364_1995,  K_bufif0
32 bufif1,         GN_KEYWORDS_1364_1995,  K_bufif1
33 case,           GN_KEYWORDS_1364_1995,  K_case
34 casex,          GN_KEYWORDS_1364_1995,  K_casex
35 casez,          GN_KEYWORDS_1364_1995,  K_casez
36 ceil,           GN_KEYWORDS_VAMS_2_3,   K_ceil
37 cmos,           GN_KEYWORDS_1364_1995,  K_cmos
38 continuous,     GN_KEYWORDS_VAMS_2_3,   K_continuous
39 cos,            GN_KEYWORDS_VAMS_2_3,   K_cos
40 cosh,           GN_KEYWORDS_VAMS_2_3,   K_cosh
41 ddt_nature,     GN_KEYWORDS_VAMS_2_3,   K_ddt_nature
42 deassign,       GN_KEYWORDS_1364_1995,  K_deassign
43 default,        GN_KEYWORDS_1364_1995,  K_default
44 defparam,       GN_KEYWORDS_1364_1995,  K_defparam
45 disable,        GN_KEYWORDS_1364_1995,  K_disable
46 discipline,     GN_KEYWORDS_VAMS_2_3,   K_discipline
47 discrete,       GN_KEYWORDS_VAMS_2_3,   K_discrete
48 domain,         GN_KEYWORDS_VAMS_2_3,   K_domain
49 edge,           GN_KEYWORDS_1364_1995,  K_edge
50 else,           GN_KEYWORDS_1364_1995,  K_else
51 end,            GN_KEYWORDS_1364_1995,  K_end
52 endcase,        GN_KEYWORDS_1364_1995,  K_endcase
53 enddiscipline,  GN_KEYWORDS_VAMS_2_3,   K_enddiscipline
54 endfunction,    GN_KEYWORDS_1364_1995,  K_endfunction
55 endgenerate,    GN_KEYWORDS_1364_1995,  K_endgenerate
56 endmodule,      GN_KEYWORDS_1364_1995,  K_endmodule
57 endnature,      GN_KEYWORDS_VAMS_2_3,   K_endnature
58 endprimitive,   GN_KEYWORDS_1364_1995,  K_endprimitive
59 endspecify,     GN_KEYWORDS_1364_1995,  K_endspecify
60 endtable,       GN_KEYWORDS_1364_1995,  K_endtable
61 endtask,        GN_KEYWORDS_1364_1995,  K_endtask
62 event,          GN_KEYWORDS_1364_1995,  K_event
63 exclude,        GN_KEYWORDS_VAMS_2_3,   K_exclude
64 exp,            GN_KEYWORDS_VAMS_2_3,   K_exp
65 floor,          GN_KEYWORDS_VAMS_2_3,   K_floor
66 flow,           GN_KEYWORDS_VAMS_2_3,   K_flow
67 for,            GN_KEYWORDS_1364_1995,  K_for
68 force,          GN_KEYWORDS_1364_1995,  K_force
69 forever,        GN_KEYWORDS_1364_1995,  K_forever
70 fork,           GN_KEYWORDS_1364_1995,  K_fork
71 from,           GN_KEYWORDS_VAMS_2_3,   K_from
72 function,       GN_KEYWORDS_1364_1995,  K_function
73 generate,       GN_KEYWORDS_1364_2001,  K_generate
74 genvar,         GN_KEYWORDS_1364_2001,  K_genvar
75 ground,         GN_KEYWORDS_VAMS_2_3,   K_ground
76 highz0,         GN_KEYWORDS_1364_1995,  K_highz0
77 highz1,         GN_KEYWORDS_1364_1995,  K_highz1
78 hypot,          GN_KEYWORDS_VAMS_2_3,   K_hypot
79 idt_nature,     GN_KEYWORDS_VAMS_2_3,   K_idt_nature
80 if,             GN_KEYWORDS_1364_1995,  K_if
81 ifnone,         GN_KEYWORDS_1364_1995,  K_ifnone
82 inf,            GN_KEYWORDS_VAMS_2_3,   K_inf
83 initial,        GN_KEYWORDS_1364_1995,  K_initial
84 inout,          GN_KEYWORDS_1364_1995,  K_inout
85 input,          GN_KEYWORDS_1364_1995,  K_input
86 integer,        GN_KEYWORDS_1364_1995,  K_integer
87 join,           GN_KEYWORDS_1364_1995,  K_join
88 large,          GN_KEYWORDS_1364_1995,  K_large
89 ln,             GN_KEYWORDS_VAMS_2_3,   K_ln
90 localparam,     GN_KEYWORDS_1364_2001,  K_localparam
91 log,            GN_KEYWORDS_VAMS_2_3,   K_log
92 logic,          GN_KEYWORDS_ICARUS,     K_logic
93 macromodule,    GN_KEYWORDS_1364_1995,  K_macromodule
94 max,            GN_KEYWORDS_VAMS_2_3,   K_max
95 medium,         GN_KEYWORDS_1364_1995,  K_medium
96 min,            GN_KEYWORDS_VAMS_2_3,   K_min
97 module,         GN_KEYWORDS_1364_1995,  K_module
98 nand,           GN_KEYWORDS_1364_1995,  K_nand
99 nature,         GN_KEYWORDS_VAMS_2_3,   K_nature
100 negedge,        GN_KEYWORDS_1364_1995,  K_negedge
101 nmos,           GN_KEYWORDS_1364_1995,  K_nmos
102 nor,            GN_KEYWORDS_1364_1995,  K_nor
103 not,            GN_KEYWORDS_1364_1995,  K_not
104 notif0,         GN_KEYWORDS_1364_1995,  K_notif0
105 notif1,         GN_KEYWORDS_1364_1995,  K_notif1
106 or,             GN_KEYWORDS_1364_1995,  K_or
107 output,         GN_KEYWORDS_1364_1995,  K_output
108 parameter,      GN_KEYWORDS_1364_1995,  K_parameter
109 pmos,           GN_KEYWORDS_1364_1995,  K_pmos
110 posedge,        GN_KEYWORDS_1364_1995,  K_posedge
111 potential,      GN_KEYWORDS_VAMS_2_3,   K_potential
112 pow,            GN_KEYWORDS_VAMS_2_3,   K_pow
113 primitive,      GN_KEYWORDS_1364_1995,  K_primitive
114 pull0,          GN_KEYWORDS_1364_1995,  K_pull0
115 pull1,          GN_KEYWORDS_1364_1995,  K_pull1
116 pulldown,       GN_KEYWORDS_1364_1995,  K_pulldown
117 pullup,         GN_KEYWORDS_1364_1995,  K_pullup
118 rcmos,          GN_KEYWORDS_1364_1995,  K_rcmos
119 real,           GN_KEYWORDS_1364_1995,  K_real
120 realtime,       GN_KEYWORDS_1364_1995,  K_realtime
121 reg,            GN_KEYWORDS_1364_1995,  K_reg
122 release,        GN_KEYWORDS_1364_1995,  K_release
123 repeat,         GN_KEYWORDS_1364_1995,  K_repeat
124 rnmos,          GN_KEYWORDS_1364_1995,  K_rnmos
125 rpmos,          GN_KEYWORDS_1364_1995,  K_rpmos
126 rtran,          GN_KEYWORDS_1364_1995,  K_rtran
127 rtranif0,       GN_KEYWORDS_1364_1995,  K_rtranif0
128 rtranif1,       GN_KEYWORDS_1364_1995,  K_rtranif1
129 scalared,       GN_KEYWORDS_1364_1995,  K_scalared
130 signed,         GN_KEYWORDS_1364_2001,  K_signed
131 sin,            GN_KEYWORDS_VAMS_2_3,   K_sin
132 sinh,           GN_KEYWORDS_VAMS_2_3,   K_sinh
133 small,          GN_KEYWORDS_1364_1995,  K_small
134 specify,        GN_KEYWORDS_1364_1995,  K_specify
135 specparam,      GN_KEYWORDS_1364_1995,  K_specparam
136 sqrt,           GN_KEYWORDS_VAMS_2_3,   K_sqrt
137 string,         GN_KEYWORDS_VAMS_2_3,   K_string
138 strong0,        GN_KEYWORDS_1364_1995,  K_strong0
139 strong1,        GN_KEYWORDS_1364_1995,  K_strong1
140 supply0,        GN_KEYWORDS_1364_1995,  K_supply0
141 supply1,        GN_KEYWORDS_1364_1995,  K_supply1
142 table,          GN_KEYWORDS_1364_1995,  K_table
143 tan,            GN_KEYWORDS_VAMS_2_3,   K_tan
144 tanh,           GN_KEYWORDS_VAMS_2_3,   K_tanh
145 task,           GN_KEYWORDS_1364_1995,  K_task
146 time,           GN_KEYWORDS_1364_1995,  K_time
147 tran,           GN_KEYWORDS_1364_1995,  K_tran
148 tranif0,        GN_KEYWORDS_1364_1995,  K_tranif0
149 tranif1,        GN_KEYWORDS_1364_1995,  K_tranif1
150 tri,            GN_KEYWORDS_1364_1995,  K_tri
151 tri0,           GN_KEYWORDS_1364_1995,  K_tri0
152 tri1,           GN_KEYWORDS_1364_1995,  K_tri1
153 triand,         GN_KEYWORDS_1364_1995,  K_triand
154 trior,          GN_KEYWORDS_1364_1995,  K_trior
155 trireg,         GN_KEYWORDS_1364_1995,  K_trireg
156 units,          GN_KEYWORDS_VAMS_2_3,   K_units
157 vectored,       GN_KEYWORDS_1364_1995,  K_vectored
158 wait,           GN_KEYWORDS_1364_1995,  K_wait
159 wand,           GN_KEYWORDS_1364_1995,  K_wand
160 weak0,          GN_KEYWORDS_1364_1995,  K_weak0
161 weak1,          GN_KEYWORDS_1364_1995,  K_weak1
162 while,          GN_KEYWORDS_1364_1995,  K_while
163 wire,           GN_KEYWORDS_1364_1995,  K_wire
164 wone,           GN_KEYWORDS_1364_1995,  K_wone
165 wor,            GN_KEYWORDS_1364_1995,  K_wor
166 xnor,           GN_KEYWORDS_1364_1995,  K_xnor
167 xor,            GN_KEYWORDS_1364_1995,  K_xor
170 int lexor_keyword_mask = 0;
172 int lexor_keyword_code(const char*str, unsigned nstr)
174       const struct lexor_keyword*rc = check_identifier(str, nstr);
175       if (rc == 0)
176           return IDENTIFIER;
177       else if ((rc->mask & lexor_keyword_mask) == 0)
178           return IDENTIFIER;
179       else
180           return rc->tokenType;