1use crate::Span;
7use pyo3::prelude::*;
8use scarf_parser::{self, PreprocessorCache};
9
10#[pyclass(eq, from_py_object, module = "scarf_python", str)]
12#[derive(Clone, PartialEq, Eq)]
13pub enum Token {
14 Error(),
15 Always(),
17 And(),
18 Assign(),
19 Begin(),
20 Buf(),
21 Bufif0(),
22 Bufif1(),
23 Case(),
24 Casex(),
25 Casez(),
26 Cmos(),
27 Deassign(),
28 Default(),
29 Defparam(),
30 Disable(),
31 Edge(),
32 Else(),
33 End(),
34 Endcase(),
35 Endfunction(),
36 Endmodule(),
37 Endprimitive(),
38 Endspecify(),
39 Endtable(),
40 Endtask(),
41 Event(),
42 For(),
43 Force(),
44 Forever(),
45 Fork(),
46 Function(),
47 Highz0(),
48 Highz1(),
49 If(),
50 Ifnone(),
51 Initial(),
52 Inout(),
53 Input(),
54 Integer(),
55 Join(),
56 Large(),
57 Macromodule(),
58 Medium(),
59 Module(),
60 Nand(),
61 Negedge(),
62 Nmos(),
63 Nor(),
64 Not(),
65 Notif0(),
66 Notif1(),
67 Or(),
68 Output(),
69 Parameter(),
70 Pmos(),
71 Posedge(),
72 Primitive(),
73 Pull0(),
74 Pull1(),
75 Pulldown(),
76 Pullup(),
77 Rcmos(),
78 Real(),
79 Realtime(),
80 Reg(),
81 Release(),
82 Repeat(),
83 Rnmos(),
84 Rpmos(),
85 Rtran(),
86 Rtranif0(),
87 Rtranif1(),
88 Scalared(),
89 Small(),
90 Specify(),
91 Specparam(),
92 Strong0(),
93 Strong1(),
94 Supply0(),
95 Supply1(),
96 Table(),
97 Task(),
98 Time(),
99 Tran(),
100 Tranif0(),
101 Tranif1(),
102 Tri(),
103 Tri0(),
104 Tri1(),
105 Triand(),
106 Trior(),
107 Trireg(),
108 Vectored(),
109 Wait(),
110 Wand(),
111 Weak0(),
112 Weak1(),
113 While(),
114 Wire(),
115 Wor(),
116 Xnor(),
117 Xor(),
118 Automatic(),
120 Cell(),
121 Config(),
122 Design(),
123 Endconfig(),
124 Endgenerate(),
125 Generate(),
126 Genvar(),
127 Incdir(),
128 Include(),
129 Instance(),
130 Liblist(),
131 Library(),
132 Localparam(),
133 Noshowcancelled(),
134 PulsestyleOndetect(),
135 PulsestyleOnevent(),
136 Showcancelled(),
137 Signed(),
138 Unsigned(),
139 Use(),
140 Uwire(),
142 Alias(),
144 AlwaysComb(),
145 AlwaysFf(),
146 AlwaysLatch(),
147 Assert(),
148 Assume(),
149 Before(),
150 Bind(),
151 Bins(),
152 Binsof(),
153 Bit(),
154 Break(),
155 Byte(),
156 Chandle(),
157 Class(),
158 Clocking(),
159 Const(),
160 Constraint(),
161 Context(),
162 Continue(),
163 Cover(),
164 Covergroup(),
165 Coverpoint(),
166 Cross(),
167 Dist(),
168 Do(),
169 Endclass(),
170 Endclocking(),
171 Endgroup(),
172 Endinterface(),
173 Endpackage(),
174 Endprogram(),
175 Endproperty(),
176 Endsequence(),
177 Enum(),
178 Expect(),
179 Export(),
180 Extends(),
181 Extern(),
182 Final(),
183 FirstMatch(),
184 Foreach(),
185 Forkjoin(),
186 Iff(),
187 IgnoreBins(),
188 IllegalBins(),
189 Import(),
190 Inside(),
191 Int(),
192 Interface(),
193 Intersect(),
194 JoinAny(),
195 JoinNone(),
196 Local(),
197 Logic(),
198 Longint(),
199 Matches(),
200 Modport(),
201 New(),
202 Null(),
203 Package(),
204 Packed(),
205 Priority(),
206 Program(),
207 Property(),
208 Protected(),
209 Pure(),
210 Rand(),
211 Randc(),
212 Randcase(),
213 Randsequence(),
214 Ref(),
215 Return(),
216 Sequence(),
217 Shortint(),
218 Shortreal(),
219 Solve(),
220 Static(),
221 String(),
222 Struct(),
223 Super(),
224 Tagged(),
225 This(),
226 Throughout(),
227 Timeprecision(),
228 Timeunit(),
229 Type(),
230 Typedef(),
231 Union(),
232 Unique(),
233 Var(),
234 Virtual(),
235 Void(),
236 WaitOrder(),
237 Wildcard(),
238 With(),
239 Within(),
240 AcceptOn(),
242 Checker(),
243 Endchecker(),
244 Eventually(),
245 Global(),
246 Implies(),
247 Let(),
248 Nexttime(),
249 RejectOn(),
250 Restrict(),
251 SAlways(),
252 SEventually(),
253 SNexttime(),
254 SUntil(),
255 SUntilWith(),
256 Strong(),
257 SyncAcceptOn(),
258 SyncRejectOn(),
259 Unique0(),
260 Until(),
261 UntilWith(),
262 Untyped(),
263 Weak(),
264 Implements(),
266 Interconnect(),
267 Nettype(),
268 Soft(),
269 DirUnderscoreFile(),
271 DirUnderscoreLine(),
272 DirBeginKeywords(),
273 DirCelldefine(),
274 DirDefaultNettype(),
275 DirDefine(),
276 DirElse(),
277 DirElsif(),
278 DirEndKeywords(),
279 DirEndcelldefine(),
280 DirEndif(),
281 DirIfdef(),
282 DirIfndef(),
283 DirInclude(),
284 DirLine(),
285 DirNounconnectedDrive(),
286 DirPragma(),
287 DirResetall(),
288 DirTimescale(),
289 DirUnconnectedDrive(),
290 DirUndef(),
291 DirUndefineall(),
292 Plus(),
294 Minus(),
295 Exclamation(),
296 Quest(),
297 Tilde(),
298 Amp(),
299 TildeAmp(),
300 Pipe(),
301 TildePipe(),
302 Caret(),
303 TildeCaret(),
304 CaretTilde(),
305 Star(),
306 Slash(),
307 Percent(),
308 EqEq(),
309 ExclEq(),
310 PlusEq(),
311 MinusEq(),
312 StarEq(),
313 SlashEq(),
314 PercentEq(),
315 AmpEq(),
316 PipeEq(),
317 CaretEq(),
318 EqEqEq(),
319 ExclEqEq(),
320 EqEqQuest(),
321 ExclEqQuest(),
322 AmpAmp(),
323 AmpAmpAmp(),
324 PipePipe(),
325 StarStar(),
326 Lt(),
327 LtEq(),
328 Gt(),
329 GtEq(),
330 GtGt(),
331 LtLt(),
332 GtGtEq(),
333 LtLtEq(),
334 GtGtGt(),
335 LtLtLt(),
336 GtGtGtEq(),
337 LtLtLtEq(),
338 MinusGt(),
339 MinusGtGt(),
340 LtMinusGt(),
341 PlusPlus(),
342 MinusMinus(),
343 PlusColon(),
344 MinusColon(),
345 PlusSlashMinus(),
346 PlusPercentMinus(),
347 Paren(),
349 EParen(),
350 Bracket(),
351 EBracket(),
352 Brace(),
353 EBrace(),
354 Colon(),
355 SColon(),
356 Apost(),
357 Comma(),
358 Period(),
359 Pound(),
360 Dollar(),
361 At(),
362 AtAt(),
363 Eq(),
364 ColonColon(),
365 ColonEq(),
366 ColonSlash(),
367 PoundPound(),
368 PoundMinusPound(),
369 PoundEqPound(),
370 EqGt(),
371 StarGt(),
372 PipeMinusGt(),
373 PipeEqGt(),
374 Bslash(),
375 Std(),
377 PathpulseDollar(),
378 Option(),
379 TypeOption(),
380 Randomize(),
381 Sample(),
382 OneStep(),
383 DollarSetup(),
384 DollarHold(),
385 DollarSetuphold(),
386 DollarRecovery(),
387 DollarRemoval(),
388 DollarRecrem(),
389 DollarSkew(),
390 DollarTimeskew(),
391 DollarFullskew(),
392 DollarPeriod(),
393 DollarWidth(),
394 DollarNochange(),
395 DollarRoot(),
396 DollarUnit(),
397 DollarFatal(),
398 DollarError(),
399 DollarWarning(),
400 DollarInfo(),
401 OnelineComment { text: String },
403 BlockComment { text: String },
404 UnsignedNumber { text: String },
406 FixedPointNumber { text: String },
407 BinaryNumber { text: String },
408 OctalNumber { text: String },
409 DecimalNumber { text: String },
410 HexNumber { text: String },
411 ScientificNumber { text: String },
412 UnbasedUnsizedLiteral { text: String },
413 SystemTfIdentifier { text: String },
415 SimpleIdentifier { text: String },
416 EscapedIdentifier { text: String },
417 PreprocessorIdentifier { text: String },
418 TextMacro { text: String },
419 StringLiteral { text: String },
420 PreprocessorStringLiteral { text: String },
421 TripleQuoteStringLiteral { text: String },
422 PreprocessorTripleQuoteStringLiteral { text: String },
423 Newline(),
424}
425
426impl std::fmt::Display for Token {
427 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
428 let rust_token: scarf_parser::Token<'_> = self.into();
429 rust_token.fmt(f)
430 }
431}
432
433impl<'a> From<scarf_parser::Token<'a>> for Token {
434 fn from(value: scarf_parser::Token<'a>) -> Self {
435 match value {
436 scarf_parser::Token::Error => Token::Error(),
437 scarf_parser::Token::Always => Token::Always(),
438 scarf_parser::Token::And => Token::And(),
439 scarf_parser::Token::Assign => Token::Assign(),
440 scarf_parser::Token::Begin => Token::Begin(),
441 scarf_parser::Token::Buf => Token::Buf(),
442 scarf_parser::Token::Bufif0 => Token::Bufif0(),
443 scarf_parser::Token::Bufif1 => Token::Bufif1(),
444 scarf_parser::Token::Case => Token::Case(),
445 scarf_parser::Token::Casex => Token::Casex(),
446 scarf_parser::Token::Casez => Token::Casez(),
447 scarf_parser::Token::Cmos => Token::Cmos(),
448 scarf_parser::Token::Deassign => Token::Deassign(),
449 scarf_parser::Token::Default => Token::Default(),
450 scarf_parser::Token::Defparam => Token::Defparam(),
451 scarf_parser::Token::Disable => Token::Disable(),
452 scarf_parser::Token::Edge => Token::Edge(),
453 scarf_parser::Token::Else => Token::Else(),
454 scarf_parser::Token::End => Token::End(),
455 scarf_parser::Token::Endcase => Token::Endcase(),
456 scarf_parser::Token::Endfunction => Token::Endfunction(),
457 scarf_parser::Token::Endmodule => Token::Endmodule(),
458 scarf_parser::Token::Endprimitive => Token::Endprimitive(),
459 scarf_parser::Token::Endspecify => Token::Endspecify(),
460 scarf_parser::Token::Endtable => Token::Endtable(),
461 scarf_parser::Token::Endtask => Token::Endtask(),
462 scarf_parser::Token::Event => Token::Event(),
463 scarf_parser::Token::For => Token::For(),
464 scarf_parser::Token::Force => Token::Force(),
465 scarf_parser::Token::Forever => Token::Forever(),
466 scarf_parser::Token::Fork => Token::Fork(),
467 scarf_parser::Token::Function => Token::Function(),
468 scarf_parser::Token::Highz0 => Token::Highz0(),
469 scarf_parser::Token::Highz1 => Token::Highz1(),
470 scarf_parser::Token::If => Token::If(),
471 scarf_parser::Token::Ifnone => Token::Ifnone(),
472 scarf_parser::Token::Initial => Token::Initial(),
473 scarf_parser::Token::Inout => Token::Inout(),
474 scarf_parser::Token::Input => Token::Input(),
475 scarf_parser::Token::Integer => Token::Integer(),
476 scarf_parser::Token::Join => Token::Join(),
477 scarf_parser::Token::Large => Token::Large(),
478 scarf_parser::Token::Macromodule => Token::Macromodule(),
479 scarf_parser::Token::Medium => Token::Medium(),
480 scarf_parser::Token::Module => Token::Module(),
481 scarf_parser::Token::Nand => Token::Nand(),
482 scarf_parser::Token::Negedge => Token::Negedge(),
483 scarf_parser::Token::Nmos => Token::Nmos(),
484 scarf_parser::Token::Nor => Token::Nor(),
485 scarf_parser::Token::Not => Token::Not(),
486 scarf_parser::Token::Notif0 => Token::Notif0(),
487 scarf_parser::Token::Notif1 => Token::Notif1(),
488 scarf_parser::Token::Or => Token::Or(),
489 scarf_parser::Token::Output => Token::Output(),
490 scarf_parser::Token::Parameter => Token::Parameter(),
491 scarf_parser::Token::Pmos => Token::Pmos(),
492 scarf_parser::Token::Posedge => Token::Posedge(),
493 scarf_parser::Token::Primitive => Token::Primitive(),
494 scarf_parser::Token::Pull0 => Token::Pull0(),
495 scarf_parser::Token::Pull1 => Token::Pull1(),
496 scarf_parser::Token::Pulldown => Token::Pulldown(),
497 scarf_parser::Token::Pullup => Token::Pullup(),
498 scarf_parser::Token::Rcmos => Token::Rcmos(),
499 scarf_parser::Token::Real => Token::Real(),
500 scarf_parser::Token::Realtime => Token::Realtime(),
501 scarf_parser::Token::Reg => Token::Reg(),
502 scarf_parser::Token::Release => Token::Release(),
503 scarf_parser::Token::Repeat => Token::Repeat(),
504 scarf_parser::Token::Rnmos => Token::Rnmos(),
505 scarf_parser::Token::Rpmos => Token::Rpmos(),
506 scarf_parser::Token::Rtran => Token::Rtran(),
507 scarf_parser::Token::Rtranif0 => Token::Rtranif0(),
508 scarf_parser::Token::Rtranif1 => Token::Rtranif1(),
509 scarf_parser::Token::Scalared => Token::Scalared(),
510 scarf_parser::Token::Small => Token::Small(),
511 scarf_parser::Token::Specify => Token::Specify(),
512 scarf_parser::Token::Specparam => Token::Specparam(),
513 scarf_parser::Token::Strong0 => Token::Strong0(),
514 scarf_parser::Token::Strong1 => Token::Strong1(),
515 scarf_parser::Token::Supply0 => Token::Supply0(),
516 scarf_parser::Token::Supply1 => Token::Supply1(),
517 scarf_parser::Token::Table => Token::Table(),
518 scarf_parser::Token::Task => Token::Task(),
519 scarf_parser::Token::Time => Token::Time(),
520 scarf_parser::Token::Tran => Token::Tran(),
521 scarf_parser::Token::Tranif0 => Token::Tranif0(),
522 scarf_parser::Token::Tranif1 => Token::Tranif1(),
523 scarf_parser::Token::Tri => Token::Tri(),
524 scarf_parser::Token::Tri0 => Token::Tri0(),
525 scarf_parser::Token::Tri1 => Token::Tri1(),
526 scarf_parser::Token::Triand => Token::Triand(),
527 scarf_parser::Token::Trior => Token::Trior(),
528 scarf_parser::Token::Trireg => Token::Trireg(),
529 scarf_parser::Token::Vectored => Token::Vectored(),
530 scarf_parser::Token::Wait => Token::Wait(),
531 scarf_parser::Token::Wand => Token::Wand(),
532 scarf_parser::Token::Weak0 => Token::Weak0(),
533 scarf_parser::Token::Weak1 => Token::Weak1(),
534 scarf_parser::Token::While => Token::While(),
535 scarf_parser::Token::Wire => Token::Wire(),
536 scarf_parser::Token::Wor => Token::Wor(),
537 scarf_parser::Token::Xnor => Token::Xnor(),
538 scarf_parser::Token::Xor => Token::Xor(),
539 scarf_parser::Token::Automatic => Token::Automatic(),
540 scarf_parser::Token::Cell => Token::Cell(),
541 scarf_parser::Token::Config => Token::Config(),
542 scarf_parser::Token::Design => Token::Design(),
543 scarf_parser::Token::Endconfig => Token::Endconfig(),
544 scarf_parser::Token::Endgenerate => Token::Endgenerate(),
545 scarf_parser::Token::Generate => Token::Generate(),
546 scarf_parser::Token::Genvar => Token::Genvar(),
547 scarf_parser::Token::Incdir => Token::Incdir(),
548 scarf_parser::Token::Include => Token::Include(),
549 scarf_parser::Token::Instance => Token::Instance(),
550 scarf_parser::Token::Liblist => Token::Liblist(),
551 scarf_parser::Token::Library => Token::Library(),
552 scarf_parser::Token::Localparam => Token::Localparam(),
553 scarf_parser::Token::Noshowcancelled => Token::Noshowcancelled(),
554 scarf_parser::Token::PulsestyleOndetect => {
555 Token::PulsestyleOndetect()
556 }
557 scarf_parser::Token::PulsestyleOnevent => {
558 Token::PulsestyleOnevent()
559 }
560 scarf_parser::Token::Showcancelled => Token::Showcancelled(),
561 scarf_parser::Token::Signed => Token::Signed(),
562 scarf_parser::Token::Unsigned => Token::Unsigned(),
563 scarf_parser::Token::Use => Token::Use(),
564 scarf_parser::Token::Uwire => Token::Uwire(),
565 scarf_parser::Token::Alias => Token::Alias(),
566 scarf_parser::Token::AlwaysComb => Token::AlwaysComb(),
567 scarf_parser::Token::AlwaysFf => Token::AlwaysFf(),
568 scarf_parser::Token::AlwaysLatch => Token::AlwaysLatch(),
569 scarf_parser::Token::Assert => Token::Assert(),
570 scarf_parser::Token::Assume => Token::Assume(),
571 scarf_parser::Token::Before => Token::Before(),
572 scarf_parser::Token::Bind => Token::Bind(),
573 scarf_parser::Token::Bins => Token::Bins(),
574 scarf_parser::Token::Binsof => Token::Binsof(),
575 scarf_parser::Token::Bit => Token::Bit(),
576 scarf_parser::Token::Break => Token::Break(),
577 scarf_parser::Token::Byte => Token::Byte(),
578 scarf_parser::Token::Chandle => Token::Chandle(),
579 scarf_parser::Token::Class => Token::Class(),
580 scarf_parser::Token::Clocking => Token::Clocking(),
581 scarf_parser::Token::Const => Token::Const(),
582 scarf_parser::Token::Constraint => Token::Constraint(),
583 scarf_parser::Token::Context => Token::Context(),
584 scarf_parser::Token::Continue => Token::Continue(),
585 scarf_parser::Token::Cover => Token::Cover(),
586 scarf_parser::Token::Covergroup => Token::Covergroup(),
587 scarf_parser::Token::Coverpoint => Token::Coverpoint(),
588 scarf_parser::Token::Cross => Token::Cross(),
589 scarf_parser::Token::Dist => Token::Dist(),
590 scarf_parser::Token::Do => Token::Do(),
591 scarf_parser::Token::Endclass => Token::Endclass(),
592 scarf_parser::Token::Endclocking => Token::Endclocking(),
593 scarf_parser::Token::Endgroup => Token::Endgroup(),
594 scarf_parser::Token::Endinterface => Token::Endinterface(),
595 scarf_parser::Token::Endpackage => Token::Endpackage(),
596 scarf_parser::Token::Endprogram => Token::Endprogram(),
597 scarf_parser::Token::Endproperty => Token::Endproperty(),
598 scarf_parser::Token::Endsequence => Token::Endsequence(),
599 scarf_parser::Token::Enum => Token::Enum(),
600 scarf_parser::Token::Expect => Token::Expect(),
601 scarf_parser::Token::Export => Token::Export(),
602 scarf_parser::Token::Extends => Token::Extends(),
603 scarf_parser::Token::Extern => Token::Extern(),
604 scarf_parser::Token::Final => Token::Final(),
605 scarf_parser::Token::FirstMatch => Token::FirstMatch(),
606 scarf_parser::Token::Foreach => Token::Foreach(),
607 scarf_parser::Token::Forkjoin => Token::Forkjoin(),
608 scarf_parser::Token::Iff => Token::Iff(),
609 scarf_parser::Token::IgnoreBins => Token::IgnoreBins(),
610 scarf_parser::Token::IllegalBins => Token::IllegalBins(),
611 scarf_parser::Token::Import => Token::Import(),
612 scarf_parser::Token::Inside => Token::Inside(),
613 scarf_parser::Token::Int => Token::Int(),
614 scarf_parser::Token::Interface => Token::Interface(),
615 scarf_parser::Token::Intersect => Token::Intersect(),
616 scarf_parser::Token::JoinAny => Token::JoinAny(),
617 scarf_parser::Token::JoinNone => Token::JoinNone(),
618 scarf_parser::Token::Local => Token::Local(),
619 scarf_parser::Token::Logic => Token::Logic(),
620 scarf_parser::Token::Longint => Token::Longint(),
621 scarf_parser::Token::Matches => Token::Matches(),
622 scarf_parser::Token::Modport => Token::Modport(),
623 scarf_parser::Token::New => Token::New(),
624 scarf_parser::Token::Null => Token::Null(),
625 scarf_parser::Token::Package => Token::Package(),
626 scarf_parser::Token::Packed => Token::Packed(),
627 scarf_parser::Token::Priority => Token::Priority(),
628 scarf_parser::Token::Program => Token::Program(),
629 scarf_parser::Token::Property => Token::Property(),
630 scarf_parser::Token::Protected => Token::Protected(),
631 scarf_parser::Token::Pure => Token::Pure(),
632 scarf_parser::Token::Rand => Token::Rand(),
633 scarf_parser::Token::Randc => Token::Randc(),
634 scarf_parser::Token::Randcase => Token::Randcase(),
635 scarf_parser::Token::Randsequence => Token::Randsequence(),
636 scarf_parser::Token::Ref => Token::Ref(),
637 scarf_parser::Token::Return => Token::Return(),
638 scarf_parser::Token::Sequence => Token::Sequence(),
639 scarf_parser::Token::Shortint => Token::Shortint(),
640 scarf_parser::Token::Shortreal => Token::Shortreal(),
641 scarf_parser::Token::Solve => Token::Solve(),
642 scarf_parser::Token::Static => Token::Static(),
643 scarf_parser::Token::String => Token::String(),
644 scarf_parser::Token::Struct => Token::Struct(),
645 scarf_parser::Token::Super => Token::Super(),
646 scarf_parser::Token::Tagged => Token::Tagged(),
647 scarf_parser::Token::This => Token::This(),
648 scarf_parser::Token::Throughout => Token::Throughout(),
649 scarf_parser::Token::Timeprecision => Token::Timeprecision(),
650 scarf_parser::Token::Timeunit => Token::Timeunit(),
651 scarf_parser::Token::Type => Token::Type(),
652 scarf_parser::Token::Typedef => Token::Typedef(),
653 scarf_parser::Token::Union => Token::Union(),
654 scarf_parser::Token::Unique => Token::Unique(),
655 scarf_parser::Token::Var => Token::Var(),
656 scarf_parser::Token::Virtual => Token::Virtual(),
657 scarf_parser::Token::Void => Token::Void(),
658 scarf_parser::Token::WaitOrder => Token::WaitOrder(),
659 scarf_parser::Token::Wildcard => Token::Wildcard(),
660 scarf_parser::Token::With => Token::With(),
661 scarf_parser::Token::Within => Token::Within(),
662 scarf_parser::Token::AcceptOn => Token::AcceptOn(),
663 scarf_parser::Token::Checker => Token::Checker(),
664 scarf_parser::Token::Endchecker => Token::Endchecker(),
665 scarf_parser::Token::Eventually => Token::Eventually(),
666 scarf_parser::Token::Global => Token::Global(),
667 scarf_parser::Token::Implies => Token::Implies(),
668 scarf_parser::Token::Let => Token::Let(),
669 scarf_parser::Token::Nexttime => Token::Nexttime(),
670 scarf_parser::Token::RejectOn => Token::RejectOn(),
671 scarf_parser::Token::Restrict => Token::Restrict(),
672 scarf_parser::Token::SAlways => Token::SAlways(),
673 scarf_parser::Token::SEventually => Token::SEventually(),
674 scarf_parser::Token::SNexttime => Token::SNexttime(),
675 scarf_parser::Token::SUntil => Token::SUntil(),
676 scarf_parser::Token::SUntilWith => Token::SUntilWith(),
677 scarf_parser::Token::Strong => Token::Strong(),
678 scarf_parser::Token::SyncAcceptOn => Token::SyncAcceptOn(),
679 scarf_parser::Token::SyncRejectOn => Token::SyncRejectOn(),
680 scarf_parser::Token::Unique0 => Token::Unique0(),
681 scarf_parser::Token::Until => Token::Until(),
682 scarf_parser::Token::UntilWith => Token::UntilWith(),
683 scarf_parser::Token::Untyped => Token::Untyped(),
684 scarf_parser::Token::Weak => Token::Weak(),
685 scarf_parser::Token::Implements => Token::Implements(),
686 scarf_parser::Token::Interconnect => Token::Interconnect(),
687 scarf_parser::Token::Nettype => Token::Nettype(),
688 scarf_parser::Token::Soft => Token::Soft(),
689 scarf_parser::Token::DirUnderscoreFile => {
690 Token::DirUnderscoreFile()
691 }
692 scarf_parser::Token::DirUnderscoreLine => {
693 Token::DirUnderscoreLine()
694 }
695 scarf_parser::Token::DirBeginKeywords => Token::DirBeginKeywords(),
696 scarf_parser::Token::DirCelldefine => Token::DirCelldefine(),
697 scarf_parser::Token::DirDefaultNettype => {
698 Token::DirDefaultNettype()
699 }
700 scarf_parser::Token::DirDefine => Token::DirDefine(),
701 scarf_parser::Token::DirElse => Token::DirElse(),
702 scarf_parser::Token::DirElsif => Token::DirElsif(),
703 scarf_parser::Token::DirEndKeywords => Token::DirEndKeywords(),
704 scarf_parser::Token::DirEndcelldefine => Token::DirEndcelldefine(),
705 scarf_parser::Token::DirEndif => Token::DirEndif(),
706 scarf_parser::Token::DirIfdef => Token::DirIfdef(),
707 scarf_parser::Token::DirIfndef => Token::DirIfndef(),
708 scarf_parser::Token::DirInclude => Token::DirInclude(),
709 scarf_parser::Token::DirLine => Token::DirLine(),
710 scarf_parser::Token::DirNounconnectedDrive => {
711 Token::DirNounconnectedDrive()
712 }
713 scarf_parser::Token::DirPragma => Token::DirPragma(),
714 scarf_parser::Token::DirResetall => Token::DirResetall(),
715 scarf_parser::Token::DirTimescale => Token::DirTimescale(),
716 scarf_parser::Token::DirUnconnectedDrive => {
717 Token::DirUnconnectedDrive()
718 }
719 scarf_parser::Token::DirUndef => Token::DirUndef(),
720 scarf_parser::Token::DirUndefineall => Token::DirUndefineall(),
721 scarf_parser::Token::Plus => Token::Plus(),
722 scarf_parser::Token::Minus => Token::Minus(),
723 scarf_parser::Token::Exclamation => Token::Exclamation(),
724 scarf_parser::Token::Quest => Token::Quest(),
725 scarf_parser::Token::Tilde => Token::Tilde(),
726 scarf_parser::Token::Amp => Token::Amp(),
727 scarf_parser::Token::TildeAmp => Token::TildeAmp(),
728 scarf_parser::Token::Pipe => Token::Pipe(),
729 scarf_parser::Token::TildePipe => Token::TildePipe(),
730 scarf_parser::Token::Caret => Token::Caret(),
731 scarf_parser::Token::TildeCaret => Token::TildeCaret(),
732 scarf_parser::Token::CaretTilde => Token::CaretTilde(),
733 scarf_parser::Token::Star => Token::Star(),
734 scarf_parser::Token::Slash => Token::Slash(),
735 scarf_parser::Token::Percent => Token::Percent(),
736 scarf_parser::Token::EqEq => Token::EqEq(),
737 scarf_parser::Token::ExclEq => Token::ExclEq(),
738 scarf_parser::Token::PlusEq => Token::PlusEq(),
739 scarf_parser::Token::MinusEq => Token::MinusEq(),
740 scarf_parser::Token::StarEq => Token::StarEq(),
741 scarf_parser::Token::SlashEq => Token::SlashEq(),
742 scarf_parser::Token::PercentEq => Token::PercentEq(),
743 scarf_parser::Token::AmpEq => Token::AmpEq(),
744 scarf_parser::Token::PipeEq => Token::PipeEq(),
745 scarf_parser::Token::CaretEq => Token::CaretEq(),
746 scarf_parser::Token::EqEqEq => Token::EqEqEq(),
747 scarf_parser::Token::ExclEqEq => Token::ExclEqEq(),
748 scarf_parser::Token::EqEqQuest => Token::EqEqQuest(),
749 scarf_parser::Token::ExclEqQuest => Token::ExclEqQuest(),
750 scarf_parser::Token::AmpAmp => Token::AmpAmp(),
751 scarf_parser::Token::AmpAmpAmp => Token::AmpAmpAmp(),
752 scarf_parser::Token::PipePipe => Token::PipePipe(),
753 scarf_parser::Token::StarStar => Token::StarStar(),
754 scarf_parser::Token::Lt => Token::Lt(),
755 scarf_parser::Token::LtEq => Token::LtEq(),
756 scarf_parser::Token::Gt => Token::Gt(),
757 scarf_parser::Token::GtEq => Token::GtEq(),
758 scarf_parser::Token::GtGt => Token::GtGt(),
759 scarf_parser::Token::LtLt => Token::LtLt(),
760 scarf_parser::Token::GtGtEq => Token::GtGtEq(),
761 scarf_parser::Token::LtLtEq => Token::LtLtEq(),
762 scarf_parser::Token::GtGtGt => Token::GtGtGt(),
763 scarf_parser::Token::LtLtLt => Token::LtLtLt(),
764 scarf_parser::Token::GtGtGtEq => Token::GtGtGtEq(),
765 scarf_parser::Token::LtLtLtEq => Token::LtLtLtEq(),
766 scarf_parser::Token::MinusGt => Token::MinusGt(),
767 scarf_parser::Token::MinusGtGt => Token::MinusGtGt(),
768 scarf_parser::Token::LtMinusGt => Token::LtMinusGt(),
769 scarf_parser::Token::PlusPlus => Token::PlusPlus(),
770 scarf_parser::Token::MinusMinus => Token::MinusMinus(),
771 scarf_parser::Token::PlusColon => Token::PlusColon(),
772 scarf_parser::Token::MinusColon => Token::MinusColon(),
773 scarf_parser::Token::PlusSlashMinus => Token::PlusSlashMinus(),
774 scarf_parser::Token::PlusPercentMinus => Token::PlusPercentMinus(),
775 scarf_parser::Token::Paren => Token::Paren(),
776 scarf_parser::Token::EParen => Token::EParen(),
777 scarf_parser::Token::Bracket => Token::Bracket(),
778 scarf_parser::Token::EBracket => Token::EBracket(),
779 scarf_parser::Token::Brace => Token::Brace(),
780 scarf_parser::Token::EBrace => Token::EBrace(),
781 scarf_parser::Token::Colon => Token::Colon(),
782 scarf_parser::Token::SColon => Token::SColon(),
783 scarf_parser::Token::Apost => Token::Apost(),
784 scarf_parser::Token::Comma => Token::Comma(),
785 scarf_parser::Token::Period => Token::Period(),
786 scarf_parser::Token::Pound => Token::Pound(),
787 scarf_parser::Token::Dollar => Token::Dollar(),
788 scarf_parser::Token::At => Token::At(),
789 scarf_parser::Token::AtAt => Token::AtAt(),
790 scarf_parser::Token::Eq => Token::Eq(),
791 scarf_parser::Token::ColonColon => Token::ColonColon(),
792 scarf_parser::Token::ColonEq => Token::ColonEq(),
793 scarf_parser::Token::ColonSlash => Token::ColonSlash(),
794 scarf_parser::Token::PoundPound => Token::PoundPound(),
795 scarf_parser::Token::PoundMinusPound => Token::PoundMinusPound(),
796 scarf_parser::Token::PoundEqPound => Token::PoundEqPound(),
797 scarf_parser::Token::EqGt => Token::EqGt(),
798 scarf_parser::Token::StarGt => Token::StarGt(),
799 scarf_parser::Token::PipeMinusGt => Token::PipeMinusGt(),
800 scarf_parser::Token::PipeEqGt => Token::PipeEqGt(),
801 scarf_parser::Token::Bslash => Token::Bslash(),
802 scarf_parser::Token::Std => Token::Std(),
803 scarf_parser::Token::PathpulseDollar => Token::PathpulseDollar(),
804 scarf_parser::Token::Option => Token::Option(),
805 scarf_parser::Token::TypeOption => Token::TypeOption(),
806 scarf_parser::Token::Randomize => Token::Randomize(),
807 scarf_parser::Token::Sample => Token::Sample(),
808 scarf_parser::Token::OneStep => Token::OneStep(),
809 scarf_parser::Token::DollarSetup => Token::DollarSetup(),
810 scarf_parser::Token::DollarHold => Token::DollarHold(),
811 scarf_parser::Token::DollarSetuphold => Token::DollarSetuphold(),
812 scarf_parser::Token::DollarRecovery => Token::DollarRecovery(),
813 scarf_parser::Token::DollarRemoval => Token::DollarRemoval(),
814 scarf_parser::Token::DollarRecrem => Token::DollarRecrem(),
815 scarf_parser::Token::DollarSkew => Token::DollarSkew(),
816 scarf_parser::Token::DollarTimeskew => Token::DollarTimeskew(),
817 scarf_parser::Token::DollarFullskew => Token::DollarFullskew(),
818 scarf_parser::Token::DollarPeriod => Token::DollarPeriod(),
819 scarf_parser::Token::DollarWidth => Token::DollarWidth(),
820 scarf_parser::Token::DollarNochange => Token::DollarNochange(),
821 scarf_parser::Token::DollarRoot => Token::DollarRoot(),
822 scarf_parser::Token::DollarUnit => Token::DollarUnit(),
823 scarf_parser::Token::DollarFatal => Token::DollarFatal(),
824 scarf_parser::Token::DollarError => Token::DollarError(),
825 scarf_parser::Token::DollarWarning => Token::DollarWarning(),
826 scarf_parser::Token::DollarInfo => Token::DollarInfo(),
827 scarf_parser::Token::OnelineComment(str) => Token::OnelineComment {
828 text: str.to_string(),
829 },
830 scarf_parser::Token::BlockComment(str) => Token::BlockComment {
831 text: str.to_string(),
832 },
833 scarf_parser::Token::UnsignedNumber(str) => Token::UnsignedNumber {
834 text: str.to_string(),
835 },
836 scarf_parser::Token::FixedPointNumber(str) => {
837 Token::FixedPointNumber {
838 text: str.to_string(),
839 }
840 }
841 scarf_parser::Token::BinaryNumber(str) => Token::BinaryNumber {
842 text: str.to_string(),
843 },
844 scarf_parser::Token::OctalNumber(str) => Token::OctalNumber {
845 text: str.to_string(),
846 },
847 scarf_parser::Token::DecimalNumber(str) => Token::DecimalNumber {
848 text: str.to_string(),
849 },
850 scarf_parser::Token::HexNumber(str) => Token::HexNumber {
851 text: str.to_string(),
852 },
853 scarf_parser::Token::ScientificNumber(str) => {
854 Token::ScientificNumber {
855 text: str.to_string(),
856 }
857 }
858 scarf_parser::Token::UnbasedUnsizedLiteral(str) => {
859 Token::UnbasedUnsizedLiteral {
860 text: str.to_string(),
861 }
862 }
863 scarf_parser::Token::SystemTfIdentifier(str) => {
864 Token::SystemTfIdentifier {
865 text: str.to_string(),
866 }
867 }
868 scarf_parser::Token::SimpleIdentifier(str) => {
869 Token::SimpleIdentifier {
870 text: str.to_string(),
871 }
872 }
873 scarf_parser::Token::EscapedIdentifier(str) => {
874 Token::EscapedIdentifier {
875 text: str.to_string(),
876 }
877 }
878 scarf_parser::Token::PreprocessorIdentifier(str) => {
879 Token::PreprocessorIdentifier {
880 text: str.to_string(),
881 }
882 }
883 scarf_parser::Token::TextMacro(str) => Token::TextMacro {
884 text: str.to_string(),
885 },
886 scarf_parser::Token::StringLiteral(str) => Token::StringLiteral {
887 text: str.to_string(),
888 },
889 scarf_parser::Token::PreprocessorStringLiteral(str) => {
890 Token::PreprocessorStringLiteral {
891 text: str.to_string(),
892 }
893 }
894 scarf_parser::Token::TripleQuoteStringLiteral(str) => {
895 Token::TripleQuoteStringLiteral {
896 text: str.to_string(),
897 }
898 }
899 scarf_parser::Token::PreprocessorTripleQuoteStringLiteral(str) => {
900 Token::PreprocessorTripleQuoteStringLiteral {
901 text: str.to_string(),
902 }
903 }
904 scarf_parser::Token::Newline => Token::Newline(),
905 }
906 }
907}
908
909impl<'a> From<&'a Token> for scarf_parser::Token<'a> {
910 fn from(value: &'a Token) -> Self {
911 match value {
912 Token::Error() => scarf_parser::Token::Error,
913 Token::Always() => scarf_parser::Token::Always,
914 Token::And() => scarf_parser::Token::And,
915 Token::Assign() => scarf_parser::Token::Assign,
916 Token::Begin() => scarf_parser::Token::Begin,
917 Token::Buf() => scarf_parser::Token::Buf,
918 Token::Bufif0() => scarf_parser::Token::Bufif0,
919 Token::Bufif1() => scarf_parser::Token::Bufif1,
920 Token::Case() => scarf_parser::Token::Case,
921 Token::Casex() => scarf_parser::Token::Casex,
922 Token::Casez() => scarf_parser::Token::Casez,
923 Token::Cmos() => scarf_parser::Token::Cmos,
924 Token::Deassign() => scarf_parser::Token::Deassign,
925 Token::Default() => scarf_parser::Token::Default,
926 Token::Defparam() => scarf_parser::Token::Defparam,
927 Token::Disable() => scarf_parser::Token::Disable,
928 Token::Edge() => scarf_parser::Token::Edge,
929 Token::Else() => scarf_parser::Token::Else,
930 Token::End() => scarf_parser::Token::End,
931 Token::Endcase() => scarf_parser::Token::Endcase,
932 Token::Endfunction() => scarf_parser::Token::Endfunction,
933 Token::Endmodule() => scarf_parser::Token::Endmodule,
934 Token::Endprimitive() => scarf_parser::Token::Endprimitive,
935 Token::Endspecify() => scarf_parser::Token::Endspecify,
936 Token::Endtable() => scarf_parser::Token::Endtable,
937 Token::Endtask() => scarf_parser::Token::Endtask,
938 Token::Event() => scarf_parser::Token::Event,
939 Token::For() => scarf_parser::Token::For,
940 Token::Force() => scarf_parser::Token::Force,
941 Token::Forever() => scarf_parser::Token::Forever,
942 Token::Fork() => scarf_parser::Token::Fork,
943 Token::Function() => scarf_parser::Token::Function,
944 Token::Highz0() => scarf_parser::Token::Highz0,
945 Token::Highz1() => scarf_parser::Token::Highz1,
946 Token::If() => scarf_parser::Token::If,
947 Token::Ifnone() => scarf_parser::Token::Ifnone,
948 Token::Initial() => scarf_parser::Token::Initial,
949 Token::Inout() => scarf_parser::Token::Inout,
950 Token::Input() => scarf_parser::Token::Input,
951 Token::Integer() => scarf_parser::Token::Integer,
952 Token::Join() => scarf_parser::Token::Join,
953 Token::Large() => scarf_parser::Token::Large,
954 Token::Macromodule() => scarf_parser::Token::Macromodule,
955 Token::Medium() => scarf_parser::Token::Medium,
956 Token::Module() => scarf_parser::Token::Module,
957 Token::Nand() => scarf_parser::Token::Nand,
958 Token::Negedge() => scarf_parser::Token::Negedge,
959 Token::Nmos() => scarf_parser::Token::Nmos,
960 Token::Nor() => scarf_parser::Token::Nor,
961 Token::Not() => scarf_parser::Token::Not,
962 Token::Notif0() => scarf_parser::Token::Notif0,
963 Token::Notif1() => scarf_parser::Token::Notif1,
964 Token::Or() => scarf_parser::Token::Or,
965 Token::Output() => scarf_parser::Token::Output,
966 Token::Parameter() => scarf_parser::Token::Parameter,
967 Token::Pmos() => scarf_parser::Token::Pmos,
968 Token::Posedge() => scarf_parser::Token::Posedge,
969 Token::Primitive() => scarf_parser::Token::Primitive,
970 Token::Pull0() => scarf_parser::Token::Pull0,
971 Token::Pull1() => scarf_parser::Token::Pull1,
972 Token::Pulldown() => scarf_parser::Token::Pulldown,
973 Token::Pullup() => scarf_parser::Token::Pullup,
974 Token::Rcmos() => scarf_parser::Token::Rcmos,
975 Token::Real() => scarf_parser::Token::Real,
976 Token::Realtime() => scarf_parser::Token::Realtime,
977 Token::Reg() => scarf_parser::Token::Reg,
978 Token::Release() => scarf_parser::Token::Release,
979 Token::Repeat() => scarf_parser::Token::Repeat,
980 Token::Rnmos() => scarf_parser::Token::Rnmos,
981 Token::Rpmos() => scarf_parser::Token::Rpmos,
982 Token::Rtran() => scarf_parser::Token::Rtran,
983 Token::Rtranif0() => scarf_parser::Token::Rtranif0,
984 Token::Rtranif1() => scarf_parser::Token::Rtranif1,
985 Token::Scalared() => scarf_parser::Token::Scalared,
986 Token::Small() => scarf_parser::Token::Small,
987 Token::Specify() => scarf_parser::Token::Specify,
988 Token::Specparam() => scarf_parser::Token::Specparam,
989 Token::Strong0() => scarf_parser::Token::Strong0,
990 Token::Strong1() => scarf_parser::Token::Strong1,
991 Token::Supply0() => scarf_parser::Token::Supply0,
992 Token::Supply1() => scarf_parser::Token::Supply1,
993 Token::Table() => scarf_parser::Token::Table,
994 Token::Task() => scarf_parser::Token::Task,
995 Token::Time() => scarf_parser::Token::Time,
996 Token::Tran() => scarf_parser::Token::Tran,
997 Token::Tranif0() => scarf_parser::Token::Tranif0,
998 Token::Tranif1() => scarf_parser::Token::Tranif1,
999 Token::Tri() => scarf_parser::Token::Tri,
1000 Token::Tri0() => scarf_parser::Token::Tri0,
1001 Token::Tri1() => scarf_parser::Token::Tri1,
1002 Token::Triand() => scarf_parser::Token::Triand,
1003 Token::Trior() => scarf_parser::Token::Trior,
1004 Token::Trireg() => scarf_parser::Token::Trireg,
1005 Token::Vectored() => scarf_parser::Token::Vectored,
1006 Token::Wait() => scarf_parser::Token::Wait,
1007 Token::Wand() => scarf_parser::Token::Wand,
1008 Token::Weak0() => scarf_parser::Token::Weak0,
1009 Token::Weak1() => scarf_parser::Token::Weak1,
1010 Token::While() => scarf_parser::Token::While,
1011 Token::Wire() => scarf_parser::Token::Wire,
1012 Token::Wor() => scarf_parser::Token::Wor,
1013 Token::Xnor() => scarf_parser::Token::Xnor,
1014 Token::Xor() => scarf_parser::Token::Xor,
1015 Token::Automatic() => scarf_parser::Token::Automatic,
1016 Token::Cell() => scarf_parser::Token::Cell,
1017 Token::Config() => scarf_parser::Token::Config,
1018 Token::Design() => scarf_parser::Token::Design,
1019 Token::Endconfig() => scarf_parser::Token::Endconfig,
1020 Token::Endgenerate() => scarf_parser::Token::Endgenerate,
1021 Token::Generate() => scarf_parser::Token::Generate,
1022 Token::Genvar() => scarf_parser::Token::Genvar,
1023 Token::Incdir() => scarf_parser::Token::Incdir,
1024 Token::Include() => scarf_parser::Token::Include,
1025 Token::Instance() => scarf_parser::Token::Instance,
1026 Token::Liblist() => scarf_parser::Token::Liblist,
1027 Token::Library() => scarf_parser::Token::Library,
1028 Token::Localparam() => scarf_parser::Token::Localparam,
1029 Token::Noshowcancelled() => scarf_parser::Token::Noshowcancelled,
1030 Token::PulsestyleOndetect() => {
1031 scarf_parser::Token::PulsestyleOndetect
1032 }
1033 Token::PulsestyleOnevent() => {
1034 scarf_parser::Token::PulsestyleOnevent
1035 }
1036 Token::Showcancelled() => scarf_parser::Token::Showcancelled,
1037 Token::Signed() => scarf_parser::Token::Signed,
1038 Token::Unsigned() => scarf_parser::Token::Unsigned,
1039 Token::Use() => scarf_parser::Token::Use,
1040 Token::Uwire() => scarf_parser::Token::Uwire,
1041 Token::Alias() => scarf_parser::Token::Alias,
1042 Token::AlwaysComb() => scarf_parser::Token::AlwaysComb,
1043 Token::AlwaysFf() => scarf_parser::Token::AlwaysFf,
1044 Token::AlwaysLatch() => scarf_parser::Token::AlwaysLatch,
1045 Token::Assert() => scarf_parser::Token::Assert,
1046 Token::Assume() => scarf_parser::Token::Assume,
1047 Token::Before() => scarf_parser::Token::Before,
1048 Token::Bind() => scarf_parser::Token::Bind,
1049 Token::Bins() => scarf_parser::Token::Bins,
1050 Token::Binsof() => scarf_parser::Token::Binsof,
1051 Token::Bit() => scarf_parser::Token::Bit,
1052 Token::Break() => scarf_parser::Token::Break,
1053 Token::Byte() => scarf_parser::Token::Byte,
1054 Token::Chandle() => scarf_parser::Token::Chandle,
1055 Token::Class() => scarf_parser::Token::Class,
1056 Token::Clocking() => scarf_parser::Token::Clocking,
1057 Token::Const() => scarf_parser::Token::Const,
1058 Token::Constraint() => scarf_parser::Token::Constraint,
1059 Token::Context() => scarf_parser::Token::Context,
1060 Token::Continue() => scarf_parser::Token::Continue,
1061 Token::Cover() => scarf_parser::Token::Cover,
1062 Token::Covergroup() => scarf_parser::Token::Covergroup,
1063 Token::Coverpoint() => scarf_parser::Token::Coverpoint,
1064 Token::Cross() => scarf_parser::Token::Cross,
1065 Token::Dist() => scarf_parser::Token::Dist,
1066 Token::Do() => scarf_parser::Token::Do,
1067 Token::Endclass() => scarf_parser::Token::Endclass,
1068 Token::Endclocking() => scarf_parser::Token::Endclocking,
1069 Token::Endgroup() => scarf_parser::Token::Endgroup,
1070 Token::Endinterface() => scarf_parser::Token::Endinterface,
1071 Token::Endpackage() => scarf_parser::Token::Endpackage,
1072 Token::Endprogram() => scarf_parser::Token::Endprogram,
1073 Token::Endproperty() => scarf_parser::Token::Endproperty,
1074 Token::Endsequence() => scarf_parser::Token::Endsequence,
1075 Token::Enum() => scarf_parser::Token::Enum,
1076 Token::Expect() => scarf_parser::Token::Expect,
1077 Token::Export() => scarf_parser::Token::Export,
1078 Token::Extends() => scarf_parser::Token::Extends,
1079 Token::Extern() => scarf_parser::Token::Extern,
1080 Token::Final() => scarf_parser::Token::Final,
1081 Token::FirstMatch() => scarf_parser::Token::FirstMatch,
1082 Token::Foreach() => scarf_parser::Token::Foreach,
1083 Token::Forkjoin() => scarf_parser::Token::Forkjoin,
1084 Token::Iff() => scarf_parser::Token::Iff,
1085 Token::IgnoreBins() => scarf_parser::Token::IgnoreBins,
1086 Token::IllegalBins() => scarf_parser::Token::IllegalBins,
1087 Token::Import() => scarf_parser::Token::Import,
1088 Token::Inside() => scarf_parser::Token::Inside,
1089 Token::Int() => scarf_parser::Token::Int,
1090 Token::Interface() => scarf_parser::Token::Interface,
1091 Token::Intersect() => scarf_parser::Token::Intersect,
1092 Token::JoinAny() => scarf_parser::Token::JoinAny,
1093 Token::JoinNone() => scarf_parser::Token::JoinNone,
1094 Token::Local() => scarf_parser::Token::Local,
1095 Token::Logic() => scarf_parser::Token::Logic,
1096 Token::Longint() => scarf_parser::Token::Longint,
1097 Token::Matches() => scarf_parser::Token::Matches,
1098 Token::Modport() => scarf_parser::Token::Modport,
1099 Token::New() => scarf_parser::Token::New,
1100 Token::Null() => scarf_parser::Token::Null,
1101 Token::Package() => scarf_parser::Token::Package,
1102 Token::Packed() => scarf_parser::Token::Packed,
1103 Token::Priority() => scarf_parser::Token::Priority,
1104 Token::Program() => scarf_parser::Token::Program,
1105 Token::Property() => scarf_parser::Token::Property,
1106 Token::Protected() => scarf_parser::Token::Protected,
1107 Token::Pure() => scarf_parser::Token::Pure,
1108 Token::Rand() => scarf_parser::Token::Rand,
1109 Token::Randc() => scarf_parser::Token::Randc,
1110 Token::Randcase() => scarf_parser::Token::Randcase,
1111 Token::Randsequence() => scarf_parser::Token::Randsequence,
1112 Token::Ref() => scarf_parser::Token::Ref,
1113 Token::Return() => scarf_parser::Token::Return,
1114 Token::Sequence() => scarf_parser::Token::Sequence,
1115 Token::Shortint() => scarf_parser::Token::Shortint,
1116 Token::Shortreal() => scarf_parser::Token::Shortreal,
1117 Token::Solve() => scarf_parser::Token::Solve,
1118 Token::Static() => scarf_parser::Token::Static,
1119 Token::String() => scarf_parser::Token::String,
1120 Token::Struct() => scarf_parser::Token::Struct,
1121 Token::Super() => scarf_parser::Token::Super,
1122 Token::Tagged() => scarf_parser::Token::Tagged,
1123 Token::This() => scarf_parser::Token::This,
1124 Token::Throughout() => scarf_parser::Token::Throughout,
1125 Token::Timeprecision() => scarf_parser::Token::Timeprecision,
1126 Token::Timeunit() => scarf_parser::Token::Timeunit,
1127 Token::Type() => scarf_parser::Token::Type,
1128 Token::Typedef() => scarf_parser::Token::Typedef,
1129 Token::Union() => scarf_parser::Token::Union,
1130 Token::Unique() => scarf_parser::Token::Unique,
1131 Token::Var() => scarf_parser::Token::Var,
1132 Token::Virtual() => scarf_parser::Token::Virtual,
1133 Token::Void() => scarf_parser::Token::Void,
1134 Token::WaitOrder() => scarf_parser::Token::WaitOrder,
1135 Token::Wildcard() => scarf_parser::Token::Wildcard,
1136 Token::With() => scarf_parser::Token::With,
1137 Token::Within() => scarf_parser::Token::Within,
1138 Token::AcceptOn() => scarf_parser::Token::AcceptOn,
1139 Token::Checker() => scarf_parser::Token::Checker,
1140 Token::Endchecker() => scarf_parser::Token::Endchecker,
1141 Token::Eventually() => scarf_parser::Token::Eventually,
1142 Token::Global() => scarf_parser::Token::Global,
1143 Token::Implies() => scarf_parser::Token::Implies,
1144 Token::Let() => scarf_parser::Token::Let,
1145 Token::Nexttime() => scarf_parser::Token::Nexttime,
1146 Token::RejectOn() => scarf_parser::Token::RejectOn,
1147 Token::Restrict() => scarf_parser::Token::Restrict,
1148 Token::SAlways() => scarf_parser::Token::SAlways,
1149 Token::SEventually() => scarf_parser::Token::SEventually,
1150 Token::SNexttime() => scarf_parser::Token::SNexttime,
1151 Token::SUntil() => scarf_parser::Token::SUntil,
1152 Token::SUntilWith() => scarf_parser::Token::SUntilWith,
1153 Token::Strong() => scarf_parser::Token::Strong,
1154 Token::SyncAcceptOn() => scarf_parser::Token::SyncAcceptOn,
1155 Token::SyncRejectOn() => scarf_parser::Token::SyncRejectOn,
1156 Token::Unique0() => scarf_parser::Token::Unique0,
1157 Token::Until() => scarf_parser::Token::Until,
1158 Token::UntilWith() => scarf_parser::Token::UntilWith,
1159 Token::Untyped() => scarf_parser::Token::Untyped,
1160 Token::Weak() => scarf_parser::Token::Weak,
1161 Token::Implements() => scarf_parser::Token::Implements,
1162 Token::Interconnect() => scarf_parser::Token::Interconnect,
1163 Token::Nettype() => scarf_parser::Token::Nettype,
1164 Token::Soft() => scarf_parser::Token::Soft,
1165 Token::DirUnderscoreFile() => {
1166 scarf_parser::Token::DirUnderscoreFile
1167 }
1168 Token::DirUnderscoreLine() => {
1169 scarf_parser::Token::DirUnderscoreLine
1170 }
1171 Token::DirBeginKeywords() => scarf_parser::Token::DirBeginKeywords,
1172 Token::DirCelldefine() => scarf_parser::Token::DirCelldefine,
1173 Token::DirDefaultNettype() => {
1174 scarf_parser::Token::DirDefaultNettype
1175 }
1176 Token::DirDefine() => scarf_parser::Token::DirDefine,
1177 Token::DirElse() => scarf_parser::Token::DirElse,
1178 Token::DirElsif() => scarf_parser::Token::DirElsif,
1179 Token::DirEndKeywords() => scarf_parser::Token::DirEndKeywords,
1180 Token::DirEndcelldefine() => scarf_parser::Token::DirEndcelldefine,
1181 Token::DirEndif() => scarf_parser::Token::DirEndif,
1182 Token::DirIfdef() => scarf_parser::Token::DirIfdef,
1183 Token::DirIfndef() => scarf_parser::Token::DirIfndef,
1184 Token::DirInclude() => scarf_parser::Token::DirInclude,
1185 Token::DirLine() => scarf_parser::Token::DirLine,
1186 Token::DirNounconnectedDrive() => {
1187 scarf_parser::Token::DirNounconnectedDrive
1188 }
1189 Token::DirPragma() => scarf_parser::Token::DirPragma,
1190 Token::DirResetall() => scarf_parser::Token::DirResetall,
1191 Token::DirTimescale() => scarf_parser::Token::DirTimescale,
1192 Token::DirUnconnectedDrive() => {
1193 scarf_parser::Token::DirUnconnectedDrive
1194 }
1195 Token::DirUndef() => scarf_parser::Token::DirUndef,
1196 Token::DirUndefineall() => scarf_parser::Token::DirUndefineall,
1197 Token::Plus() => scarf_parser::Token::Plus,
1198 Token::Minus() => scarf_parser::Token::Minus,
1199 Token::Exclamation() => scarf_parser::Token::Exclamation,
1200 Token::Quest() => scarf_parser::Token::Quest,
1201 Token::Tilde() => scarf_parser::Token::Tilde,
1202 Token::Amp() => scarf_parser::Token::Amp,
1203 Token::TildeAmp() => scarf_parser::Token::TildeAmp,
1204 Token::Pipe() => scarf_parser::Token::Pipe,
1205 Token::TildePipe() => scarf_parser::Token::TildePipe,
1206 Token::Caret() => scarf_parser::Token::Caret,
1207 Token::TildeCaret() => scarf_parser::Token::TildeCaret,
1208 Token::CaretTilde() => scarf_parser::Token::CaretTilde,
1209 Token::Star() => scarf_parser::Token::Star,
1210 Token::Slash() => scarf_parser::Token::Slash,
1211 Token::Percent() => scarf_parser::Token::Percent,
1212 Token::EqEq() => scarf_parser::Token::EqEq,
1213 Token::ExclEq() => scarf_parser::Token::ExclEq,
1214 Token::PlusEq() => scarf_parser::Token::PlusEq,
1215 Token::MinusEq() => scarf_parser::Token::MinusEq,
1216 Token::StarEq() => scarf_parser::Token::StarEq,
1217 Token::SlashEq() => scarf_parser::Token::SlashEq,
1218 Token::PercentEq() => scarf_parser::Token::PercentEq,
1219 Token::AmpEq() => scarf_parser::Token::AmpEq,
1220 Token::PipeEq() => scarf_parser::Token::PipeEq,
1221 Token::CaretEq() => scarf_parser::Token::CaretEq,
1222 Token::EqEqEq() => scarf_parser::Token::EqEqEq,
1223 Token::ExclEqEq() => scarf_parser::Token::ExclEqEq,
1224 Token::EqEqQuest() => scarf_parser::Token::EqEqQuest,
1225 Token::ExclEqQuest() => scarf_parser::Token::ExclEqQuest,
1226 Token::AmpAmp() => scarf_parser::Token::AmpAmp,
1227 Token::AmpAmpAmp() => scarf_parser::Token::AmpAmpAmp,
1228 Token::PipePipe() => scarf_parser::Token::PipePipe,
1229 Token::StarStar() => scarf_parser::Token::StarStar,
1230 Token::Lt() => scarf_parser::Token::Lt,
1231 Token::LtEq() => scarf_parser::Token::LtEq,
1232 Token::Gt() => scarf_parser::Token::Gt,
1233 Token::GtEq() => scarf_parser::Token::GtEq,
1234 Token::GtGt() => scarf_parser::Token::GtGt,
1235 Token::LtLt() => scarf_parser::Token::LtLt,
1236 Token::GtGtEq() => scarf_parser::Token::GtGtEq,
1237 Token::LtLtEq() => scarf_parser::Token::LtLtEq,
1238 Token::GtGtGt() => scarf_parser::Token::GtGtGt,
1239 Token::LtLtLt() => scarf_parser::Token::LtLtLt,
1240 Token::GtGtGtEq() => scarf_parser::Token::GtGtGtEq,
1241 Token::LtLtLtEq() => scarf_parser::Token::LtLtLtEq,
1242 Token::MinusGt() => scarf_parser::Token::MinusGt,
1243 Token::MinusGtGt() => scarf_parser::Token::MinusGtGt,
1244 Token::LtMinusGt() => scarf_parser::Token::LtMinusGt,
1245 Token::PlusPlus() => scarf_parser::Token::PlusPlus,
1246 Token::MinusMinus() => scarf_parser::Token::MinusMinus,
1247 Token::PlusColon() => scarf_parser::Token::PlusColon,
1248 Token::MinusColon() => scarf_parser::Token::MinusColon,
1249 Token::PlusSlashMinus() => scarf_parser::Token::PlusSlashMinus,
1250 Token::PlusPercentMinus() => scarf_parser::Token::PlusPercentMinus,
1251 Token::Paren() => scarf_parser::Token::Paren,
1252 Token::EParen() => scarf_parser::Token::EParen,
1253 Token::Bracket() => scarf_parser::Token::Bracket,
1254 Token::EBracket() => scarf_parser::Token::EBracket,
1255 Token::Brace() => scarf_parser::Token::Brace,
1256 Token::EBrace() => scarf_parser::Token::EBrace,
1257 Token::Colon() => scarf_parser::Token::Colon,
1258 Token::SColon() => scarf_parser::Token::SColon,
1259 Token::Apost() => scarf_parser::Token::Apost,
1260 Token::Comma() => scarf_parser::Token::Comma,
1261 Token::Period() => scarf_parser::Token::Period,
1262 Token::Pound() => scarf_parser::Token::Pound,
1263 Token::Dollar() => scarf_parser::Token::Dollar,
1264 Token::At() => scarf_parser::Token::At,
1265 Token::AtAt() => scarf_parser::Token::AtAt,
1266 Token::Eq() => scarf_parser::Token::Eq,
1267 Token::ColonColon() => scarf_parser::Token::ColonColon,
1268 Token::ColonEq() => scarf_parser::Token::ColonEq,
1269 Token::ColonSlash() => scarf_parser::Token::ColonSlash,
1270 Token::PoundPound() => scarf_parser::Token::PoundPound,
1271 Token::PoundMinusPound() => scarf_parser::Token::PoundMinusPound,
1272 Token::PoundEqPound() => scarf_parser::Token::PoundEqPound,
1273 Token::EqGt() => scarf_parser::Token::EqGt,
1274 Token::StarGt() => scarf_parser::Token::StarGt,
1275 Token::PipeMinusGt() => scarf_parser::Token::PipeMinusGt,
1276 Token::PipeEqGt() => scarf_parser::Token::PipeEqGt,
1277 Token::Bslash() => scarf_parser::Token::Bslash,
1278 Token::Std() => scarf_parser::Token::Std,
1279 Token::PathpulseDollar() => scarf_parser::Token::PathpulseDollar,
1280 Token::Option() => scarf_parser::Token::Option,
1281 Token::TypeOption() => scarf_parser::Token::TypeOption,
1282 Token::Randomize() => scarf_parser::Token::Randomize,
1283 Token::Sample() => scarf_parser::Token::Sample,
1284 Token::OneStep() => scarf_parser::Token::OneStep,
1285 Token::DollarSetup() => scarf_parser::Token::DollarSetup,
1286 Token::DollarHold() => scarf_parser::Token::DollarHold,
1287 Token::DollarSetuphold() => scarf_parser::Token::DollarSetuphold,
1288 Token::DollarRecovery() => scarf_parser::Token::DollarRecovery,
1289 Token::DollarRemoval() => scarf_parser::Token::DollarRemoval,
1290 Token::DollarRecrem() => scarf_parser::Token::DollarRecrem,
1291 Token::DollarSkew() => scarf_parser::Token::DollarSkew,
1292 Token::DollarTimeskew() => scarf_parser::Token::DollarTimeskew,
1293 Token::DollarFullskew() => scarf_parser::Token::DollarFullskew,
1294 Token::DollarPeriod() => scarf_parser::Token::DollarPeriod,
1295 Token::DollarWidth() => scarf_parser::Token::DollarWidth,
1296 Token::DollarNochange() => scarf_parser::Token::DollarNochange,
1297 Token::DollarRoot() => scarf_parser::Token::DollarRoot,
1298 Token::DollarUnit() => scarf_parser::Token::DollarUnit,
1299 Token::DollarFatal() => scarf_parser::Token::DollarFatal,
1300 Token::DollarError() => scarf_parser::Token::DollarError,
1301 Token::DollarWarning() => scarf_parser::Token::DollarWarning,
1302 Token::DollarInfo() => scarf_parser::Token::DollarInfo,
1303 Token::OnelineComment { text } => {
1304 scarf_parser::Token::OnelineComment(&text)
1305 }
1306 Token::BlockComment { text } => {
1307 scarf_parser::Token::BlockComment(&text)
1308 }
1309 Token::UnsignedNumber { text } => {
1310 scarf_parser::Token::UnsignedNumber(&text)
1311 }
1312 Token::FixedPointNumber { text } => {
1313 scarf_parser::Token::FixedPointNumber(&text)
1314 }
1315 Token::BinaryNumber { text } => {
1316 scarf_parser::Token::BinaryNumber(&text)
1317 }
1318 Token::OctalNumber { text } => {
1319 scarf_parser::Token::OctalNumber(&text)
1320 }
1321 Token::DecimalNumber { text } => {
1322 scarf_parser::Token::DecimalNumber(&text)
1323 }
1324 Token::HexNumber { text } => scarf_parser::Token::HexNumber(&text),
1325 Token::ScientificNumber { text } => {
1326 scarf_parser::Token::ScientificNumber(&text)
1327 }
1328 Token::UnbasedUnsizedLiteral { text } => {
1329 scarf_parser::Token::UnbasedUnsizedLiteral(&text)
1330 }
1331 Token::SystemTfIdentifier { text } => {
1332 scarf_parser::Token::SystemTfIdentifier(&text)
1333 }
1334 Token::SimpleIdentifier { text } => {
1335 scarf_parser::Token::SimpleIdentifier(&text)
1336 }
1337 Token::EscapedIdentifier { text } => {
1338 scarf_parser::Token::EscapedIdentifier(&text)
1339 }
1340 Token::PreprocessorIdentifier { text } => {
1341 scarf_parser::Token::PreprocessorIdentifier(&text)
1342 }
1343 Token::TextMacro { text } => scarf_parser::Token::TextMacro(&text),
1344 Token::StringLiteral { text } => {
1345 scarf_parser::Token::StringLiteral(&text)
1346 }
1347 Token::PreprocessorStringLiteral { text } => {
1348 scarf_parser::Token::PreprocessorStringLiteral(&text)
1349 }
1350 Token::TripleQuoteStringLiteral { text } => {
1351 scarf_parser::Token::TripleQuoteStringLiteral(&text)
1352 }
1353 Token::PreprocessorTripleQuoteStringLiteral { text } => {
1354 scarf_parser::Token::PreprocessorTripleQuoteStringLiteral(&text)
1355 }
1356 Token::Newline() => scarf_parser::Token::Newline,
1357 }
1358 }
1359}
1360
1361#[pyclass(eq, from_py_object, module = "scarf_python", str)]
1363#[derive(Clone, PartialEq, Eq)]
1364pub struct SpannedToken {
1365 #[pyo3(get, set)]
1366 pub token: Token,
1367 #[pyo3(get, set)]
1368 pub span: Span,
1369}
1370
1371impl<'a> From<scarf_parser::SpannedToken<'a>> for SpannedToken {
1372 fn from(value: scarf_parser::SpannedToken<'a>) -> Self {
1373 Self {
1374 token: value.0.into(),
1375 span: value.1.into(),
1376 }
1377 }
1378}
1379
1380impl std::fmt::Display for SpannedToken {
1381 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1382 self.token.fmt(f)
1383 }
1384}
1385
1386impl<'a> SpannedToken {
1387 pub fn to_rust(
1389 &'a self,
1390 cache: &'a PreprocessorCache<'a>,
1391 ) -> scarf_parser::SpannedToken<'a> {
1392 scarf_parser::SpannedToken(
1393 (&self.token).into(),
1394 (&self.span).to_span(cache),
1395 )
1396 }
1397}