use crate::Span;
use pyo3::prelude::*;
use scarf_parser::{self, PreprocessorCache};
#[pyclass(eq, from_py_object, module = "scarf_python", str)]
#[derive(Clone, PartialEq, Eq)]
pub enum Token {
Error(),
Always(),
And(),
Assign(),
Begin(),
Buf(),
Bufif0(),
Bufif1(),
Case(),
Casex(),
Casez(),
Cmos(),
Deassign(),
Default(),
Defparam(),
Disable(),
Edge(),
Else(),
End(),
Endcase(),
Endfunction(),
Endmodule(),
Endprimitive(),
Endspecify(),
Endtable(),
Endtask(),
Event(),
For(),
Force(),
Forever(),
Fork(),
Function(),
Highz0(),
Highz1(),
If(),
Ifnone(),
Initial(),
Inout(),
Input(),
Integer(),
Join(),
Large(),
Macromodule(),
Medium(),
Module(),
Nand(),
Negedge(),
Nmos(),
Nor(),
Not(),
Notif0(),
Notif1(),
Or(),
Output(),
Parameter(),
Pmos(),
Posedge(),
Primitive(),
Pull0(),
Pull1(),
Pulldown(),
Pullup(),
Rcmos(),
Real(),
Realtime(),
Reg(),
Release(),
Repeat(),
Rnmos(),
Rpmos(),
Rtran(),
Rtranif0(),
Rtranif1(),
Scalared(),
Small(),
Specify(),
Specparam(),
Strong0(),
Strong1(),
Supply0(),
Supply1(),
Table(),
Task(),
Time(),
Tran(),
Tranif0(),
Tranif1(),
Tri(),
Tri0(),
Tri1(),
Triand(),
Trior(),
Trireg(),
Vectored(),
Wait(),
Wand(),
Weak0(),
Weak1(),
While(),
Wire(),
Wor(),
Xnor(),
Xor(),
Automatic(),
Cell(),
Config(),
Design(),
Endconfig(),
Endgenerate(),
Generate(),
Genvar(),
Incdir(),
Include(),
Instance(),
Liblist(),
Library(),
Localparam(),
Noshowcancelled(),
PulsestyleOndetect(),
PulsestyleOnevent(),
Showcancelled(),
Signed(),
Unsigned(),
Use(),
Uwire(),
Alias(),
AlwaysComb(),
AlwaysFf(),
AlwaysLatch(),
Assert(),
Assume(),
Before(),
Bind(),
Bins(),
Binsof(),
Bit(),
Break(),
Byte(),
Chandle(),
Class(),
Clocking(),
Const(),
Constraint(),
Context(),
Continue(),
Cover(),
Covergroup(),
Coverpoint(),
Cross(),
Dist(),
Do(),
Endclass(),
Endclocking(),
Endgroup(),
Endinterface(),
Endpackage(),
Endprogram(),
Endproperty(),
Endsequence(),
Enum(),
Expect(),
Export(),
Extends(),
Extern(),
Final(),
FirstMatch(),
Foreach(),
Forkjoin(),
Iff(),
IgnoreBins(),
IllegalBins(),
Import(),
Inside(),
Int(),
Interface(),
Intersect(),
JoinAny(),
JoinNone(),
Local(),
Logic(),
Longint(),
Matches(),
Modport(),
New(),
Null(),
Package(),
Packed(),
Priority(),
Program(),
Property(),
Protected(),
Pure(),
Rand(),
Randc(),
Randcase(),
Randsequence(),
Ref(),
Return(),
Sequence(),
Shortint(),
Shortreal(),
Solve(),
Static(),
String(),
Struct(),
Super(),
Tagged(),
This(),
Throughout(),
Timeprecision(),
Timeunit(),
Type(),
Typedef(),
Union(),
Unique(),
Var(),
Virtual(),
Void(),
WaitOrder(),
Wildcard(),
With(),
Within(),
AcceptOn(),
Checker(),
Endchecker(),
Eventually(),
Global(),
Implies(),
Let(),
Nexttime(),
RejectOn(),
Restrict(),
SAlways(),
SEventually(),
SNexttime(),
SUntil(),
SUntilWith(),
Strong(),
SyncAcceptOn(),
SyncRejectOn(),
Unique0(),
Until(),
UntilWith(),
Untyped(),
Weak(),
Implements(),
Interconnect(),
Nettype(),
Soft(),
DirUnderscoreFile(),
DirUnderscoreLine(),
DirBeginKeywords(),
DirCelldefine(),
DirDefaultNettype(),
DirDefine(),
DirElse(),
DirElsif(),
DirEndKeywords(),
DirEndcelldefine(),
DirEndif(),
DirIfdef(),
DirIfndef(),
DirInclude(),
DirLine(),
DirNounconnectedDrive(),
DirPragma(),
DirResetall(),
DirTimescale(),
DirUnconnectedDrive(),
DirUndef(),
DirUndefineall(),
Plus(),
Minus(),
Exclamation(),
Quest(),
Tilde(),
Amp(),
TildeAmp(),
Pipe(),
TildePipe(),
Caret(),
TildeCaret(),
CaretTilde(),
Star(),
Slash(),
Percent(),
EqEq(),
ExclEq(),
PlusEq(),
MinusEq(),
StarEq(),
SlashEq(),
PercentEq(),
AmpEq(),
PipeEq(),
CaretEq(),
EqEqEq(),
ExclEqEq(),
EqEqQuest(),
ExclEqQuest(),
AmpAmp(),
AmpAmpAmp(),
PipePipe(),
StarStar(),
Lt(),
LtEq(),
Gt(),
GtEq(),
GtGt(),
LtLt(),
GtGtEq(),
LtLtEq(),
GtGtGt(),
LtLtLt(),
GtGtGtEq(),
LtLtLtEq(),
MinusGt(),
MinusGtGt(),
LtMinusGt(),
PlusPlus(),
MinusMinus(),
PlusColon(),
MinusColon(),
PlusSlashMinus(),
PlusPercentMinus(),
Paren(),
EParen(),
Bracket(),
EBracket(),
Brace(),
EBrace(),
Colon(),
SColon(),
Apost(),
Comma(),
Period(),
Pound(),
Dollar(),
At(),
AtAt(),
Eq(),
ColonColon(),
ColonEq(),
ColonSlash(),
PoundPound(),
PoundMinusPound(),
PoundEqPound(),
EqGt(),
StarGt(),
PipeMinusGt(),
PipeEqGt(),
Bslash(),
Std(),
PathpulseDollar(),
Option(),
TypeOption(),
Randomize(),
Sample(),
OneStep(),
DollarSetup(),
DollarHold(),
DollarSetuphold(),
DollarRecovery(),
DollarRemoval(),
DollarRecrem(),
DollarSkew(),
DollarTimeskew(),
DollarFullskew(),
DollarPeriod(),
DollarWidth(),
DollarNochange(),
DollarRoot(),
DollarUnit(),
DollarFatal(),
DollarError(),
DollarWarning(),
DollarInfo(),
OnelineComment { text: String },
BlockComment { text: String },
UnsignedNumber { text: String },
FixedPointNumber { text: String },
BinaryNumber { text: String },
OctalNumber { text: String },
DecimalNumber { text: String },
HexNumber { text: String },
ScientificNumber { text: String },
UnbasedUnsizedLiteral { text: String },
SystemTfIdentifier { text: String },
SimpleIdentifier { text: String },
EscapedIdentifier { text: String },
PreprocessorIdentifier { text: String },
TextMacro { text: String },
StringLiteral { text: String },
PreprocessorStringLiteral { text: String },
TripleQuoteStringLiteral { text: String },
PreprocessorTripleQuoteStringLiteral { text: String },
Newline(),
}
impl std::fmt::Display for Token {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let rust_token: scarf_parser::Token<'_> = self.into();
rust_token.fmt(f)
}
}
impl<'a> From<scarf_parser::Token<'a>> for Token {
fn from(value: scarf_parser::Token<'a>) -> Self {
match value {
scarf_parser::Token::Error => Token::Error(),
scarf_parser::Token::Always => Token::Always(),
scarf_parser::Token::And => Token::And(),
scarf_parser::Token::Assign => Token::Assign(),
scarf_parser::Token::Begin => Token::Begin(),
scarf_parser::Token::Buf => Token::Buf(),
scarf_parser::Token::Bufif0 => Token::Bufif0(),
scarf_parser::Token::Bufif1 => Token::Bufif1(),
scarf_parser::Token::Case => Token::Case(),
scarf_parser::Token::Casex => Token::Casex(),
scarf_parser::Token::Casez => Token::Casez(),
scarf_parser::Token::Cmos => Token::Cmos(),
scarf_parser::Token::Deassign => Token::Deassign(),
scarf_parser::Token::Default => Token::Default(),
scarf_parser::Token::Defparam => Token::Defparam(),
scarf_parser::Token::Disable => Token::Disable(),
scarf_parser::Token::Edge => Token::Edge(),
scarf_parser::Token::Else => Token::Else(),
scarf_parser::Token::End => Token::End(),
scarf_parser::Token::Endcase => Token::Endcase(),
scarf_parser::Token::Endfunction => Token::Endfunction(),
scarf_parser::Token::Endmodule => Token::Endmodule(),
scarf_parser::Token::Endprimitive => Token::Endprimitive(),
scarf_parser::Token::Endspecify => Token::Endspecify(),
scarf_parser::Token::Endtable => Token::Endtable(),
scarf_parser::Token::Endtask => Token::Endtask(),
scarf_parser::Token::Event => Token::Event(),
scarf_parser::Token::For => Token::For(),
scarf_parser::Token::Force => Token::Force(),
scarf_parser::Token::Forever => Token::Forever(),
scarf_parser::Token::Fork => Token::Fork(),
scarf_parser::Token::Function => Token::Function(),
scarf_parser::Token::Highz0 => Token::Highz0(),
scarf_parser::Token::Highz1 => Token::Highz1(),
scarf_parser::Token::If => Token::If(),
scarf_parser::Token::Ifnone => Token::Ifnone(),
scarf_parser::Token::Initial => Token::Initial(),
scarf_parser::Token::Inout => Token::Inout(),
scarf_parser::Token::Input => Token::Input(),
scarf_parser::Token::Integer => Token::Integer(),
scarf_parser::Token::Join => Token::Join(),
scarf_parser::Token::Large => Token::Large(),
scarf_parser::Token::Macromodule => Token::Macromodule(),
scarf_parser::Token::Medium => Token::Medium(),
scarf_parser::Token::Module => Token::Module(),
scarf_parser::Token::Nand => Token::Nand(),
scarf_parser::Token::Negedge => Token::Negedge(),
scarf_parser::Token::Nmos => Token::Nmos(),
scarf_parser::Token::Nor => Token::Nor(),
scarf_parser::Token::Not => Token::Not(),
scarf_parser::Token::Notif0 => Token::Notif0(),
scarf_parser::Token::Notif1 => Token::Notif1(),
scarf_parser::Token::Or => Token::Or(),
scarf_parser::Token::Output => Token::Output(),
scarf_parser::Token::Parameter => Token::Parameter(),
scarf_parser::Token::Pmos => Token::Pmos(),
scarf_parser::Token::Posedge => Token::Posedge(),
scarf_parser::Token::Primitive => Token::Primitive(),
scarf_parser::Token::Pull0 => Token::Pull0(),
scarf_parser::Token::Pull1 => Token::Pull1(),
scarf_parser::Token::Pulldown => Token::Pulldown(),
scarf_parser::Token::Pullup => Token::Pullup(),
scarf_parser::Token::Rcmos => Token::Rcmos(),
scarf_parser::Token::Real => Token::Real(),
scarf_parser::Token::Realtime => Token::Realtime(),
scarf_parser::Token::Reg => Token::Reg(),
scarf_parser::Token::Release => Token::Release(),
scarf_parser::Token::Repeat => Token::Repeat(),
scarf_parser::Token::Rnmos => Token::Rnmos(),
scarf_parser::Token::Rpmos => Token::Rpmos(),
scarf_parser::Token::Rtran => Token::Rtran(),
scarf_parser::Token::Rtranif0 => Token::Rtranif0(),
scarf_parser::Token::Rtranif1 => Token::Rtranif1(),
scarf_parser::Token::Scalared => Token::Scalared(),
scarf_parser::Token::Small => Token::Small(),
scarf_parser::Token::Specify => Token::Specify(),
scarf_parser::Token::Specparam => Token::Specparam(),
scarf_parser::Token::Strong0 => Token::Strong0(),
scarf_parser::Token::Strong1 => Token::Strong1(),
scarf_parser::Token::Supply0 => Token::Supply0(),
scarf_parser::Token::Supply1 => Token::Supply1(),
scarf_parser::Token::Table => Token::Table(),
scarf_parser::Token::Task => Token::Task(),
scarf_parser::Token::Time => Token::Time(),
scarf_parser::Token::Tran => Token::Tran(),
scarf_parser::Token::Tranif0 => Token::Tranif0(),
scarf_parser::Token::Tranif1 => Token::Tranif1(),
scarf_parser::Token::Tri => Token::Tri(),
scarf_parser::Token::Tri0 => Token::Tri0(),
scarf_parser::Token::Tri1 => Token::Tri1(),
scarf_parser::Token::Triand => Token::Triand(),
scarf_parser::Token::Trior => Token::Trior(),
scarf_parser::Token::Trireg => Token::Trireg(),
scarf_parser::Token::Vectored => Token::Vectored(),
scarf_parser::Token::Wait => Token::Wait(),
scarf_parser::Token::Wand => Token::Wand(),
scarf_parser::Token::Weak0 => Token::Weak0(),
scarf_parser::Token::Weak1 => Token::Weak1(),
scarf_parser::Token::While => Token::While(),
scarf_parser::Token::Wire => Token::Wire(),
scarf_parser::Token::Wor => Token::Wor(),
scarf_parser::Token::Xnor => Token::Xnor(),
scarf_parser::Token::Xor => Token::Xor(),
scarf_parser::Token::Automatic => Token::Automatic(),
scarf_parser::Token::Cell => Token::Cell(),
scarf_parser::Token::Config => Token::Config(),
scarf_parser::Token::Design => Token::Design(),
scarf_parser::Token::Endconfig => Token::Endconfig(),
scarf_parser::Token::Endgenerate => Token::Endgenerate(),
scarf_parser::Token::Generate => Token::Generate(),
scarf_parser::Token::Genvar => Token::Genvar(),
scarf_parser::Token::Incdir => Token::Incdir(),
scarf_parser::Token::Include => Token::Include(),
scarf_parser::Token::Instance => Token::Instance(),
scarf_parser::Token::Liblist => Token::Liblist(),
scarf_parser::Token::Library => Token::Library(),
scarf_parser::Token::Localparam => Token::Localparam(),
scarf_parser::Token::Noshowcancelled => Token::Noshowcancelled(),
scarf_parser::Token::PulsestyleOndetect => {
Token::PulsestyleOndetect()
}
scarf_parser::Token::PulsestyleOnevent => {
Token::PulsestyleOnevent()
}
scarf_parser::Token::Showcancelled => Token::Showcancelled(),
scarf_parser::Token::Signed => Token::Signed(),
scarf_parser::Token::Unsigned => Token::Unsigned(),
scarf_parser::Token::Use => Token::Use(),
scarf_parser::Token::Uwire => Token::Uwire(),
scarf_parser::Token::Alias => Token::Alias(),
scarf_parser::Token::AlwaysComb => Token::AlwaysComb(),
scarf_parser::Token::AlwaysFf => Token::AlwaysFf(),
scarf_parser::Token::AlwaysLatch => Token::AlwaysLatch(),
scarf_parser::Token::Assert => Token::Assert(),
scarf_parser::Token::Assume => Token::Assume(),
scarf_parser::Token::Before => Token::Before(),
scarf_parser::Token::Bind => Token::Bind(),
scarf_parser::Token::Bins => Token::Bins(),
scarf_parser::Token::Binsof => Token::Binsof(),
scarf_parser::Token::Bit => Token::Bit(),
scarf_parser::Token::Break => Token::Break(),
scarf_parser::Token::Byte => Token::Byte(),
scarf_parser::Token::Chandle => Token::Chandle(),
scarf_parser::Token::Class => Token::Class(),
scarf_parser::Token::Clocking => Token::Clocking(),
scarf_parser::Token::Const => Token::Const(),
scarf_parser::Token::Constraint => Token::Constraint(),
scarf_parser::Token::Context => Token::Context(),
scarf_parser::Token::Continue => Token::Continue(),
scarf_parser::Token::Cover => Token::Cover(),
scarf_parser::Token::Covergroup => Token::Covergroup(),
scarf_parser::Token::Coverpoint => Token::Coverpoint(),
scarf_parser::Token::Cross => Token::Cross(),
scarf_parser::Token::Dist => Token::Dist(),
scarf_parser::Token::Do => Token::Do(),
scarf_parser::Token::Endclass => Token::Endclass(),
scarf_parser::Token::Endclocking => Token::Endclocking(),
scarf_parser::Token::Endgroup => Token::Endgroup(),
scarf_parser::Token::Endinterface => Token::Endinterface(),
scarf_parser::Token::Endpackage => Token::Endpackage(),
scarf_parser::Token::Endprogram => Token::Endprogram(),
scarf_parser::Token::Endproperty => Token::Endproperty(),
scarf_parser::Token::Endsequence => Token::Endsequence(),
scarf_parser::Token::Enum => Token::Enum(),
scarf_parser::Token::Expect => Token::Expect(),
scarf_parser::Token::Export => Token::Export(),
scarf_parser::Token::Extends => Token::Extends(),
scarf_parser::Token::Extern => Token::Extern(),
scarf_parser::Token::Final => Token::Final(),
scarf_parser::Token::FirstMatch => Token::FirstMatch(),
scarf_parser::Token::Foreach => Token::Foreach(),
scarf_parser::Token::Forkjoin => Token::Forkjoin(),
scarf_parser::Token::Iff => Token::Iff(),
scarf_parser::Token::IgnoreBins => Token::IgnoreBins(),
scarf_parser::Token::IllegalBins => Token::IllegalBins(),
scarf_parser::Token::Import => Token::Import(),
scarf_parser::Token::Inside => Token::Inside(),
scarf_parser::Token::Int => Token::Int(),
scarf_parser::Token::Interface => Token::Interface(),
scarf_parser::Token::Intersect => Token::Intersect(),
scarf_parser::Token::JoinAny => Token::JoinAny(),
scarf_parser::Token::JoinNone => Token::JoinNone(),
scarf_parser::Token::Local => Token::Local(),
scarf_parser::Token::Logic => Token::Logic(),
scarf_parser::Token::Longint => Token::Longint(),
scarf_parser::Token::Matches => Token::Matches(),
scarf_parser::Token::Modport => Token::Modport(),
scarf_parser::Token::New => Token::New(),
scarf_parser::Token::Null => Token::Null(),
scarf_parser::Token::Package => Token::Package(),
scarf_parser::Token::Packed => Token::Packed(),
scarf_parser::Token::Priority => Token::Priority(),
scarf_parser::Token::Program => Token::Program(),
scarf_parser::Token::Property => Token::Property(),
scarf_parser::Token::Protected => Token::Protected(),
scarf_parser::Token::Pure => Token::Pure(),
scarf_parser::Token::Rand => Token::Rand(),
scarf_parser::Token::Randc => Token::Randc(),
scarf_parser::Token::Randcase => Token::Randcase(),
scarf_parser::Token::Randsequence => Token::Randsequence(),
scarf_parser::Token::Ref => Token::Ref(),
scarf_parser::Token::Return => Token::Return(),
scarf_parser::Token::Sequence => Token::Sequence(),
scarf_parser::Token::Shortint => Token::Shortint(),
scarf_parser::Token::Shortreal => Token::Shortreal(),
scarf_parser::Token::Solve => Token::Solve(),
scarf_parser::Token::Static => Token::Static(),
scarf_parser::Token::String => Token::String(),
scarf_parser::Token::Struct => Token::Struct(),
scarf_parser::Token::Super => Token::Super(),
scarf_parser::Token::Tagged => Token::Tagged(),
scarf_parser::Token::This => Token::This(),
scarf_parser::Token::Throughout => Token::Throughout(),
scarf_parser::Token::Timeprecision => Token::Timeprecision(),
scarf_parser::Token::Timeunit => Token::Timeunit(),
scarf_parser::Token::Type => Token::Type(),
scarf_parser::Token::Typedef => Token::Typedef(),
scarf_parser::Token::Union => Token::Union(),
scarf_parser::Token::Unique => Token::Unique(),
scarf_parser::Token::Var => Token::Var(),
scarf_parser::Token::Virtual => Token::Virtual(),
scarf_parser::Token::Void => Token::Void(),
scarf_parser::Token::WaitOrder => Token::WaitOrder(),
scarf_parser::Token::Wildcard => Token::Wildcard(),
scarf_parser::Token::With => Token::With(),
scarf_parser::Token::Within => Token::Within(),
scarf_parser::Token::AcceptOn => Token::AcceptOn(),
scarf_parser::Token::Checker => Token::Checker(),
scarf_parser::Token::Endchecker => Token::Endchecker(),
scarf_parser::Token::Eventually => Token::Eventually(),
scarf_parser::Token::Global => Token::Global(),
scarf_parser::Token::Implies => Token::Implies(),
scarf_parser::Token::Let => Token::Let(),
scarf_parser::Token::Nexttime => Token::Nexttime(),
scarf_parser::Token::RejectOn => Token::RejectOn(),
scarf_parser::Token::Restrict => Token::Restrict(),
scarf_parser::Token::SAlways => Token::SAlways(),
scarf_parser::Token::SEventually => Token::SEventually(),
scarf_parser::Token::SNexttime => Token::SNexttime(),
scarf_parser::Token::SUntil => Token::SUntil(),
scarf_parser::Token::SUntilWith => Token::SUntilWith(),
scarf_parser::Token::Strong => Token::Strong(),
scarf_parser::Token::SyncAcceptOn => Token::SyncAcceptOn(),
scarf_parser::Token::SyncRejectOn => Token::SyncRejectOn(),
scarf_parser::Token::Unique0 => Token::Unique0(),
scarf_parser::Token::Until => Token::Until(),
scarf_parser::Token::UntilWith => Token::UntilWith(),
scarf_parser::Token::Untyped => Token::Untyped(),
scarf_parser::Token::Weak => Token::Weak(),
scarf_parser::Token::Implements => Token::Implements(),
scarf_parser::Token::Interconnect => Token::Interconnect(),
scarf_parser::Token::Nettype => Token::Nettype(),
scarf_parser::Token::Soft => Token::Soft(),
scarf_parser::Token::DirUnderscoreFile => {
Token::DirUnderscoreFile()
}
scarf_parser::Token::DirUnderscoreLine => {
Token::DirUnderscoreLine()
}
scarf_parser::Token::DirBeginKeywords => Token::DirBeginKeywords(),
scarf_parser::Token::DirCelldefine => Token::DirCelldefine(),
scarf_parser::Token::DirDefaultNettype => {
Token::DirDefaultNettype()
}
scarf_parser::Token::DirDefine => Token::DirDefine(),
scarf_parser::Token::DirElse => Token::DirElse(),
scarf_parser::Token::DirElsif => Token::DirElsif(),
scarf_parser::Token::DirEndKeywords => Token::DirEndKeywords(),
scarf_parser::Token::DirEndcelldefine => Token::DirEndcelldefine(),
scarf_parser::Token::DirEndif => Token::DirEndif(),
scarf_parser::Token::DirIfdef => Token::DirIfdef(),
scarf_parser::Token::DirIfndef => Token::DirIfndef(),
scarf_parser::Token::DirInclude => Token::DirInclude(),
scarf_parser::Token::DirLine => Token::DirLine(),
scarf_parser::Token::DirNounconnectedDrive => {
Token::DirNounconnectedDrive()
}
scarf_parser::Token::DirPragma => Token::DirPragma(),
scarf_parser::Token::DirResetall => Token::DirResetall(),
scarf_parser::Token::DirTimescale => Token::DirTimescale(),
scarf_parser::Token::DirUnconnectedDrive => {
Token::DirUnconnectedDrive()
}
scarf_parser::Token::DirUndef => Token::DirUndef(),
scarf_parser::Token::DirUndefineall => Token::DirUndefineall(),
scarf_parser::Token::Plus => Token::Plus(),
scarf_parser::Token::Minus => Token::Minus(),
scarf_parser::Token::Exclamation => Token::Exclamation(),
scarf_parser::Token::Quest => Token::Quest(),
scarf_parser::Token::Tilde => Token::Tilde(),
scarf_parser::Token::Amp => Token::Amp(),
scarf_parser::Token::TildeAmp => Token::TildeAmp(),
scarf_parser::Token::Pipe => Token::Pipe(),
scarf_parser::Token::TildePipe => Token::TildePipe(),
scarf_parser::Token::Caret => Token::Caret(),
scarf_parser::Token::TildeCaret => Token::TildeCaret(),
scarf_parser::Token::CaretTilde => Token::CaretTilde(),
scarf_parser::Token::Star => Token::Star(),
scarf_parser::Token::Slash => Token::Slash(),
scarf_parser::Token::Percent => Token::Percent(),
scarf_parser::Token::EqEq => Token::EqEq(),
scarf_parser::Token::ExclEq => Token::ExclEq(),
scarf_parser::Token::PlusEq => Token::PlusEq(),
scarf_parser::Token::MinusEq => Token::MinusEq(),
scarf_parser::Token::StarEq => Token::StarEq(),
scarf_parser::Token::SlashEq => Token::SlashEq(),
scarf_parser::Token::PercentEq => Token::PercentEq(),
scarf_parser::Token::AmpEq => Token::AmpEq(),
scarf_parser::Token::PipeEq => Token::PipeEq(),
scarf_parser::Token::CaretEq => Token::CaretEq(),
scarf_parser::Token::EqEqEq => Token::EqEqEq(),
scarf_parser::Token::ExclEqEq => Token::ExclEqEq(),
scarf_parser::Token::EqEqQuest => Token::EqEqQuest(),
scarf_parser::Token::ExclEqQuest => Token::ExclEqQuest(),
scarf_parser::Token::AmpAmp => Token::AmpAmp(),
scarf_parser::Token::AmpAmpAmp => Token::AmpAmpAmp(),
scarf_parser::Token::PipePipe => Token::PipePipe(),
scarf_parser::Token::StarStar => Token::StarStar(),
scarf_parser::Token::Lt => Token::Lt(),
scarf_parser::Token::LtEq => Token::LtEq(),
scarf_parser::Token::Gt => Token::Gt(),
scarf_parser::Token::GtEq => Token::GtEq(),
scarf_parser::Token::GtGt => Token::GtGt(),
scarf_parser::Token::LtLt => Token::LtLt(),
scarf_parser::Token::GtGtEq => Token::GtGtEq(),
scarf_parser::Token::LtLtEq => Token::LtLtEq(),
scarf_parser::Token::GtGtGt => Token::GtGtGt(),
scarf_parser::Token::LtLtLt => Token::LtLtLt(),
scarf_parser::Token::GtGtGtEq => Token::GtGtGtEq(),
scarf_parser::Token::LtLtLtEq => Token::LtLtLtEq(),
scarf_parser::Token::MinusGt => Token::MinusGt(),
scarf_parser::Token::MinusGtGt => Token::MinusGtGt(),
scarf_parser::Token::LtMinusGt => Token::LtMinusGt(),
scarf_parser::Token::PlusPlus => Token::PlusPlus(),
scarf_parser::Token::MinusMinus => Token::MinusMinus(),
scarf_parser::Token::PlusColon => Token::PlusColon(),
scarf_parser::Token::MinusColon => Token::MinusColon(),
scarf_parser::Token::PlusSlashMinus => Token::PlusSlashMinus(),
scarf_parser::Token::PlusPercentMinus => Token::PlusPercentMinus(),
scarf_parser::Token::Paren => Token::Paren(),
scarf_parser::Token::EParen => Token::EParen(),
scarf_parser::Token::Bracket => Token::Bracket(),
scarf_parser::Token::EBracket => Token::EBracket(),
scarf_parser::Token::Brace => Token::Brace(),
scarf_parser::Token::EBrace => Token::EBrace(),
scarf_parser::Token::Colon => Token::Colon(),
scarf_parser::Token::SColon => Token::SColon(),
scarf_parser::Token::Apost => Token::Apost(),
scarf_parser::Token::Comma => Token::Comma(),
scarf_parser::Token::Period => Token::Period(),
scarf_parser::Token::Pound => Token::Pound(),
scarf_parser::Token::Dollar => Token::Dollar(),
scarf_parser::Token::At => Token::At(),
scarf_parser::Token::AtAt => Token::AtAt(),
scarf_parser::Token::Eq => Token::Eq(),
scarf_parser::Token::ColonColon => Token::ColonColon(),
scarf_parser::Token::ColonEq => Token::ColonEq(),
scarf_parser::Token::ColonSlash => Token::ColonSlash(),
scarf_parser::Token::PoundPound => Token::PoundPound(),
scarf_parser::Token::PoundMinusPound => Token::PoundMinusPound(),
scarf_parser::Token::PoundEqPound => Token::PoundEqPound(),
scarf_parser::Token::EqGt => Token::EqGt(),
scarf_parser::Token::StarGt => Token::StarGt(),
scarf_parser::Token::PipeMinusGt => Token::PipeMinusGt(),
scarf_parser::Token::PipeEqGt => Token::PipeEqGt(),
scarf_parser::Token::Bslash => Token::Bslash(),
scarf_parser::Token::Std => Token::Std(),
scarf_parser::Token::PathpulseDollar => Token::PathpulseDollar(),
scarf_parser::Token::Option => Token::Option(),
scarf_parser::Token::TypeOption => Token::TypeOption(),
scarf_parser::Token::Randomize => Token::Randomize(),
scarf_parser::Token::Sample => Token::Sample(),
scarf_parser::Token::OneStep => Token::OneStep(),
scarf_parser::Token::DollarSetup => Token::DollarSetup(),
scarf_parser::Token::DollarHold => Token::DollarHold(),
scarf_parser::Token::DollarSetuphold => Token::DollarSetuphold(),
scarf_parser::Token::DollarRecovery => Token::DollarRecovery(),
scarf_parser::Token::DollarRemoval => Token::DollarRemoval(),
scarf_parser::Token::DollarRecrem => Token::DollarRecrem(),
scarf_parser::Token::DollarSkew => Token::DollarSkew(),
scarf_parser::Token::DollarTimeskew => Token::DollarTimeskew(),
scarf_parser::Token::DollarFullskew => Token::DollarFullskew(),
scarf_parser::Token::DollarPeriod => Token::DollarPeriod(),
scarf_parser::Token::DollarWidth => Token::DollarWidth(),
scarf_parser::Token::DollarNochange => Token::DollarNochange(),
scarf_parser::Token::DollarRoot => Token::DollarRoot(),
scarf_parser::Token::DollarUnit => Token::DollarUnit(),
scarf_parser::Token::DollarFatal => Token::DollarFatal(),
scarf_parser::Token::DollarError => Token::DollarError(),
scarf_parser::Token::DollarWarning => Token::DollarWarning(),
scarf_parser::Token::DollarInfo => Token::DollarInfo(),
scarf_parser::Token::OnelineComment(str) => Token::OnelineComment {
text: str.to_string(),
},
scarf_parser::Token::BlockComment(str) => Token::BlockComment {
text: str.to_string(),
},
scarf_parser::Token::UnsignedNumber(str) => Token::UnsignedNumber {
text: str.to_string(),
},
scarf_parser::Token::FixedPointNumber(str) => {
Token::FixedPointNumber {
text: str.to_string(),
}
}
scarf_parser::Token::BinaryNumber(str) => Token::BinaryNumber {
text: str.to_string(),
},
scarf_parser::Token::OctalNumber(str) => Token::OctalNumber {
text: str.to_string(),
},
scarf_parser::Token::DecimalNumber(str) => Token::DecimalNumber {
text: str.to_string(),
},
scarf_parser::Token::HexNumber(str) => Token::HexNumber {
text: str.to_string(),
},
scarf_parser::Token::ScientificNumber(str) => {
Token::ScientificNumber {
text: str.to_string(),
}
}
scarf_parser::Token::UnbasedUnsizedLiteral(str) => {
Token::UnbasedUnsizedLiteral {
text: str.to_string(),
}
}
scarf_parser::Token::SystemTfIdentifier(str) => {
Token::SystemTfIdentifier {
text: str.to_string(),
}
}
scarf_parser::Token::SimpleIdentifier(str) => {
Token::SimpleIdentifier {
text: str.to_string(),
}
}
scarf_parser::Token::EscapedIdentifier(str) => {
Token::EscapedIdentifier {
text: str.to_string(),
}
}
scarf_parser::Token::PreprocessorIdentifier(str) => {
Token::PreprocessorIdentifier {
text: str.to_string(),
}
}
scarf_parser::Token::TextMacro(str) => Token::TextMacro {
text: str.to_string(),
},
scarf_parser::Token::StringLiteral(str) => Token::StringLiteral {
text: str.to_string(),
},
scarf_parser::Token::PreprocessorStringLiteral(str) => {
Token::PreprocessorStringLiteral {
text: str.to_string(),
}
}
scarf_parser::Token::TripleQuoteStringLiteral(str) => {
Token::TripleQuoteStringLiteral {
text: str.to_string(),
}
}
scarf_parser::Token::PreprocessorTripleQuoteStringLiteral(str) => {
Token::PreprocessorTripleQuoteStringLiteral {
text: str.to_string(),
}
}
scarf_parser::Token::Newline => Token::Newline(),
}
}
}
impl<'a> From<&'a Token> for scarf_parser::Token<'a> {
fn from(value: &'a Token) -> Self {
match value {
Token::Error() => scarf_parser::Token::Error,
Token::Always() => scarf_parser::Token::Always,
Token::And() => scarf_parser::Token::And,
Token::Assign() => scarf_parser::Token::Assign,
Token::Begin() => scarf_parser::Token::Begin,
Token::Buf() => scarf_parser::Token::Buf,
Token::Bufif0() => scarf_parser::Token::Bufif0,
Token::Bufif1() => scarf_parser::Token::Bufif1,
Token::Case() => scarf_parser::Token::Case,
Token::Casex() => scarf_parser::Token::Casex,
Token::Casez() => scarf_parser::Token::Casez,
Token::Cmos() => scarf_parser::Token::Cmos,
Token::Deassign() => scarf_parser::Token::Deassign,
Token::Default() => scarf_parser::Token::Default,
Token::Defparam() => scarf_parser::Token::Defparam,
Token::Disable() => scarf_parser::Token::Disable,
Token::Edge() => scarf_parser::Token::Edge,
Token::Else() => scarf_parser::Token::Else,
Token::End() => scarf_parser::Token::End,
Token::Endcase() => scarf_parser::Token::Endcase,
Token::Endfunction() => scarf_parser::Token::Endfunction,
Token::Endmodule() => scarf_parser::Token::Endmodule,
Token::Endprimitive() => scarf_parser::Token::Endprimitive,
Token::Endspecify() => scarf_parser::Token::Endspecify,
Token::Endtable() => scarf_parser::Token::Endtable,
Token::Endtask() => scarf_parser::Token::Endtask,
Token::Event() => scarf_parser::Token::Event,
Token::For() => scarf_parser::Token::For,
Token::Force() => scarf_parser::Token::Force,
Token::Forever() => scarf_parser::Token::Forever,
Token::Fork() => scarf_parser::Token::Fork,
Token::Function() => scarf_parser::Token::Function,
Token::Highz0() => scarf_parser::Token::Highz0,
Token::Highz1() => scarf_parser::Token::Highz1,
Token::If() => scarf_parser::Token::If,
Token::Ifnone() => scarf_parser::Token::Ifnone,
Token::Initial() => scarf_parser::Token::Initial,
Token::Inout() => scarf_parser::Token::Inout,
Token::Input() => scarf_parser::Token::Input,
Token::Integer() => scarf_parser::Token::Integer,
Token::Join() => scarf_parser::Token::Join,
Token::Large() => scarf_parser::Token::Large,
Token::Macromodule() => scarf_parser::Token::Macromodule,
Token::Medium() => scarf_parser::Token::Medium,
Token::Module() => scarf_parser::Token::Module,
Token::Nand() => scarf_parser::Token::Nand,
Token::Negedge() => scarf_parser::Token::Negedge,
Token::Nmos() => scarf_parser::Token::Nmos,
Token::Nor() => scarf_parser::Token::Nor,
Token::Not() => scarf_parser::Token::Not,
Token::Notif0() => scarf_parser::Token::Notif0,
Token::Notif1() => scarf_parser::Token::Notif1,
Token::Or() => scarf_parser::Token::Or,
Token::Output() => scarf_parser::Token::Output,
Token::Parameter() => scarf_parser::Token::Parameter,
Token::Pmos() => scarf_parser::Token::Pmos,
Token::Posedge() => scarf_parser::Token::Posedge,
Token::Primitive() => scarf_parser::Token::Primitive,
Token::Pull0() => scarf_parser::Token::Pull0,
Token::Pull1() => scarf_parser::Token::Pull1,
Token::Pulldown() => scarf_parser::Token::Pulldown,
Token::Pullup() => scarf_parser::Token::Pullup,
Token::Rcmos() => scarf_parser::Token::Rcmos,
Token::Real() => scarf_parser::Token::Real,
Token::Realtime() => scarf_parser::Token::Realtime,
Token::Reg() => scarf_parser::Token::Reg,
Token::Release() => scarf_parser::Token::Release,
Token::Repeat() => scarf_parser::Token::Repeat,
Token::Rnmos() => scarf_parser::Token::Rnmos,
Token::Rpmos() => scarf_parser::Token::Rpmos,
Token::Rtran() => scarf_parser::Token::Rtran,
Token::Rtranif0() => scarf_parser::Token::Rtranif0,
Token::Rtranif1() => scarf_parser::Token::Rtranif1,
Token::Scalared() => scarf_parser::Token::Scalared,
Token::Small() => scarf_parser::Token::Small,
Token::Specify() => scarf_parser::Token::Specify,
Token::Specparam() => scarf_parser::Token::Specparam,
Token::Strong0() => scarf_parser::Token::Strong0,
Token::Strong1() => scarf_parser::Token::Strong1,
Token::Supply0() => scarf_parser::Token::Supply0,
Token::Supply1() => scarf_parser::Token::Supply1,
Token::Table() => scarf_parser::Token::Table,
Token::Task() => scarf_parser::Token::Task,
Token::Time() => scarf_parser::Token::Time,
Token::Tran() => scarf_parser::Token::Tran,
Token::Tranif0() => scarf_parser::Token::Tranif0,
Token::Tranif1() => scarf_parser::Token::Tranif1,
Token::Tri() => scarf_parser::Token::Tri,
Token::Tri0() => scarf_parser::Token::Tri0,
Token::Tri1() => scarf_parser::Token::Tri1,
Token::Triand() => scarf_parser::Token::Triand,
Token::Trior() => scarf_parser::Token::Trior,
Token::Trireg() => scarf_parser::Token::Trireg,
Token::Vectored() => scarf_parser::Token::Vectored,
Token::Wait() => scarf_parser::Token::Wait,
Token::Wand() => scarf_parser::Token::Wand,
Token::Weak0() => scarf_parser::Token::Weak0,
Token::Weak1() => scarf_parser::Token::Weak1,
Token::While() => scarf_parser::Token::While,
Token::Wire() => scarf_parser::Token::Wire,
Token::Wor() => scarf_parser::Token::Wor,
Token::Xnor() => scarf_parser::Token::Xnor,
Token::Xor() => scarf_parser::Token::Xor,
Token::Automatic() => scarf_parser::Token::Automatic,
Token::Cell() => scarf_parser::Token::Cell,
Token::Config() => scarf_parser::Token::Config,
Token::Design() => scarf_parser::Token::Design,
Token::Endconfig() => scarf_parser::Token::Endconfig,
Token::Endgenerate() => scarf_parser::Token::Endgenerate,
Token::Generate() => scarf_parser::Token::Generate,
Token::Genvar() => scarf_parser::Token::Genvar,
Token::Incdir() => scarf_parser::Token::Incdir,
Token::Include() => scarf_parser::Token::Include,
Token::Instance() => scarf_parser::Token::Instance,
Token::Liblist() => scarf_parser::Token::Liblist,
Token::Library() => scarf_parser::Token::Library,
Token::Localparam() => scarf_parser::Token::Localparam,
Token::Noshowcancelled() => scarf_parser::Token::Noshowcancelled,
Token::PulsestyleOndetect() => {
scarf_parser::Token::PulsestyleOndetect
}
Token::PulsestyleOnevent() => {
scarf_parser::Token::PulsestyleOnevent
}
Token::Showcancelled() => scarf_parser::Token::Showcancelled,
Token::Signed() => scarf_parser::Token::Signed,
Token::Unsigned() => scarf_parser::Token::Unsigned,
Token::Use() => scarf_parser::Token::Use,
Token::Uwire() => scarf_parser::Token::Uwire,
Token::Alias() => scarf_parser::Token::Alias,
Token::AlwaysComb() => scarf_parser::Token::AlwaysComb,
Token::AlwaysFf() => scarf_parser::Token::AlwaysFf,
Token::AlwaysLatch() => scarf_parser::Token::AlwaysLatch,
Token::Assert() => scarf_parser::Token::Assert,
Token::Assume() => scarf_parser::Token::Assume,
Token::Before() => scarf_parser::Token::Before,
Token::Bind() => scarf_parser::Token::Bind,
Token::Bins() => scarf_parser::Token::Bins,
Token::Binsof() => scarf_parser::Token::Binsof,
Token::Bit() => scarf_parser::Token::Bit,
Token::Break() => scarf_parser::Token::Break,
Token::Byte() => scarf_parser::Token::Byte,
Token::Chandle() => scarf_parser::Token::Chandle,
Token::Class() => scarf_parser::Token::Class,
Token::Clocking() => scarf_parser::Token::Clocking,
Token::Const() => scarf_parser::Token::Const,
Token::Constraint() => scarf_parser::Token::Constraint,
Token::Context() => scarf_parser::Token::Context,
Token::Continue() => scarf_parser::Token::Continue,
Token::Cover() => scarf_parser::Token::Cover,
Token::Covergroup() => scarf_parser::Token::Covergroup,
Token::Coverpoint() => scarf_parser::Token::Coverpoint,
Token::Cross() => scarf_parser::Token::Cross,
Token::Dist() => scarf_parser::Token::Dist,
Token::Do() => scarf_parser::Token::Do,
Token::Endclass() => scarf_parser::Token::Endclass,
Token::Endclocking() => scarf_parser::Token::Endclocking,
Token::Endgroup() => scarf_parser::Token::Endgroup,
Token::Endinterface() => scarf_parser::Token::Endinterface,
Token::Endpackage() => scarf_parser::Token::Endpackage,
Token::Endprogram() => scarf_parser::Token::Endprogram,
Token::Endproperty() => scarf_parser::Token::Endproperty,
Token::Endsequence() => scarf_parser::Token::Endsequence,
Token::Enum() => scarf_parser::Token::Enum,
Token::Expect() => scarf_parser::Token::Expect,
Token::Export() => scarf_parser::Token::Export,
Token::Extends() => scarf_parser::Token::Extends,
Token::Extern() => scarf_parser::Token::Extern,
Token::Final() => scarf_parser::Token::Final,
Token::FirstMatch() => scarf_parser::Token::FirstMatch,
Token::Foreach() => scarf_parser::Token::Foreach,
Token::Forkjoin() => scarf_parser::Token::Forkjoin,
Token::Iff() => scarf_parser::Token::Iff,
Token::IgnoreBins() => scarf_parser::Token::IgnoreBins,
Token::IllegalBins() => scarf_parser::Token::IllegalBins,
Token::Import() => scarf_parser::Token::Import,
Token::Inside() => scarf_parser::Token::Inside,
Token::Int() => scarf_parser::Token::Int,
Token::Interface() => scarf_parser::Token::Interface,
Token::Intersect() => scarf_parser::Token::Intersect,
Token::JoinAny() => scarf_parser::Token::JoinAny,
Token::JoinNone() => scarf_parser::Token::JoinNone,
Token::Local() => scarf_parser::Token::Local,
Token::Logic() => scarf_parser::Token::Logic,
Token::Longint() => scarf_parser::Token::Longint,
Token::Matches() => scarf_parser::Token::Matches,
Token::Modport() => scarf_parser::Token::Modport,
Token::New() => scarf_parser::Token::New,
Token::Null() => scarf_parser::Token::Null,
Token::Package() => scarf_parser::Token::Package,
Token::Packed() => scarf_parser::Token::Packed,
Token::Priority() => scarf_parser::Token::Priority,
Token::Program() => scarf_parser::Token::Program,
Token::Property() => scarf_parser::Token::Property,
Token::Protected() => scarf_parser::Token::Protected,
Token::Pure() => scarf_parser::Token::Pure,
Token::Rand() => scarf_parser::Token::Rand,
Token::Randc() => scarf_parser::Token::Randc,
Token::Randcase() => scarf_parser::Token::Randcase,
Token::Randsequence() => scarf_parser::Token::Randsequence,
Token::Ref() => scarf_parser::Token::Ref,
Token::Return() => scarf_parser::Token::Return,
Token::Sequence() => scarf_parser::Token::Sequence,
Token::Shortint() => scarf_parser::Token::Shortint,
Token::Shortreal() => scarf_parser::Token::Shortreal,
Token::Solve() => scarf_parser::Token::Solve,
Token::Static() => scarf_parser::Token::Static,
Token::String() => scarf_parser::Token::String,
Token::Struct() => scarf_parser::Token::Struct,
Token::Super() => scarf_parser::Token::Super,
Token::Tagged() => scarf_parser::Token::Tagged,
Token::This() => scarf_parser::Token::This,
Token::Throughout() => scarf_parser::Token::Throughout,
Token::Timeprecision() => scarf_parser::Token::Timeprecision,
Token::Timeunit() => scarf_parser::Token::Timeunit,
Token::Type() => scarf_parser::Token::Type,
Token::Typedef() => scarf_parser::Token::Typedef,
Token::Union() => scarf_parser::Token::Union,
Token::Unique() => scarf_parser::Token::Unique,
Token::Var() => scarf_parser::Token::Var,
Token::Virtual() => scarf_parser::Token::Virtual,
Token::Void() => scarf_parser::Token::Void,
Token::WaitOrder() => scarf_parser::Token::WaitOrder,
Token::Wildcard() => scarf_parser::Token::Wildcard,
Token::With() => scarf_parser::Token::With,
Token::Within() => scarf_parser::Token::Within,
Token::AcceptOn() => scarf_parser::Token::AcceptOn,
Token::Checker() => scarf_parser::Token::Checker,
Token::Endchecker() => scarf_parser::Token::Endchecker,
Token::Eventually() => scarf_parser::Token::Eventually,
Token::Global() => scarf_parser::Token::Global,
Token::Implies() => scarf_parser::Token::Implies,
Token::Let() => scarf_parser::Token::Let,
Token::Nexttime() => scarf_parser::Token::Nexttime,
Token::RejectOn() => scarf_parser::Token::RejectOn,
Token::Restrict() => scarf_parser::Token::Restrict,
Token::SAlways() => scarf_parser::Token::SAlways,
Token::SEventually() => scarf_parser::Token::SEventually,
Token::SNexttime() => scarf_parser::Token::SNexttime,
Token::SUntil() => scarf_parser::Token::SUntil,
Token::SUntilWith() => scarf_parser::Token::SUntilWith,
Token::Strong() => scarf_parser::Token::Strong,
Token::SyncAcceptOn() => scarf_parser::Token::SyncAcceptOn,
Token::SyncRejectOn() => scarf_parser::Token::SyncRejectOn,
Token::Unique0() => scarf_parser::Token::Unique0,
Token::Until() => scarf_parser::Token::Until,
Token::UntilWith() => scarf_parser::Token::UntilWith,
Token::Untyped() => scarf_parser::Token::Untyped,
Token::Weak() => scarf_parser::Token::Weak,
Token::Implements() => scarf_parser::Token::Implements,
Token::Interconnect() => scarf_parser::Token::Interconnect,
Token::Nettype() => scarf_parser::Token::Nettype,
Token::Soft() => scarf_parser::Token::Soft,
Token::DirUnderscoreFile() => {
scarf_parser::Token::DirUnderscoreFile
}
Token::DirUnderscoreLine() => {
scarf_parser::Token::DirUnderscoreLine
}
Token::DirBeginKeywords() => scarf_parser::Token::DirBeginKeywords,
Token::DirCelldefine() => scarf_parser::Token::DirCelldefine,
Token::DirDefaultNettype() => {
scarf_parser::Token::DirDefaultNettype
}
Token::DirDefine() => scarf_parser::Token::DirDefine,
Token::DirElse() => scarf_parser::Token::DirElse,
Token::DirElsif() => scarf_parser::Token::DirElsif,
Token::DirEndKeywords() => scarf_parser::Token::DirEndKeywords,
Token::DirEndcelldefine() => scarf_parser::Token::DirEndcelldefine,
Token::DirEndif() => scarf_parser::Token::DirEndif,
Token::DirIfdef() => scarf_parser::Token::DirIfdef,
Token::DirIfndef() => scarf_parser::Token::DirIfndef,
Token::DirInclude() => scarf_parser::Token::DirInclude,
Token::DirLine() => scarf_parser::Token::DirLine,
Token::DirNounconnectedDrive() => {
scarf_parser::Token::DirNounconnectedDrive
}
Token::DirPragma() => scarf_parser::Token::DirPragma,
Token::DirResetall() => scarf_parser::Token::DirResetall,
Token::DirTimescale() => scarf_parser::Token::DirTimescale,
Token::DirUnconnectedDrive() => {
scarf_parser::Token::DirUnconnectedDrive
}
Token::DirUndef() => scarf_parser::Token::DirUndef,
Token::DirUndefineall() => scarf_parser::Token::DirUndefineall,
Token::Plus() => scarf_parser::Token::Plus,
Token::Minus() => scarf_parser::Token::Minus,
Token::Exclamation() => scarf_parser::Token::Exclamation,
Token::Quest() => scarf_parser::Token::Quest,
Token::Tilde() => scarf_parser::Token::Tilde,
Token::Amp() => scarf_parser::Token::Amp,
Token::TildeAmp() => scarf_parser::Token::TildeAmp,
Token::Pipe() => scarf_parser::Token::Pipe,
Token::TildePipe() => scarf_parser::Token::TildePipe,
Token::Caret() => scarf_parser::Token::Caret,
Token::TildeCaret() => scarf_parser::Token::TildeCaret,
Token::CaretTilde() => scarf_parser::Token::CaretTilde,
Token::Star() => scarf_parser::Token::Star,
Token::Slash() => scarf_parser::Token::Slash,
Token::Percent() => scarf_parser::Token::Percent,
Token::EqEq() => scarf_parser::Token::EqEq,
Token::ExclEq() => scarf_parser::Token::ExclEq,
Token::PlusEq() => scarf_parser::Token::PlusEq,
Token::MinusEq() => scarf_parser::Token::MinusEq,
Token::StarEq() => scarf_parser::Token::StarEq,
Token::SlashEq() => scarf_parser::Token::SlashEq,
Token::PercentEq() => scarf_parser::Token::PercentEq,
Token::AmpEq() => scarf_parser::Token::AmpEq,
Token::PipeEq() => scarf_parser::Token::PipeEq,
Token::CaretEq() => scarf_parser::Token::CaretEq,
Token::EqEqEq() => scarf_parser::Token::EqEqEq,
Token::ExclEqEq() => scarf_parser::Token::ExclEqEq,
Token::EqEqQuest() => scarf_parser::Token::EqEqQuest,
Token::ExclEqQuest() => scarf_parser::Token::ExclEqQuest,
Token::AmpAmp() => scarf_parser::Token::AmpAmp,
Token::AmpAmpAmp() => scarf_parser::Token::AmpAmpAmp,
Token::PipePipe() => scarf_parser::Token::PipePipe,
Token::StarStar() => scarf_parser::Token::StarStar,
Token::Lt() => scarf_parser::Token::Lt,
Token::LtEq() => scarf_parser::Token::LtEq,
Token::Gt() => scarf_parser::Token::Gt,
Token::GtEq() => scarf_parser::Token::GtEq,
Token::GtGt() => scarf_parser::Token::GtGt,
Token::LtLt() => scarf_parser::Token::LtLt,
Token::GtGtEq() => scarf_parser::Token::GtGtEq,
Token::LtLtEq() => scarf_parser::Token::LtLtEq,
Token::GtGtGt() => scarf_parser::Token::GtGtGt,
Token::LtLtLt() => scarf_parser::Token::LtLtLt,
Token::GtGtGtEq() => scarf_parser::Token::GtGtGtEq,
Token::LtLtLtEq() => scarf_parser::Token::LtLtLtEq,
Token::MinusGt() => scarf_parser::Token::MinusGt,
Token::MinusGtGt() => scarf_parser::Token::MinusGtGt,
Token::LtMinusGt() => scarf_parser::Token::LtMinusGt,
Token::PlusPlus() => scarf_parser::Token::PlusPlus,
Token::MinusMinus() => scarf_parser::Token::MinusMinus,
Token::PlusColon() => scarf_parser::Token::PlusColon,
Token::MinusColon() => scarf_parser::Token::MinusColon,
Token::PlusSlashMinus() => scarf_parser::Token::PlusSlashMinus,
Token::PlusPercentMinus() => scarf_parser::Token::PlusPercentMinus,
Token::Paren() => scarf_parser::Token::Paren,
Token::EParen() => scarf_parser::Token::EParen,
Token::Bracket() => scarf_parser::Token::Bracket,
Token::EBracket() => scarf_parser::Token::EBracket,
Token::Brace() => scarf_parser::Token::Brace,
Token::EBrace() => scarf_parser::Token::EBrace,
Token::Colon() => scarf_parser::Token::Colon,
Token::SColon() => scarf_parser::Token::SColon,
Token::Apost() => scarf_parser::Token::Apost,
Token::Comma() => scarf_parser::Token::Comma,
Token::Period() => scarf_parser::Token::Period,
Token::Pound() => scarf_parser::Token::Pound,
Token::Dollar() => scarf_parser::Token::Dollar,
Token::At() => scarf_parser::Token::At,
Token::AtAt() => scarf_parser::Token::AtAt,
Token::Eq() => scarf_parser::Token::Eq,
Token::ColonColon() => scarf_parser::Token::ColonColon,
Token::ColonEq() => scarf_parser::Token::ColonEq,
Token::ColonSlash() => scarf_parser::Token::ColonSlash,
Token::PoundPound() => scarf_parser::Token::PoundPound,
Token::PoundMinusPound() => scarf_parser::Token::PoundMinusPound,
Token::PoundEqPound() => scarf_parser::Token::PoundEqPound,
Token::EqGt() => scarf_parser::Token::EqGt,
Token::StarGt() => scarf_parser::Token::StarGt,
Token::PipeMinusGt() => scarf_parser::Token::PipeMinusGt,
Token::PipeEqGt() => scarf_parser::Token::PipeEqGt,
Token::Bslash() => scarf_parser::Token::Bslash,
Token::Std() => scarf_parser::Token::Std,
Token::PathpulseDollar() => scarf_parser::Token::PathpulseDollar,
Token::Option() => scarf_parser::Token::Option,
Token::TypeOption() => scarf_parser::Token::TypeOption,
Token::Randomize() => scarf_parser::Token::Randomize,
Token::Sample() => scarf_parser::Token::Sample,
Token::OneStep() => scarf_parser::Token::OneStep,
Token::DollarSetup() => scarf_parser::Token::DollarSetup,
Token::DollarHold() => scarf_parser::Token::DollarHold,
Token::DollarSetuphold() => scarf_parser::Token::DollarSetuphold,
Token::DollarRecovery() => scarf_parser::Token::DollarRecovery,
Token::DollarRemoval() => scarf_parser::Token::DollarRemoval,
Token::DollarRecrem() => scarf_parser::Token::DollarRecrem,
Token::DollarSkew() => scarf_parser::Token::DollarSkew,
Token::DollarTimeskew() => scarf_parser::Token::DollarTimeskew,
Token::DollarFullskew() => scarf_parser::Token::DollarFullskew,
Token::DollarPeriod() => scarf_parser::Token::DollarPeriod,
Token::DollarWidth() => scarf_parser::Token::DollarWidth,
Token::DollarNochange() => scarf_parser::Token::DollarNochange,
Token::DollarRoot() => scarf_parser::Token::DollarRoot,
Token::DollarUnit() => scarf_parser::Token::DollarUnit,
Token::DollarFatal() => scarf_parser::Token::DollarFatal,
Token::DollarError() => scarf_parser::Token::DollarError,
Token::DollarWarning() => scarf_parser::Token::DollarWarning,
Token::DollarInfo() => scarf_parser::Token::DollarInfo,
Token::OnelineComment { text } => {
scarf_parser::Token::OnelineComment(&text)
}
Token::BlockComment { text } => {
scarf_parser::Token::BlockComment(&text)
}
Token::UnsignedNumber { text } => {
scarf_parser::Token::UnsignedNumber(&text)
}
Token::FixedPointNumber { text } => {
scarf_parser::Token::FixedPointNumber(&text)
}
Token::BinaryNumber { text } => {
scarf_parser::Token::BinaryNumber(&text)
}
Token::OctalNumber { text } => {
scarf_parser::Token::OctalNumber(&text)
}
Token::DecimalNumber { text } => {
scarf_parser::Token::DecimalNumber(&text)
}
Token::HexNumber { text } => scarf_parser::Token::HexNumber(&text),
Token::ScientificNumber { text } => {
scarf_parser::Token::ScientificNumber(&text)
}
Token::UnbasedUnsizedLiteral { text } => {
scarf_parser::Token::UnbasedUnsizedLiteral(&text)
}
Token::SystemTfIdentifier { text } => {
scarf_parser::Token::SystemTfIdentifier(&text)
}
Token::SimpleIdentifier { text } => {
scarf_parser::Token::SimpleIdentifier(&text)
}
Token::EscapedIdentifier { text } => {
scarf_parser::Token::EscapedIdentifier(&text)
}
Token::PreprocessorIdentifier { text } => {
scarf_parser::Token::PreprocessorIdentifier(&text)
}
Token::TextMacro { text } => scarf_parser::Token::TextMacro(&text),
Token::StringLiteral { text } => {
scarf_parser::Token::StringLiteral(&text)
}
Token::PreprocessorStringLiteral { text } => {
scarf_parser::Token::PreprocessorStringLiteral(&text)
}
Token::TripleQuoteStringLiteral { text } => {
scarf_parser::Token::TripleQuoteStringLiteral(&text)
}
Token::PreprocessorTripleQuoteStringLiteral { text } => {
scarf_parser::Token::PreprocessorTripleQuoteStringLiteral(&text)
}
Token::Newline() => scarf_parser::Token::Newline,
}
}
}
#[pyclass(eq, from_py_object, module = "scarf_python", str)]
#[derive(Clone, PartialEq, Eq)]
pub struct SpannedToken {
#[pyo3(get, set)]
pub token: Token,
#[pyo3(get, set)]
pub span: Span,
}
impl<'a> From<scarf_parser::SpannedToken<'a>> for SpannedToken {
fn from(value: scarf_parser::SpannedToken<'a>) -> Self {
Self {
token: value.0.into(),
span: value.1.into(),
}
}
}
impl std::fmt::Display for SpannedToken {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.token.fmt(f)
}
}
impl<'a> SpannedToken {
pub fn to_rust(
&'a self,
cache: &'a PreprocessorCache<'a>,
) -> scarf_parser::SpannedToken<'a> {
scarf_parser::SpannedToken(
(&self.token).into(),
(&self.span).to_span(cache),
)
}
}