47 #include "tokens_vcd.h"
51 # define strrchr rindex
58 EXPONENT [Ee][+-]?{DIGIT}+
60 REAL [+-]?{DIGIT}+(
"."{DIGIT}+)?{EXPONENT}?
65 IDENT [a-zA-
Z_][a-zA-
Z0-9_.-]*
67 %
x COMMENT SCALE SCOPE IGNORE VAR VAR2 VAR3 VAR4 DUMP TIMESTAMP CHANGE
70 %option yylineno noyywrap nounput
prefix=
"vcd_"
74 <INITIAL,COMMENT,SCALE,SCOPE,IGNORE,VAR4,DUMP>
"$end" {
89 <INITIAL>
"$enddefinitions" {
90 return t_ENDDEFINITIONS;
98 <INITIAL>
"$timescale" {
103 <SCALE>
"1" {
return ONE; }
104 <SCALE>
"10" {
return TEN; }
105 <SCALE>
"100" {
return HUNDRET; }
107 <SCALE>
"s" {
return SECOND; }
108 <SCALE>
"ms" {
return MILLI; }
109 <SCALE>
"us" {
return MICRO; }
110 <SCALE>
"ns" {
return NANO; }
111 <SCALE>
"ps" {
return PICO; }
112 <SCALE>
"fs" {
return FEMTO; }
114 <INITIAL>
"$upscope" {
123 <VAR>
"event" {
return EVENT; }
124 <VAR>
"integer" {
return INTEGER; }
126 <VAR>
"real" {
return REAL; }
127 <VAR>
"reg" {
return REG; }
128 <VAR>
"supply0" {
return SUPPLY0; }
129 <VAR>
"supply1" {
return SUPPLY1; }
130 <VAR>
"time" {
return TIME; }
131 <VAR>
"tri" {
return TRI; }
132 <VAR>
"triand" {
return TRIAND; }
133 <VAR>
"trior" {
return TRIOR; }
134 <VAR>
"trireg" {
return TRIREG; }
135 <VAR>
"tri0" {
return TRI0; }
136 <VAR>
"tri1" {
return TRI1; }
137 <VAR>
"wand" {
return WAND; }
138 <VAR>
"wire" {
return WIRE; }
139 <VAR>
"wor" {
return WOR; }
142 vcd_lval.value = strdup (vcd_text);
148 vcd_lval.value = strdup (vcd_text);
154 vcd_lval.value = strdup (
"X");
160 vcd_lval.value = strdup (
"Z");
165 <TIMESTAMP>{DECIMAL} {
166 vcd_lval.real = strtod (vcd_text, NULL);
168 return PositiveHugeInteger;
182 vcd_lval.value = strdup (vcd_text);
188 vcd_lval.value = strdup (vcd_text);
189 char * p = vcd_lval.value;
190 while (*p) { *p = toupper (*p); p++; }
195 <INITIAL>
"$version" {
200 <INITIAL>
"$dumpall" {
204 <INITIAL>
"$dumpoff" {
212 <INITIAL>
"$dumpvars" {
217 <SCOPE>
"module" {
return s_MODULE; }
218 <SCOPE>
"task" {
return s_TASK; }
220 <SCOPE>
"fork" {
return s_FORK; }
221 <SCOPE>
"begin" {
return s_BEGIN; }
229 vcd_lval.ident = strdup (vcd_text);
234 vcd_lval.integer = atoi (vcd_text);
240 vcd_lval.ident = strdup (vcd_text);
246 vcd_lval.ident = strdup (vcd_text);
251 <VAR4>
"[" {
return '['; }
252 <VAR4>
"]" {
return ']'; }
253 <VAR4>
":" {
return ':'; }
254 <VAR4>
"(" {
return '('; }
255 <VAR4>
")" {
return ')'; }
258 vcd_lval.integer = atoi (vcd_text);
263 vcd_lval.ident = strdup (vcd_text);
268 <IGNORE,COMMENT>. { }
273 "line %d: syntax error, unrecognized character: `%s'\n",
t_TIMESCALE TimeScaleDeclaration t_END t_UPSCOPE t_END
< INITIAL >< INITIAL >< INITIAL >< INITIAL > return InvalidCharacter
#define Z0
Wave impedance in vacuum ( )