diff --git a/src/attributes.rs b/src/attributes.rs index 3106bfb..985f1e5 100644 --- a/src/attributes.rs +++ b/src/attributes.rs @@ -12,6 +12,7 @@ use nom::IResult; pub struct AttributeInstance<'a> { pub attr_spec: Vec>, } + #[derive(Debug)] pub struct AttrSpec<'a> { pub attr_name: Identifier<'a>, diff --git a/src/identifiers.rs b/src/identifiers.rs index d0f0c24..c1fecf6 100644 --- a/src/identifiers.rs +++ b/src/identifiers.rs @@ -1,3 +1,4 @@ +use crate::primaries::*; use crate::util::*; use nom::branch::*; use nom::bytes::complete::*; @@ -28,7 +29,7 @@ pub enum Scope<'a> { LocalScope, PackageScope(Identifier<'a>), ClassScope, - ImplicitClassHandle, + ImplicitClassHandle(ImplicitClassHandle), GenerateBlockScope(Vec>), } @@ -56,7 +57,7 @@ impl<'a> From> for HierarchicalIdentifier<'a> { #[derive(Debug)] pub struct Hierarchy<'a> { pub identifier: Identifier<'a>, - pub constant_bit_select: Option>, + pub constant_bit_select: Option>, } // ----------------------------------------------------------------------------- diff --git a/src/lib.rs b/src/lib.rs index be76c50..63db6b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,5 +3,6 @@ pub mod comments; pub mod identifiers; pub mod numbers; pub mod operators; +pub mod primaries; pub mod strings; pub mod util; diff --git a/src/numbers.rs b/src/numbers.rs index 8c48779..07ef696 100644 --- a/src/numbers.rs +++ b/src/numbers.rs @@ -280,6 +280,10 @@ pub fn z_number(s: &str) -> IResult<&str, Vec<&str>> { )(s) } +pub fn unbased_unsized_literal(s: &str) -> IResult<&str, &str> { + alt((tag("'0"), tag("'1"), tag("'z"), tag("'x")))(s) +} + // ----------------------------------------------------------------------------- #[cfg(test)] @@ -400,5 +404,9 @@ mod tests { format!("{:?}", all_consuming(number)(".2e-7")), "Err(Error((\".2e-7\", Digit)))" ); + assert_eq!( + format!("{:?}", all_consuming(unbased_unsized_literal)("'0")), + "Ok((\"\", \"\\\'0\"))" + ); } } diff --git a/src/primaries.rs b/src/primaries.rs new file mode 100644 index 0000000..a39d1ca --- /dev/null +++ b/src/primaries.rs @@ -0,0 +1,653 @@ +use crate::identifiers::*; +use crate::numbers::*; +use crate::strings::*; +use crate::util::*; +use nom::branch::*; +use nom::bytes::complete::*; +use nom::combinator::*; +use nom::multi::*; +use nom::sequence::*; +use nom::IResult; + +// ----------------------------------------------------------------------------- + +#[derive(Debug)] +pub enum ConstantPrimary<'a> { + PrimaryLiteral(PrimaryLiteral<'a>), + PsParameter(ConstantPrimaryPsParameter<'a>), + Specparam(ConstantPrimarySpecparam<'a>), + Genvar(Identifier<'a>), + FormalPort(ConstantPrimaryFormalPort<'a>), + Enum(ConstantPrimaryEnum<'a>), + Concatenation(ConstantPrimaryConcatenation<'a>), + MultipleConcatenation(ConstantPrimaryMultipleConcatenation<'a>), + FunctionCall(ConstantFunctionCall<'a>), + LetExpression(LetExpression<'a>), + MintypmaxExpression(ConstantMintypmaxExpression<'a>), + Cast(ConstantCast<'a>), + AssignmentPatternExpression(ConstantAssignmentPatternExpression<'a>), + TypeReference(TypeReference<'a>), + Null, +} + +#[derive(Debug)] +pub struct ConstantPrimaryPsParameter<'a> { + identifier: ScopedIdentifier<'a>, + select: ConstantSelect<'a>, +} + +#[derive(Debug)] +pub struct ConstantPrimarySpecparam<'a> { + identifier: Identifier<'a>, + range: Option>, +} + +#[derive(Debug)] +pub struct ConstantPrimaryFormalPort<'a> { + identifier: Identifier<'a>, + select: ConstantSelect<'a>, +} + +#[derive(Debug)] +pub struct ConstantPrimaryEnum<'a> { + scope: Scope<'a>, + identifier: Identifier<'a>, +} + +#[derive(Debug)] +pub struct ConstantPrimaryConcatenation<'a> { + concatenation: Concatenation<'a>, + range: Option>, +} + +#[derive(Debug)] +pub struct ConstantPrimaryMultipleConcatenation<'a> { + concatenation: MultipleConcatenation<'a>, + range: Option>, +} + +#[derive(Debug)] +pub enum ModulePathPrimary<'a> { + Number(Number<'a>), + Identifier(Identifier<'a>), + ModulePathConcatenation(ModulePathConcatenation<'a>), + ModulePathMultipleConcatenation(ModulePathMultipleConcatenation<'a>), + FunctionSubroutineCall(FunctionSubroutineCall<'a>), + ModulePathMintypmaxExpression(ModulePathMintypmaxExpression<'a>), +} + +#[derive(Debug)] +pub enum Primary<'a> { + PrimaryLiteral(PrimaryLiteral<'a>), + Hierarchical(PrimaryHierarchical<'a>), + EmptyUnpackedArrayConcatenation(EmptyUnpackedArrayConcatenation<'a>), + Concatenation(PrimaryConcatenation<'a>), + MultipleConcatenation(PrimaryMultipleConcatenation<'a>), + FunctionSubroutineCall(FunctionSubroutineCall<'a>), + LetExpression(LetExpression<'a>), + MintypmaxExpression(MintypmaxExpression<'a>), + Cast(Cast<'a>), + AssignmentPatternExpression(AssignmentPatternExpression<'a>), + StreamingConcatenation(StreamingConcatenation<'a>), + SequenceMethodCall(SequenceMethodCall<'a>), + This, + Dollar, + Null, +} + +#[derive(Debug)] +pub struct PrimaryHierarchical<'a> { + qualifier: Option>, + identifier: HierarchicalIdentifier<'a>, + select: Select<'a>, +} + +#[derive(Debug)] +pub struct PrimaryConcatenation<'a> { + concatenation: Concatenation<'a>, + range: Option>, +} + +#[derive(Debug)] +pub struct PrimaryMultipleConcatenation<'a> { + concatenation: MultipleConcatenation<'a>, + range: Option>, +} + +#[derive(Debug)] +pub enum PrimaryHierarchicalQualifier<'a> { + ClassQualifier(ClassQualifier<'a>), + PackageScope(Scope<'a>), +} + +#[derive(Debug)] +pub struct ClassQualifier<'a> { + local: bool, + scope: Option>, +} + +#[derive(Debug)] +pub enum RangeExpression<'a> { + Expression(Expression<'a>), + PartSelectRange(PartSelectRange<'a>), +} + +#[derive(Debug)] +pub enum PrimaryLiteral<'a> { + Number(Number<'a>), + TimeLiteral(TimeLiteral<'a>), + UnbasedUnsizedLiteral(&'a str), + StringLiteral(StringLiteral<'a>), +} + +#[derive(Debug)] +pub enum TimeLiteral<'a> { + UnsignedTimeLiteral(UnsignedTimeLiteral<'a>), + FixedPointTimeLiteral(FixedPointTimeLiteral<'a>), +} + +#[derive(Debug)] +pub enum TimeUnit { + S, + MS, + US, + NS, + PS, + FS, +} + +#[derive(Debug)] +pub enum ImplicitClassHandle { + This, + Super, + ThisSuper, +} + +#[derive(Debug)] +pub struct UnsignedTimeLiteral<'a> { + number: Vec<&'a str>, + unit: TimeUnit, +} + +#[derive(Debug)] +pub struct FixedPointTimeLiteral<'a> { + number: RealNumber<'a>, + unit: TimeUnit, +} + +#[derive(Debug)] +pub struct Select<'a> { + member: Option>, + bit_select: Expression<'a>, + part_select_range: Option>, +} + +#[derive(Debug)] +pub struct ConstantSelect<'a> { + member: Option>, + bit_select: ConstantExpression<'a>, + part_select_range: Option>, +} + +#[derive(Debug)] +pub struct SelectMember<'a> { + upper: Vec<(Identifier<'a>, Expression<'a>)>, + identifier: Identifier<'a>, +} + +#[derive(Debug)] +pub struct Cast<'a> { + r#type: CastingType<'a>, + expression: Expression<'a>, +} + +#[derive(Debug)] +pub struct ConstantCast<'a> { + r#type: CastingType<'a>, + expression: ConstantExpression<'a>, +} + +// ----------------------------------------------------------------------------- + +pub fn constant_primary(s: &str) -> IResult<&str, ConstantPrimary> { + alt(( + map(tag("null"), |_| ConstantPrimary::Null), + map(primary_literal, |x| ConstantPrimary::PrimaryLiteral(x)), + constant_primary_ps_parameter, + constant_primary_specparam, + map(genvar_identifier, |x| ConstantPrimary::Genvar(x)), + constant_primary_formal_port, + constant_primary_enum, + constant_primary_concatenation, + constant_primary_multiple_concatenation, + map(constant_function_call, |x| ConstantPrimary::FunctionCall(x)), + map(constant_let_expression, |x| { + ConstantPrimary::LetExpression(x) + }), + map(constant_cast, |x| ConstantPrimary::Cast(x)), + map(constant_assignment_pattern_expression, |x| { + ConstantPrimary::AssignmentPatternExpression(x) + }), + map(type_reference, |x| ConstantPrimary::TypeReference(x)), + ))(s) +} + +pub fn constant_primary_ps_parameter(s: &str) -> IResult<&str, ConstantPrimary> { + let (s, identifier) = ps_parameter_identifier(s)?; + let (s, select) = sp(constant_select)(s)?; + Ok(( + s, + ConstantPrimary::PsParameter(ConstantPrimaryPsParameter { identifier, select }), + )) +} + +pub fn constant_primary_specparam(s: &str) -> IResult<&str, ConstantPrimary> { + let (s, identifier) = specparam_identifier(s)?; + let (s, range) = opt(delimited( + sp(tag("[")), + sp(constant_range_expression), + sp(tag("]")), + ))(s)?; + Ok(( + s, + ConstantPrimary::Specparam(ConstantPrimarySpecparam { identifier, range }), + )) +} + +pub fn constant_primary_formal_port(s: &str) -> IResult<&str, ConstantPrimary> { + let (s, identifier) = formal_port_identifier(s)?; + let (s, select) = sp(constant_select)(s)?; + Ok(( + s, + ConstantPrimary::FormalPort(ConstantPrimaryFormalPort { identifier, select }), + )) +} + +pub fn constant_primary_enum(s: &str) -> IResult<&str, ConstantPrimary> { + let (s, scope) = alt((package_scope, class_scope))(s)?; + let (s, identifier) = sp(enum_identifier)(s)?; + Ok(( + s, + ConstantPrimary::Enum(ConstantPrimaryEnum { scope, identifier }), + )) +} + +pub fn constant_primary_concatenation(s: &str) -> IResult<&str, ConstantPrimary> { + let (s, concatenation) = constant_concatenation(s)?; + let (s, range) = opt(delimited( + sp(tag("[")), + sp(constant_range_expression), + sp(tag("]")), + ))(s)?; + Ok(( + s, + ConstantPrimary::Concatenation(ConstantPrimaryConcatenation { + concatenation, + range, + }), + )) +} + +pub fn constant_primary_multiple_concatenation(s: &str) -> IResult<&str, ConstantPrimary> { + let (s, concatenation) = constant_multiple_concatenation(s)?; + let (s, range) = opt(delimited( + sp(tag("[")), + sp(constant_range_expression), + sp(tag("]")), + ))(s)?; + Ok(( + s, + ConstantPrimary::MultipleConcatenation(ConstantPrimaryMultipleConcatenation { + concatenation, + range, + }), + )) +} + +pub fn constant_primary_mintypmax_expression(s: &str) -> IResult<&str, ConstantPrimary> { + let (s, x) = delimited(tag("("), sp(constant_mintypmax_expression), sp(tag(")")))(s)?; + Ok((s, ConstantPrimary::MintypmaxExpression(x))) +} + +pub fn module_path_primary(s: &str) -> IResult<&str, ModulePathPrimary> { + alt(( + map(number, |x| ModulePathPrimary::Number(x)), + map(identifier, |x| ModulePathPrimary::Identifier(x)), + map(module_path_concatenation, |x| { + ModulePathPrimary::ModulePathConcatenation(x) + }), + map(module_path_multiple_concatenation, |x| { + ModulePathPrimary::ModulePathMultipleConcatenation(x) + }), + map(function_subroutine_call, |x| { + ModulePathPrimary::FunctionSubroutineCall(x) + }), + map( + delimited(tag("("), sp(module_path_mintypmax_expression), sp(tag(")"))), + |x| ModulePathPrimary::ModulePathMintypmaxExpression(x), + ), + ))(s) +} + +pub fn primary(s: &str) -> IResult<&str, Primary> { + alt(( + map(tag("this"), |_| Primary::This), + map(tag("$"), |_| Primary::Dollar), + map(tag("null"), |_| Primary::Null), + map(primary_literal, |x| Primary::PrimaryLiteral(x)), + primary_hierarchical, + map(empty_unpacked_array_concatenation, |x| { + Primary::EmptyUnpackedArrayConcatenation(x) + }), + primary_concatenation, + map(function_subroutine_call, |x| { + Primary::FunctionSubroutineCall(x) + }), + map(let_expression, |x| Primary::LetExpression(x)), + map( + delimited(tag("("), sp(mintypmax_expression), sp(tag(")"))), + |x| Primary::MintypmaxExpression(x), + ), + map(cast, |x| Primary::Cast(x)), + map(assignment_pattern_expression, |x| { + Primary::AssignmentPatternExpression(x) + }), + map(streaming_concatenation, |x| { + Primary::StreamingConcatenation(x) + }), + map(sequence_method_call, |x| Primary::SequenceMethodCall(x)), + ))(s) +} + +pub fn primary_hierarchical(s: &str) -> IResult<&str, Primary> { + let (s, qualifier) = opt(primary_hierarchical_qualifier)(s)?; + let (s, identifier) = sp(hierarchical_identifier)(s)?; + let (s, select) = sp(select)(s)?; + Ok(( + s, + Primary::Hierarchical(PrimaryHierarchical { + qualifier, + identifier, + select, + }), + )) +} + +pub fn primary_concatenation(s: &str) -> IResult<&str, Primary> { + let (s, concatenation) = concatenation(s)?; + let (s, range) = opt(sp(range_expression))(s)?; + Ok(( + s, + Primary::Concatenation(PrimaryConcatenation { + concatenation, + range, + }), + )) +} + +pub fn primary_multiple_concatenation(s: &str) -> IResult<&str, Primary> { + let (s, concatenation) = multiple_concatenation(s)?; + let (s, range) = opt(sp(range_expression))(s)?; + Ok(( + s, + Primary::MultipleConcatenation(PrimaryMultipleConcatenation { + concatenation, + range, + }), + )) +} + +pub fn primary_hierarchical_qualifier(s: &str) -> IResult<&str, PrimaryHierarchicalQualifier> { + alt(( + map(class_qualifier, |x| { + PrimaryHierarchicalQualifier::ClassQualifier(x) + }), + map(package_scope, |x| { + PrimaryHierarchicalQualifier::PackageScope(x) + }), + ))(s) +} + +pub fn class_qualifier(s: &str) -> IResult<&str, ClassQualifier> { + let (s, local) = opt(tag("local::"))(s)?; + let (s, scope) = opt(alt(( + terminated(implicit_class_handle, sp(tag("."))), + class_scope, + )))(s)?; + Ok(( + s, + ClassQualifier { + local: local.is_some(), + scope, + }, + )) +} + +pub fn range_expression(s: &str) -> IResult<&str, RangeExpression> { + alt(( + map(expression, |x| RangeExpression::Expression(x)), + map(part_select_range, |x| RangeExpression::PartSelectRange(x)), + ))(s) +} + +pub fn primary_literal(s: &str) -> IResult<&str, PrimaryLiteral> { + alt(( + map(time_literal, |x| PrimaryLiteral::TimeLiteral(x)), + map(number, |x| PrimaryLiteral::Number(x)), + map(unbased_unsized_literal, |x| { + PrimaryLiteral::UnbasedUnsizedLiteral(x) + }), + map(string_literal, |x| PrimaryLiteral::StringLiteral(x)), + ))(s) +} + +pub fn time_literal(s: &str) -> IResult<&str, TimeLiteral> { + alt((unsigned_time_literal, fixed_point_time_literal))(s) +} + +pub fn unsigned_time_literal(s: &str) -> IResult<&str, TimeLiteral> { + let (s, number) = unsigned_number(s)?; + let (s, unit) = sp(time_unit)(s)?; + Ok(( + s, + TimeLiteral::UnsignedTimeLiteral(UnsignedTimeLiteral { number, unit }), + )) +} + +pub fn fixed_point_time_literal(s: &str) -> IResult<&str, TimeLiteral> { + let (s, number) = fixed_point_number(s)?; + let (s, unit) = sp(time_unit)(s)?; + Ok(( + s, + TimeLiteral::FixedPointTimeLiteral(FixedPointTimeLiteral { number, unit }), + )) +} + +pub fn time_unit(s: &str) -> IResult<&str, TimeUnit> { + let (s, x) = alt(( + tag("s"), + tag("ms"), + tag("us"), + tag("ns"), + tag("ps"), + tag("fs"), + ))(s)?; + let unit = match x { + "s" => TimeUnit::S, + "ms" => TimeUnit::MS, + "us" => TimeUnit::US, + "ns" => TimeUnit::NS, + "ps" => TimeUnit::PS, + "fs" => TimeUnit::FS, + _ => unreachable!(), + }; + Ok((s, unit)) +} + +pub fn implicit_class_handle(s: &str) -> IResult<&str, Scope> { + let (s, x) = alt(( + map(tag("this"), |_| ImplicitClassHandle::This), + map(tag("super"), |_| ImplicitClassHandle::Super), + map(tuple((tag("this"), sp(tag(".")), sp(tag("super")))), |_| { + ImplicitClassHandle::ThisSuper + }), + ))(s)?; + Ok((s, Scope::ImplicitClassHandle(x))) +} + +pub fn bit_select(s: &str) -> IResult<&str, Expression> { + delimited(tag("["), sp(expression), sp(tag("]")))(s) +} + +pub fn select(s: &str) -> IResult<&str, Select> { + let (s, member) = opt(pair( + many0(preceded( + sp(tag(".")), + pair(sp(member_identifier), sp(bit_select)), + )), + preceded(sp(tag(".")), sp(member_identifier)), + ))(s)?; + let (s, bit_select) = sp(bit_select)(s)?; + let (s, part_select_range) = opt(sp(part_select_range))(s)?; + + let member = if let Some((upper, identifier)) = member { + Some(SelectMember { upper, identifier }) + } else { + None + }; + + Ok(( + s, + Select { + member, + bit_select, + part_select_range, + }, + )) +} + +pub fn norange_select(s: &str) -> IResult<&str, Select> { + let (s, member) = opt(pair( + many0(preceded( + sp(tag(".")), + pair(sp(member_identifier), sp(bit_select)), + )), + preceded(sp(tag(".")), sp(member_identifier)), + ))(s)?; + let (s, bit_select) = sp(bit_select)(s)?; + + let member = if let Some((upper, identifier)) = member { + Some(SelectMember { upper, identifier }) + } else { + None + }; + + Ok(( + s, + Select { + member, + bit_select, + part_select_range: None, + }, + )) +} + +pub fn constant_bit_select(s: &str) -> IResult<&str, ConstantExpression> { + delimited(tag("["), sp(constant_expression), sp(tag("]")))(s) +} + +pub fn constant_select(s: &str) -> IResult<&str, ConstantSelect> { + let (s, member) = opt(pair( + many0(preceded( + sp(tag(".")), + pair(sp(member_identifier), sp(bit_select)), + )), + preceded(sp(tag(".")), sp(member_identifier)), + ))(s)?; + let (s, bit_select) = sp(constant_bit_select)(s)?; + let (s, part_select_range) = opt(sp(constant_part_select_range))(s)?; + + let member = if let Some((upper, identifier)) = member { + Some(SelectMember { upper, identifier }) + } else { + None + }; + + Ok(( + s, + ConstantSelect { + member, + bit_select, + part_select_range, + }, + )) +} + +pub fn constant_cast(s: &str) -> IResult<&str, ConstantCast> { + let (s, r#type) = casting_type(s)?; + let (s, _) = sp(tag("'"))(s)?; + let (s, expression) = delimited(sp(tag("(")), sp(constant_expression), sp(tag(")")))(s)?; + Ok((s, ConstantCast { r#type, expression })) +} + +pub fn constant_let_expression(s: &str) -> IResult<&str, LetExpression> { + let_expression(s) +} + +pub fn cast(s: &str) -> IResult<&str, Cast> { + let (s, r#type) = casting_type(s)?; + let (s, _) = sp(tag("'"))(s)?; + let (s, expression) = delimited(sp(tag("(")), sp(expression), sp(tag(")")))(s)?; + Ok((s, Cast { r#type, expression })) +} + +// ----------------------------------------------------------------------------- + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test() { + assert_eq!( + format!("{:?}", all_consuming(primary)("2.1ns")), + "Ok((\"\", PrimaryLiteral(TimeLiteral(FixedPointTimeLiteral(FixedPointTimeLiteral { number: FixedPointNumber(FixedPointNumber { integer_value: [\"2\"], fraction_value: [\"1\"] }), unit: NS })))))" + ); + assert_eq!( + format!("{:?}", all_consuming(primary)("40 ps")), + "Ok((\"\", PrimaryLiteral(TimeLiteral(UnsignedTimeLiteral(UnsignedTimeLiteral { number: [\"40\"], unit: PS })))))" + ); + assert_eq!( + format!("{:?}", all_consuming(primary)("'0")), + "Ok((\"\", PrimaryLiteral(UnbasedUnsizedLiteral(\"\\\'0\"))))" + ); + assert_eq!( + format!("{:?}", all_consuming(primary)("10")), + "Ok((\"\", PrimaryLiteral(Number(IntegralNumber(UnsignedNumber([\"10\"]))))))" + ); + assert_eq!( + format!("{:?}", all_consuming(primary)("\"aaa\"")), + "Ok((\"\", PrimaryLiteral(StringLiteral(StringLiteral { raw: [\"aaa\"] }))))" + ); + assert_eq!( + format!("{:?}", all_consuming(primary)("this")), + "Ok((\"\", This))" + ); + assert_eq!( + format!("{:?}", all_consuming(primary)("$")), + "Ok((\"\", Dollar))" + ); + assert_eq!( + format!("{:?}", all_consuming(primary)("null")), + "Ok((\"\", Null))" + ); + assert_eq!( + format!("{:?}", all_consuming(module_path_primary)("10")), + "Ok((\"\", Number(IntegralNumber(UnsignedNumber([\"10\"])))))" + ); + assert_eq!( + format!("{:?}", all_consuming(constant_primary)("null")), + "Ok((\"\", Null))" + ); + } +} diff --git a/src/util.rs b/src/util.rs index 9973565..8f04abd 100644 --- a/src/util.rs +++ b/src/util.rs @@ -17,28 +17,227 @@ where // ----------------------------------------------------------------------------- -#[derive(Debug)] -pub struct ConstantBitSelect<'a> { - pub raw: Vec<&'a str>, -} - #[derive(Debug)] pub struct ConstantExpression<'a> { pub raw: Vec<&'a str>, } -pub fn implicit_class_handle(s: &str) -> IResult<&str, Scope> { - Ok((s, Scope::ImplicitClassHandle)) +#[derive(Debug)] +pub struct ConstantRangeExpression<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct Concatenation<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct MultipleConcatenation<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct ConstantFunctionCall<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct ConstantLetExpression<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct ConstantMintypmaxExpression<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct Expression<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct CastingType<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct LetExpression<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct ConstantAssignmentPatternExpression<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct TypeReference<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct ModulePathConcatenation<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct ModulePathMultipleConcatenation<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct FunctionSubroutineCall<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct ModulePathMintypmaxExpression<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct PartSelectRange<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct ConstantPartSelectRange<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct EmptyUnpackedArrayConcatenation<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct MintypmaxExpression<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct AssignmentPatternExpression<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct StreamingConcatenation<'a> { + pub raw: Vec<&'a str>, +} + +#[derive(Debug)] +pub struct SequenceMethodCall<'a> { + pub raw: Vec<&'a str>, } pub fn class_scope(s: &str) -> IResult<&str, Scope> { Ok((s, Scope::ClassScope)) } -pub fn constant_bit_select(s: &str) -> IResult<&str, ConstantBitSelect> { - Ok((s, ConstantBitSelect { raw: vec![] })) -} - pub fn constant_expression(s: &str) -> IResult<&str, ConstantExpression> { Ok((s, ConstantExpression { raw: vec![] })) } + +pub fn constant_range_expression(s: &str) -> IResult<&str, ConstantRangeExpression> { + Ok((s, ConstantRangeExpression { raw: vec![] })) +} + +pub fn constant_concatenation(s: &str) -> IResult<&str, Concatenation> { + Ok((s, Concatenation { raw: vec![] })) +} + +pub fn constant_multiple_concatenation(s: &str) -> IResult<&str, MultipleConcatenation> { + Ok((s, MultipleConcatenation { raw: vec![] })) +} + +pub fn constant_function_call(s: &str) -> IResult<&str, ConstantFunctionCall> { + Ok((s, ConstantFunctionCall { raw: vec![] })) +} + +pub fn constant_let_expression(s: &str) -> IResult<&str, ConstantLetExpression> { + Ok((s, ConstantLetExpression { raw: vec![] })) +} + +pub fn constant_mintypmax_expression(s: &str) -> IResult<&str, ConstantMintypmaxExpression> { + Ok((s, ConstantMintypmaxExpression { raw: vec![] })) +} + +pub fn expression(s: &str) -> IResult<&str, Expression> { + Ok((s, Expression { raw: vec![] })) +} + +pub fn casting_type(s: &str) -> IResult<&str, CastingType> { + Ok((s, CastingType { raw: vec![] })) +} + +pub fn let_expression(s: &str) -> IResult<&str, LetExpression> { + Ok((s, LetExpression { raw: vec![] })) +} + +pub fn constant_assignment_pattern_expression( + s: &str, +) -> IResult<&str, ConstantAssignmentPatternExpression> { + Ok((s, ConstantAssignmentPatternExpression { raw: vec![] })) +} + +pub fn type_reference(s: &str) -> IResult<&str, TypeReference> { + Ok((s, TypeReference { raw: vec![] })) +} + +pub fn module_path_concatenation(s: &str) -> IResult<&str, ModulePathConcatenation> { + Ok((s, ModulePathConcatenation { raw: vec![] })) +} + +pub fn module_path_multiple_concatenation( + s: &str, +) -> IResult<&str, ModulePathMultipleConcatenation> { + Ok((s, ModulePathMultipleConcatenation { raw: vec![] })) +} + +pub fn function_subroutine_call(s: &str) -> IResult<&str, FunctionSubroutineCall> { + Ok((s, FunctionSubroutineCall { raw: vec![] })) +} + +pub fn module_path_mintypmax_expression(s: &str) -> IResult<&str, ModulePathMintypmaxExpression> { + Ok((s, ModulePathMintypmaxExpression { raw: vec![] })) +} + +pub fn part_select_range(s: &str) -> IResult<&str, PartSelectRange> { + Ok((s, PartSelectRange { raw: vec![] })) +} + +pub fn constant_part_select_range(s: &str) -> IResult<&str, ConstantPartSelectRange> { + Ok((s, ConstantPartSelectRange { raw: vec![] })) +} + +pub fn empty_unpacked_array_concatenation( + s: &str, +) -> IResult<&str, EmptyUnpackedArrayConcatenation> { + Ok((s, EmptyUnpackedArrayConcatenation { raw: vec![] })) +} + +pub fn concatenation(s: &str) -> IResult<&str, Concatenation> { + Ok((s, Concatenation { raw: vec![] })) +} + +pub fn multiple_concatenation(s: &str) -> IResult<&str, MultipleConcatenation> { + Ok((s, MultipleConcatenation { raw: vec![] })) +} + +pub fn mintypmax_expression(s: &str) -> IResult<&str, MintypmaxExpression> { + Ok((s, MintypmaxExpression { raw: vec![] })) +} + +pub fn assignment_pattern_expression(s: &str) -> IResult<&str, AssignmentPatternExpression> { + Ok((s, AssignmentPatternExpression { raw: vec![] })) +} + +pub fn streaming_concatenation(s: &str) -> IResult<&str, StreamingConcatenation> { + Ok((s, StreamingConcatenation { raw: vec![] })) +} + +pub fn sequence_method_call(s: &str) -> IResult<&str, SequenceMethodCall> { + Ok((s, SequenceMethodCall { raw: vec![] })) +}