Add ambiguous_alt / keyword
This commit is contained in:
parent
4a2cc5416c
commit
d25b5ad733
@ -76,8 +76,3 @@ A parser library for System Verilog.
|
|||||||
| general | attributes | x | x | x |
|
| general | attributes | x | x | x |
|
||||||
| general | comments | x | x | x |
|
| general | comments | x | x | x |
|
||||||
| general | identifiers | x | x | x |
|
| general | identifiers | x | x | x |
|
||||||
|
|
||||||
## TODO
|
|
||||||
|
|
||||||
* Exclude reserved keyword from identifiers.
|
|
||||||
* Implement ambiguous_alt for varirble_port_type.
|
|
||||||
|
@ -164,7 +164,7 @@ pub fn simple_immediate_assertion_statement(
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn simple_immediate_assert_statement(s: Span) -> IResult<Span, SimpleImmediateAssertStatement> {
|
pub fn simple_immediate_assert_statement(s: Span) -> IResult<Span, SimpleImmediateAssertStatement> {
|
||||||
let (s, a) = symbol("assert")(s)?;
|
let (s, a) = keyword("assert")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = action_block(s)?;
|
let (s, c) = action_block(s)?;
|
||||||
Ok((s, SimpleImmediateAssertStatement { nodes: (a, b, c) }))
|
Ok((s, SimpleImmediateAssertStatement { nodes: (a, b, c) }))
|
||||||
@ -172,7 +172,7 @@ pub fn simple_immediate_assert_statement(s: Span) -> IResult<Span, SimpleImmedia
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn simple_immediate_assume_statement(s: Span) -> IResult<Span, SimpleImmediateAssumeStatement> {
|
pub fn simple_immediate_assume_statement(s: Span) -> IResult<Span, SimpleImmediateAssumeStatement> {
|
||||||
let (s, a) = symbol("assume")(s)?;
|
let (s, a) = keyword("assume")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = action_block(s)?;
|
let (s, c) = action_block(s)?;
|
||||||
Ok((s, SimpleImmediateAssumeStatement { nodes: (a, b, c) }))
|
Ok((s, SimpleImmediateAssumeStatement { nodes: (a, b, c) }))
|
||||||
@ -180,7 +180,7 @@ pub fn simple_immediate_assume_statement(s: Span) -> IResult<Span, SimpleImmedia
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn simple_immediate_cover_statement(s: Span) -> IResult<Span, SimpleImmediateCoverStatement> {
|
pub fn simple_immediate_cover_statement(s: Span) -> IResult<Span, SimpleImmediateCoverStatement> {
|
||||||
let (s, a) = symbol("cover")(s)?;
|
let (s, a) = keyword("cover")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = statement_or_null(s)?;
|
let (s, c) = statement_or_null(s)?;
|
||||||
Ok((s, SimpleImmediateCoverStatement { nodes: (a, b, c) }))
|
Ok((s, SimpleImmediateCoverStatement { nodes: (a, b, c) }))
|
||||||
@ -207,7 +207,7 @@ pub fn deferred_immediate_assertion_statement(
|
|||||||
pub fn deferred_immediate_assert_statement(
|
pub fn deferred_immediate_assert_statement(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, DeferredImmediateAssertStatement> {
|
) -> IResult<Span, DeferredImmediateAssertStatement> {
|
||||||
let (s, a) = symbol("assert")(s)?;
|
let (s, a) = keyword("assert")(s)?;
|
||||||
let (s, b) = assert_timing(s)?;
|
let (s, b) = assert_timing(s)?;
|
||||||
let (s, c) = paren(expression)(s)?;
|
let (s, c) = paren(expression)(s)?;
|
||||||
let (s, d) = action_block(s)?;
|
let (s, d) = action_block(s)?;
|
||||||
@ -223,7 +223,7 @@ pub fn deferred_immediate_assert_statement(
|
|||||||
pub fn deferred_immediate_assume_statement(
|
pub fn deferred_immediate_assume_statement(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, DeferredImmediateAssumeStatement> {
|
) -> IResult<Span, DeferredImmediateAssumeStatement> {
|
||||||
let (s, a) = symbol("assume")(s)?;
|
let (s, a) = keyword("assume")(s)?;
|
||||||
let (s, b) = assert_timing(s)?;
|
let (s, b) = assert_timing(s)?;
|
||||||
let (s, c) = paren(expression)(s)?;
|
let (s, c) = paren(expression)(s)?;
|
||||||
let (s, d) = action_block(s)?;
|
let (s, d) = action_block(s)?;
|
||||||
@ -239,7 +239,7 @@ pub fn deferred_immediate_assume_statement(
|
|||||||
pub fn deferred_immediate_cover_statement(
|
pub fn deferred_immediate_cover_statement(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, DeferredImmediateCoverStatement> {
|
) -> IResult<Span, DeferredImmediateCoverStatement> {
|
||||||
let (s, a) = symbol("cover")(s)?;
|
let (s, a) = keyword("cover")(s)?;
|
||||||
let (s, b) = assert_timing(s)?;
|
let (s, b) = assert_timing(s)?;
|
||||||
let (s, c) = paren(expression)(s)?;
|
let (s, c) = paren(expression)(s)?;
|
||||||
let (s, d) = statement_or_null(s)?;
|
let (s, d) = statement_or_null(s)?;
|
||||||
@ -255,7 +255,7 @@ pub fn deferred_immediate_cover_statement(
|
|||||||
pub fn assert_timing(s: Span) -> IResult<Span, AssertTiming> {
|
pub fn assert_timing(s: Span) -> IResult<Span, AssertTiming> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("#0"), |x| AssertTiming::Zero(x)),
|
map(symbol("#0"), |x| AssertTiming::Zero(x)),
|
||||||
map(symbol("final"), |x| AssertTiming::Final(x)),
|
map(keyword("final"), |x| AssertTiming::Final(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ pub fn case_statement_normal(s: Span) -> IResult<Span, CaseStatement> {
|
|||||||
let (s, c) = paren(case_expression)(s)?;
|
let (s, c) = paren(case_expression)(s)?;
|
||||||
let (s, d) = case_item(s)?;
|
let (s, d) = case_item(s)?;
|
||||||
let (s, e) = many0(case_item)(s)?;
|
let (s, e) = many0(case_item)(s)?;
|
||||||
let (s, f) = symbol("endcase")(s)?;
|
let (s, f) = keyword("endcase")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
CaseStatement::Normal(CaseStatementNormal {
|
CaseStatement::Normal(CaseStatementNormal {
|
||||||
@ -174,10 +174,10 @@ pub fn case_statement_matches(s: Span) -> IResult<Span, CaseStatement> {
|
|||||||
let (s, a) = opt(unique_priority)(s)?;
|
let (s, a) = opt(unique_priority)(s)?;
|
||||||
let (s, b) = case_keyword(s)?;
|
let (s, b) = case_keyword(s)?;
|
||||||
let (s, c) = paren(case_expression)(s)?;
|
let (s, c) = paren(case_expression)(s)?;
|
||||||
let (s, d) = symbol("matches")(s)?;
|
let (s, d) = keyword("matches")(s)?;
|
||||||
let (s, e) = case_pattern_item(s)?;
|
let (s, e) = case_pattern_item(s)?;
|
||||||
let (s, f) = many0(case_pattern_item)(s)?;
|
let (s, f) = many0(case_pattern_item)(s)?;
|
||||||
let (s, g) = symbol("endcase")(s)?;
|
let (s, g) = keyword("endcase")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
CaseStatement::Matches(CaseStatementMatches {
|
CaseStatement::Matches(CaseStatementMatches {
|
||||||
@ -189,12 +189,12 @@ pub fn case_statement_matches(s: Span) -> IResult<Span, CaseStatement> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn case_statement_inside(s: Span) -> IResult<Span, CaseStatement> {
|
pub fn case_statement_inside(s: Span) -> IResult<Span, CaseStatement> {
|
||||||
let (s, a) = opt(unique_priority)(s)?;
|
let (s, a) = opt(unique_priority)(s)?;
|
||||||
let (s, b) = symbol("case")(s)?;
|
let (s, b) = keyword("case")(s)?;
|
||||||
let (s, c) = paren(case_expression)(s)?;
|
let (s, c) = paren(case_expression)(s)?;
|
||||||
let (s, d) = symbol("inside")(s)?;
|
let (s, d) = keyword("inside")(s)?;
|
||||||
let (s, e) = case_inside_item(s)?;
|
let (s, e) = case_inside_item(s)?;
|
||||||
let (s, f) = many0(case_inside_item)(s)?;
|
let (s, f) = many0(case_inside_item)(s)?;
|
||||||
let (s, g) = symbol("endcase")(s)?;
|
let (s, g) = keyword("endcase")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
CaseStatement::Inside(CaseStatementInside {
|
CaseStatement::Inside(CaseStatementInside {
|
||||||
@ -206,9 +206,9 @@ pub fn case_statement_inside(s: Span) -> IResult<Span, CaseStatement> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn case_keyword(s: Span) -> IResult<Span, CaseKeyword> {
|
pub fn case_keyword(s: Span) -> IResult<Span, CaseKeyword> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("casez"), |x| CaseKeyword::Casez(x)),
|
map(keyword("casez"), |x| CaseKeyword::Casez(x)),
|
||||||
map(symbol("casex"), |x| CaseKeyword::Casex(x)),
|
map(keyword("casex"), |x| CaseKeyword::Casex(x)),
|
||||||
map(symbol("case"), |x| CaseKeyword::Case(x)),
|
map(keyword("case"), |x| CaseKeyword::Case(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ pub fn case_item_nondefault(s: Span) -> IResult<Span, CaseItem> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn case_item_default(s: Span) -> IResult<Span, CaseItemDefault> {
|
pub fn case_item_default(s: Span) -> IResult<Span, CaseItemDefault> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
let (s, b) = opt(symbol(":"))(s)?;
|
let (s, b) = opt(symbol(":"))(s)?;
|
||||||
let (s, c) = statement_or_null(s)?;
|
let (s, c) = statement_or_null(s)?;
|
||||||
Ok((s, CaseItemDefault { nodes: (a, b, c) }))
|
Ok((s, CaseItemDefault { nodes: (a, b, c) }))
|
||||||
@ -294,10 +294,10 @@ pub fn case_item_expression(s: Span) -> IResult<Span, CaseItemExpression> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn randcase_statement(s: Span) -> IResult<Span, RandcaseStatement> {
|
pub fn randcase_statement(s: Span) -> IResult<Span, RandcaseStatement> {
|
||||||
let (s, a) = symbol("randcase")(s)?;
|
let (s, a) = keyword("randcase")(s)?;
|
||||||
let (s, b) = randcase_item(s)?;
|
let (s, b) = randcase_item(s)?;
|
||||||
let (s, c) = many0(randcase_item)(s)?;
|
let (s, c) = many0(randcase_item)(s)?;
|
||||||
let (s, d) = symbol("endcase")(s)?;
|
let (s, d) = keyword("endcase")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
RandcaseStatement {
|
RandcaseStatement {
|
||||||
|
@ -210,12 +210,12 @@ pub fn clocking_declaration(s: Span) -> IResult<Span, ClockingDeclaration> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn clocking_declaration_local(s: Span) -> IResult<Span, ClockingDeclaration> {
|
pub fn clocking_declaration_local(s: Span) -> IResult<Span, ClockingDeclaration> {
|
||||||
let (s, a) = opt(default)(s)?;
|
let (s, a) = opt(default)(s)?;
|
||||||
let (s, b) = symbol("clocking")(s)?;
|
let (s, b) = keyword("clocking")(s)?;
|
||||||
let (s, c) = opt(clocking_identifier)(s)?;
|
let (s, c) = opt(clocking_identifier)(s)?;
|
||||||
let (s, d) = clocking_event(s)?;
|
let (s, d) = clocking_event(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
let (s, f) = many0(clocking_item)(s)?;
|
let (s, f) = many0(clocking_item)(s)?;
|
||||||
let (s, g) = symbol("endclocking")(s)?;
|
let (s, g) = keyword("endclocking")(s)?;
|
||||||
let (s, h) = opt(pair(symbol(":"), clocking_identifier))(s)?;
|
let (s, h) = opt(pair(symbol(":"), clocking_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -227,18 +227,18 @@ pub fn clocking_declaration_local(s: Span) -> IResult<Span, ClockingDeclaration>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn default(s: Span) -> IResult<Span, Default> {
|
pub fn default(s: Span) -> IResult<Span, Default> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
Ok((s, Default { nodes: (a,) }))
|
Ok((s, Default { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn clocking_declaration_global(s: Span) -> IResult<Span, ClockingDeclaration> {
|
pub fn clocking_declaration_global(s: Span) -> IResult<Span, ClockingDeclaration> {
|
||||||
let (s, a) = symbol("global")(s)?;
|
let (s, a) = keyword("global")(s)?;
|
||||||
let (s, b) = symbol("clocking")(s)?;
|
let (s, b) = keyword("clocking")(s)?;
|
||||||
let (s, c) = opt(clocking_identifier)(s)?;
|
let (s, c) = opt(clocking_identifier)(s)?;
|
||||||
let (s, d) = clocking_event(s)?;
|
let (s, d) = clocking_event(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
let (s, f) = symbol("endclocking")(s)?;
|
let (s, f) = keyword("endclocking")(s)?;
|
||||||
let (s, g) = opt(pair(symbol(":"), clocking_identifier))(s)?;
|
let (s, g) = opt(pair(symbol(":"), clocking_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -284,7 +284,7 @@ pub fn clocking_item(s: Span) -> IResult<Span, ClockingItem> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn clocking_item_default(s: Span) -> IResult<Span, ClockingItem> {
|
pub fn clocking_item_default(s: Span) -> IResult<Span, ClockingItem> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
let (s, b) = default_skew(s)?;
|
let (s, b) = default_skew(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -325,23 +325,23 @@ pub fn default_skew(s: Span) -> IResult<Span, DefaultSkew> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn default_skew_input(s: Span) -> IResult<Span, DefaultSkew> {
|
pub fn default_skew_input(s: Span) -> IResult<Span, DefaultSkew> {
|
||||||
let (s, a) = symbol("input")(s)?;
|
let (s, a) = keyword("input")(s)?;
|
||||||
let (s, b) = clocking_skew(s)?;
|
let (s, b) = clocking_skew(s)?;
|
||||||
Ok((s, DefaultSkew::Input(DefaultSkewInput { nodes: (a, b) })))
|
Ok((s, DefaultSkew::Input(DefaultSkewInput { nodes: (a, b) })))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn default_skew_output(s: Span) -> IResult<Span, DefaultSkew> {
|
pub fn default_skew_output(s: Span) -> IResult<Span, DefaultSkew> {
|
||||||
let (s, a) = symbol("output")(s)?;
|
let (s, a) = keyword("output")(s)?;
|
||||||
let (s, b) = clocking_skew(s)?;
|
let (s, b) = clocking_skew(s)?;
|
||||||
Ok((s, DefaultSkew::Output(DefaultSkewOutput { nodes: (a, b) })))
|
Ok((s, DefaultSkew::Output(DefaultSkewOutput { nodes: (a, b) })))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn default_skew_input_output(s: Span) -> IResult<Span, DefaultSkew> {
|
pub fn default_skew_input_output(s: Span) -> IResult<Span, DefaultSkew> {
|
||||||
let (s, a) = symbol("input")(s)?;
|
let (s, a) = keyword("input")(s)?;
|
||||||
let (s, b) = clocking_skew(s)?;
|
let (s, b) = clocking_skew(s)?;
|
||||||
let (s, c) = symbol("output")(s)?;
|
let (s, c) = keyword("output")(s)?;
|
||||||
let (s, d) = clocking_skew(s)?;
|
let (s, d) = clocking_skew(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -363,7 +363,7 @@ pub fn clocking_direction(s: Span) -> IResult<Span, ClockingDirection> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn clocking_direction_input(s: Span) -> IResult<Span, ClockingDirection> {
|
pub fn clocking_direction_input(s: Span) -> IResult<Span, ClockingDirection> {
|
||||||
let (s, a) = symbol("input")(s)?;
|
let (s, a) = keyword("input")(s)?;
|
||||||
let (s, b) = opt(clocking_skew)(s)?;
|
let (s, b) = opt(clocking_skew)(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -373,7 +373,7 @@ pub fn clocking_direction_input(s: Span) -> IResult<Span, ClockingDirection> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn clocking_direction_output(s: Span) -> IResult<Span, ClockingDirection> {
|
pub fn clocking_direction_output(s: Span) -> IResult<Span, ClockingDirection> {
|
||||||
let (s, a) = symbol("output")(s)?;
|
let (s, a) = keyword("output")(s)?;
|
||||||
let (s, b) = opt(clocking_skew)(s)?;
|
let (s, b) = opt(clocking_skew)(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -383,9 +383,9 @@ pub fn clocking_direction_output(s: Span) -> IResult<Span, ClockingDirection> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn clocking_direction_input_output(s: Span) -> IResult<Span, ClockingDirection> {
|
pub fn clocking_direction_input_output(s: Span) -> IResult<Span, ClockingDirection> {
|
||||||
let (s, a) = symbol("input")(s)?;
|
let (s, a) = keyword("input")(s)?;
|
||||||
let (s, b) = opt(clocking_skew)(s)?;
|
let (s, b) = opt(clocking_skew)(s)?;
|
||||||
let (s, c) = symbol("output")(s)?;
|
let (s, c) = keyword("output")(s)?;
|
||||||
let (s, d) = opt(clocking_skew)(s)?;
|
let (s, d) = opt(clocking_skew)(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -397,7 +397,7 @@ pub fn clocking_direction_input_output(s: Span) -> IResult<Span, ClockingDirecti
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn clocking_direction_inout(s: Span) -> IResult<Span, ClockingDirection> {
|
pub fn clocking_direction_inout(s: Span) -> IResult<Span, ClockingDirection> {
|
||||||
let (s, a) = symbol("inout")(s)?;
|
let (s, a) = keyword("inout")(s)?;
|
||||||
Ok((s, ClockingDirection::Inout(a)))
|
Ok((s, ClockingDirection::Inout(a)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,16 +53,16 @@ pub struct CondPattern<'a> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn conditional_statement(s: Span) -> IResult<Span, ConditionalStatement> {
|
pub fn conditional_statement(s: Span) -> IResult<Span, ConditionalStatement> {
|
||||||
let (s, a) = opt(unique_priority)(s)?;
|
let (s, a) = opt(unique_priority)(s)?;
|
||||||
let (s, b) = symbol("if")(s)?;
|
let (s, b) = keyword("if")(s)?;
|
||||||
let (s, c) = paren(cond_predicate)(s)?;
|
let (s, c) = paren(cond_predicate)(s)?;
|
||||||
let (s, d) = statement_or_null(s)?;
|
let (s, d) = statement_or_null(s)?;
|
||||||
let (s, e) = many0(tuple((
|
let (s, e) = many0(tuple((
|
||||||
symbol("else"),
|
keyword("else"),
|
||||||
symbol("if"),
|
keyword("if"),
|
||||||
paren(cond_predicate),
|
paren(cond_predicate),
|
||||||
statement_or_null,
|
statement_or_null,
|
||||||
)))(s)?;
|
)))(s)?;
|
||||||
let (s, f) = opt(pair(symbol("else"), statement_or_null))(s)?;
|
let (s, f) = opt(pair(keyword("else"), statement_or_null))(s)?;
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -75,9 +75,9 @@ pub fn conditional_statement(s: Span) -> IResult<Span, ConditionalStatement> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn unique_priority(s: Span) -> IResult<Span, UniquePriority> {
|
pub fn unique_priority(s: Span) -> IResult<Span, UniquePriority> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("unique0"), |x| UniquePriority::Unique0(x)),
|
map(keyword("unique0"), |x| UniquePriority::Unique0(x)),
|
||||||
map(symbol("unique"), |x| UniquePriority::Unique(x)),
|
map(keyword("unique"), |x| UniquePriority::Unique(x)),
|
||||||
map(symbol("priority"), |x| UniquePriority::Priority(x)),
|
map(keyword("priority"), |x| UniquePriority::Priority(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ pub fn expression_or_cond_pattern(s: Span) -> IResult<Span, ExpressionOrCondPatt
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn cond_pattern(s: Span) -> IResult<Span, CondPattern> {
|
pub fn cond_pattern(s: Span) -> IResult<Span, CondPattern> {
|
||||||
let (s, a) = expression(s)?;
|
let (s, a) = expression(s)?;
|
||||||
let (s, b) = symbol("matches")(s)?;
|
let (s, b) = keyword("matches")(s)?;
|
||||||
let (s, c) = pattern(s)?;
|
let (s, c) = pattern(s)?;
|
||||||
Ok((s, CondPattern { nodes: (a, b, c) }))
|
Ok((s, CondPattern { nodes: (a, b, c) }))
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ pub fn continuous_assign(s: Span) -> IResult<Span, ContinuousAssign> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn continuous_assign_net(s: Span) -> IResult<Span, ContinuousAssign> {
|
pub fn continuous_assign_net(s: Span) -> IResult<Span, ContinuousAssign> {
|
||||||
let (s, a) = symbol("assign")(s)?;
|
let (s, a) = keyword("assign")(s)?;
|
||||||
let (s, b) = opt(drive_strength)(s)?;
|
let (s, b) = opt(drive_strength)(s)?;
|
||||||
let (s, c) = opt(delay3)(s)?;
|
let (s, c) = opt(delay3)(s)?;
|
||||||
let (s, d) = list_of_net_assignments(s)?;
|
let (s, d) = list_of_net_assignments(s)?;
|
||||||
@ -84,7 +84,7 @@ pub fn continuous_assign_net(s: Span) -> IResult<Span, ContinuousAssign> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn continuous_assign_variable(s: Span) -> IResult<Span, ContinuousAssign> {
|
pub fn continuous_assign_variable(s: Span) -> IResult<Span, ContinuousAssign> {
|
||||||
let (s, a) = symbol("assign")(s)?;
|
let (s, a) = keyword("assign")(s)?;
|
||||||
let (s, b) = opt(delay_control)(s)?;
|
let (s, b) = opt(delay_control)(s)?;
|
||||||
let (s, c) = list_of_variable_assignments(s)?;
|
let (s, c) = list_of_variable_assignments(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
@ -111,7 +111,7 @@ pub fn list_of_variable_assignments(s: Span) -> IResult<Span, ListOfVariableAssi
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn net_alias(s: Span) -> IResult<Span, NetAlias> {
|
pub fn net_alias(s: Span) -> IResult<Span, NetAlias> {
|
||||||
let (s, a) = symbol("alias")(s)?;
|
let (s, a) = keyword("alias")(s)?;
|
||||||
let (s, b) = net_lvalue(s)?;
|
let (s, b) = net_lvalue(s)?;
|
||||||
let (s, c) = symbol("=")(s)?;
|
let (s, c) = symbol("=")(s)?;
|
||||||
let (s, d) = list(symbol("="), net_lvalue)(s)?;
|
let (s, d) = list(symbol("="), net_lvalue)(s)?;
|
||||||
|
@ -134,7 +134,7 @@ pub fn loop_statement(s: Span) -> IResult<Span, LoopStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn loop_statement_forever(s: Span) -> IResult<Span, LoopStatement> {
|
pub fn loop_statement_forever(s: Span) -> IResult<Span, LoopStatement> {
|
||||||
let (s, a) = symbol("forever")(s)?;
|
let (s, a) = keyword("forever")(s)?;
|
||||||
let (s, b) = statement_or_null(s)?;
|
let (s, b) = statement_or_null(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -144,7 +144,7 @@ pub fn loop_statement_forever(s: Span) -> IResult<Span, LoopStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn loop_statement_repeat(s: Span) -> IResult<Span, LoopStatement> {
|
pub fn loop_statement_repeat(s: Span) -> IResult<Span, LoopStatement> {
|
||||||
let (s, a) = symbol("repeat")(s)?;
|
let (s, a) = keyword("repeat")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = statement_or_null(s)?;
|
let (s, c) = statement_or_null(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -155,7 +155,7 @@ pub fn loop_statement_repeat(s: Span) -> IResult<Span, LoopStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn loop_statement_while(s: Span) -> IResult<Span, LoopStatement> {
|
pub fn loop_statement_while(s: Span) -> IResult<Span, LoopStatement> {
|
||||||
let (s, a) = symbol("while")(s)?;
|
let (s, a) = keyword("while")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = statement_or_null(s)?;
|
let (s, c) = statement_or_null(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -166,7 +166,7 @@ pub fn loop_statement_while(s: Span) -> IResult<Span, LoopStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn loop_statement_for(s: Span) -> IResult<Span, LoopStatement> {
|
pub fn loop_statement_for(s: Span) -> IResult<Span, LoopStatement> {
|
||||||
let (s, a) = symbol("for")(s)?;
|
let (s, a) = keyword("for")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
opt(for_initialization),
|
opt(for_initialization),
|
||||||
symbol(":"),
|
symbol(":"),
|
||||||
@ -180,9 +180,9 @@ pub fn loop_statement_for(s: Span) -> IResult<Span, LoopStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn loop_statement_do_while(s: Span) -> IResult<Span, LoopStatement> {
|
pub fn loop_statement_do_while(s: Span) -> IResult<Span, LoopStatement> {
|
||||||
let (s, a) = symbol("do")(s)?;
|
let (s, a) = keyword("do")(s)?;
|
||||||
let (s, b) = statement_or_null(s)?;
|
let (s, b) = statement_or_null(s)?;
|
||||||
let (s, c) = symbol("while")(s)?;
|
let (s, c) = keyword("while")(s)?;
|
||||||
let (s, d) = paren(expression)(s)?;
|
let (s, d) = paren(expression)(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -195,7 +195,7 @@ pub fn loop_statement_do_while(s: Span) -> IResult<Span, LoopStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn loop_statement_foreach(s: Span) -> IResult<Span, LoopStatement> {
|
pub fn loop_statement_foreach(s: Span) -> IResult<Span, LoopStatement> {
|
||||||
let (s, a) = symbol("foreach")(s)?;
|
let (s, a) = keyword("foreach")(s)?;
|
||||||
let (s, b) = paren(pair(
|
let (s, b) = paren(pair(
|
||||||
ps_or_hierarchical_array_identifier,
|
ps_or_hierarchical_array_identifier,
|
||||||
bracket(loop_variables),
|
bracket(loop_variables),
|
||||||
@ -239,7 +239,7 @@ pub fn for_variable_declaration(s: Span) -> IResult<Span, ForVariableDeclaration
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn var(s: Span) -> IResult<Span, Var> {
|
pub fn var(s: Span) -> IResult<Span, Var> {
|
||||||
let (s, a) = symbol("var")(s)?;
|
let (s, a) = keyword("var")(s)?;
|
||||||
Ok((s, Var { nodes: (a,) }))
|
Ok((s, Var { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,18 +63,18 @@ pub fn action_block(s: Span) -> IResult<Span, ActionBlock> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn action_block_else(s: Span) -> IResult<Span, ActionBlock> {
|
pub fn action_block_else(s: Span) -> IResult<Span, ActionBlock> {
|
||||||
let (s, a) = opt(statement)(s)?;
|
let (s, a) = opt(statement)(s)?;
|
||||||
let (s, b) = symbol("else")(s)?;
|
let (s, b) = keyword("else")(s)?;
|
||||||
let (s, c) = statement_or_null(s)?;
|
let (s, c) = statement_or_null(s)?;
|
||||||
Ok((s, ActionBlock::Else(ActionBlockElse { nodes: (a, b, c) })))
|
Ok((s, ActionBlock::Else(ActionBlockElse { nodes: (a, b, c) })))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn seq_block(s: Span) -> IResult<Span, SeqBlock> {
|
pub fn seq_block(s: Span) -> IResult<Span, SeqBlock> {
|
||||||
let (s, a) = symbol("begin")(s)?;
|
let (s, a) = keyword("begin")(s)?;
|
||||||
let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?;
|
let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?;
|
||||||
let (s, c) = many0(block_item_declaration)(s)?;
|
let (s, c) = many0(block_item_declaration)(s)?;
|
||||||
let (s, d) = many0(statement_or_null)(s)?;
|
let (s, d) = many0(statement_or_null)(s)?;
|
||||||
let (s, e) = symbol("end")(s)?;
|
let (s, e) = keyword("end")(s)?;
|
||||||
let (s, f) = opt(pair(symbol(":"), block_identifier))(s)?;
|
let (s, f) = opt(pair(symbol(":"), block_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -86,7 +86,7 @@ pub fn seq_block(s: Span) -> IResult<Span, SeqBlock> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn par_block(s: Span) -> IResult<Span, ParBlock> {
|
pub fn par_block(s: Span) -> IResult<Span, ParBlock> {
|
||||||
let (s, a) = symbol("fork")(s)?;
|
let (s, a) = keyword("fork")(s)?;
|
||||||
let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?;
|
let (s, b) = opt(pair(symbol(":"), block_identifier))(s)?;
|
||||||
let (s, c) = many0(block_item_declaration)(s)?;
|
let (s, c) = many0(block_item_declaration)(s)?;
|
||||||
let (s, d) = many0(statement_or_null)(s)?;
|
let (s, d) = many0(statement_or_null)(s)?;
|
||||||
@ -103,8 +103,8 @@ pub fn par_block(s: Span) -> IResult<Span, ParBlock> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn join_keyword(s: Span) -> IResult<Span, JoinKeyword> {
|
pub fn join_keyword(s: Span) -> IResult<Span, JoinKeyword> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("join_any"), |x| JoinKeyword::JoinAny(x)),
|
map(keyword("join_any"), |x| JoinKeyword::JoinAny(x)),
|
||||||
map(symbol("join_none"), |x| JoinKeyword::JoinNone(x)),
|
map(keyword("join_none"), |x| JoinKeyword::JoinNone(x)),
|
||||||
map(symbol("join"), |x| JoinKeyword::Join(x)),
|
map(keyword("join"), |x| JoinKeyword::Join(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ pub fn pattern_variable(s: Span) -> IResult<Span, Pattern> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn pattern_tagged(s: Span) -> IResult<Span, Pattern> {
|
pub fn pattern_tagged(s: Span) -> IResult<Span, Pattern> {
|
||||||
let (s, a) = symbol("tagged")(s)?;
|
let (s, a) = keyword("tagged")(s)?;
|
||||||
let (s, b) = member_identifier(s)?;
|
let (s, b) = member_identifier(s)?;
|
||||||
let (s, c) = opt(pattern)(s)?;
|
let (s, c) = opt(pattern)(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -268,7 +268,7 @@ pub fn array_pattern_key(s: Span) -> IResult<Span, ArrayPatternKey> {
|
|||||||
pub fn assignment_pattern_key(s: Span) -> IResult<Span, AssignmentPatternKey> {
|
pub fn assignment_pattern_key(s: Span) -> IResult<Span, AssignmentPatternKey> {
|
||||||
alt((
|
alt((
|
||||||
map(simple_type, |x| AssignmentPatternKey::SimpleType(x)),
|
map(simple_type, |x| AssignmentPatternKey::SimpleType(x)),
|
||||||
map(symbol("default"), |x| AssignmentPatternKey::Default(x)),
|
map(keyword("default"), |x| AssignmentPatternKey::Default(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ pub struct VariableAssignment<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn initial_construct(s: Span) -> IResult<Span, InitialConstruct> {
|
pub fn initial_construct(s: Span) -> IResult<Span, InitialConstruct> {
|
||||||
let (s, a) = symbol("initial")(s)?;
|
let (s, a) = keyword("initial")(s)?;
|
||||||
let (s, b) = statement_or_null(s)?;
|
let (s, b) = statement_or_null(s)?;
|
||||||
Ok((s, InitialConstruct { nodes: (a, b) }))
|
Ok((s, InitialConstruct { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
@ -147,16 +147,16 @@ pub fn always_construct(s: Span) -> IResult<Span, AlwaysConstruct> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn always_keyword(s: Span) -> IResult<Span, AlwaysKeyword> {
|
pub fn always_keyword(s: Span) -> IResult<Span, AlwaysKeyword> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("always_comb"), |x| AlwaysKeyword::AlwaysComb(x)),
|
map(keyword("always_comb"), |x| AlwaysKeyword::AlwaysComb(x)),
|
||||||
map(symbol("always_latch"), |x| AlwaysKeyword::AlwaysLatch(x)),
|
map(keyword("always_latch"), |x| AlwaysKeyword::AlwaysLatch(x)),
|
||||||
map(symbol("always_ff"), |x| AlwaysKeyword::AlwaysFf(x)),
|
map(keyword("always_ff"), |x| AlwaysKeyword::AlwaysFf(x)),
|
||||||
map(symbol("always"), |x| AlwaysKeyword::Always(x)),
|
map(keyword("always"), |x| AlwaysKeyword::Always(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn final_construct(s: Span) -> IResult<Span, FinalConstruct> {
|
pub fn final_construct(s: Span) -> IResult<Span, FinalConstruct> {
|
||||||
let (s, a) = symbol("final")(s)?;
|
let (s, a) = keyword("final")(s)?;
|
||||||
let (s, b) = function_statement(s)?;
|
let (s, b) = function_statement(s)?;
|
||||||
Ok((s, FinalConstruct { nodes: (a, b) }))
|
Ok((s, FinalConstruct { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ pub fn procedural_continuous_assignment(s: Span) -> IResult<Span, ProceduralCont
|
|||||||
pub fn procedural_continuous_assignment_assign(
|
pub fn procedural_continuous_assignment_assign(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, ProceduralContinuousAssignment> {
|
) -> IResult<Span, ProceduralContinuousAssignment> {
|
||||||
let (s, a) = symbol("assign")(s)?;
|
let (s, a) = keyword("assign")(s)?;
|
||||||
let (s, b) = variable_assignment(s)?;
|
let (s, b) = variable_assignment(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -286,7 +286,7 @@ pub fn procedural_continuous_assignment_assign(
|
|||||||
pub fn procedural_continuous_assignment_deassign(
|
pub fn procedural_continuous_assignment_deassign(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, ProceduralContinuousAssignment> {
|
) -> IResult<Span, ProceduralContinuousAssignment> {
|
||||||
let (s, a) = symbol("deassign")(s)?;
|
let (s, a) = keyword("deassign")(s)?;
|
||||||
let (s, b) = variable_lvalue(s)?;
|
let (s, b) = variable_lvalue(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -300,7 +300,7 @@ pub fn procedural_continuous_assignment_deassign(
|
|||||||
pub fn procedural_continuous_assignment_force_variable(
|
pub fn procedural_continuous_assignment_force_variable(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, ProceduralContinuousAssignment> {
|
) -> IResult<Span, ProceduralContinuousAssignment> {
|
||||||
let (s, a) = symbol("force")(s)?;
|
let (s, a) = keyword("force")(s)?;
|
||||||
let (s, b) = variable_assignment(s)?;
|
let (s, b) = variable_assignment(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -314,7 +314,7 @@ pub fn procedural_continuous_assignment_force_variable(
|
|||||||
pub fn procedural_continuous_assignment_force_net(
|
pub fn procedural_continuous_assignment_force_net(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, ProceduralContinuousAssignment> {
|
) -> IResult<Span, ProceduralContinuousAssignment> {
|
||||||
let (s, a) = symbol("force")(s)?;
|
let (s, a) = keyword("force")(s)?;
|
||||||
let (s, b) = net_assignment(s)?;
|
let (s, b) = net_assignment(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -328,7 +328,7 @@ pub fn procedural_continuous_assignment_force_net(
|
|||||||
pub fn procedural_continuous_assignment_release_variable(
|
pub fn procedural_continuous_assignment_release_variable(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, ProceduralContinuousAssignment> {
|
) -> IResult<Span, ProceduralContinuousAssignment> {
|
||||||
let (s, a) = symbol("release")(s)?;
|
let (s, a) = keyword("release")(s)?;
|
||||||
let (s, b) = variable_lvalue(s)?;
|
let (s, b) = variable_lvalue(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -342,7 +342,7 @@ pub fn procedural_continuous_assignment_release_variable(
|
|||||||
pub fn procedural_continuous_assignment_release_net(
|
pub fn procedural_continuous_assignment_release_net(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, ProceduralContinuousAssignment> {
|
) -> IResult<Span, ProceduralContinuousAssignment> {
|
||||||
let (s, a) = symbol("release")(s)?;
|
let (s, a) = keyword("release")(s)?;
|
||||||
let (s, b) = net_lvalue(s)?;
|
let (s, b) = net_lvalue(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
|
@ -152,11 +152,11 @@ pub struct RsCaseItemDefault<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn randsequence_statement(s: Span) -> IResult<Span, RandsequenceStatement> {
|
pub fn randsequence_statement(s: Span) -> IResult<Span, RandsequenceStatement> {
|
||||||
let (s, a) = symbol("randsequence")(s)?;
|
let (s, a) = keyword("randsequence")(s)?;
|
||||||
let (s, b) = paren(opt(production_identifier))(s)?;
|
let (s, b) = paren(opt(production_identifier))(s)?;
|
||||||
let (s, c) = production(s)?;
|
let (s, c) = production(s)?;
|
||||||
let (s, d) = many0(production)(s)?;
|
let (s, d) = many0(production)(s)?;
|
||||||
let (s, e) = symbol("endsequence")(s)?;
|
let (s, e) = keyword("endsequence")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
RandsequenceStatement {
|
RandsequenceStatement {
|
||||||
@ -209,8 +209,8 @@ pub fn rs_production_list_prod(s: Span) -> IResult<Span, RsProductionList> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn rs_production_list_join(s: Span) -> IResult<Span, RsProductionList> {
|
pub fn rs_production_list_join(s: Span) -> IResult<Span, RsProductionList> {
|
||||||
let (s, a) = symbol("rand")(s)?;
|
let (s, a) = keyword("rand")(s)?;
|
||||||
let (s, b) = symbol("join")(s)?;
|
let (s, b) = keyword("join")(s)?;
|
||||||
let (s, c) = opt(paren(expression))(s)?;
|
let (s, c) = opt(paren(expression))(s)?;
|
||||||
let (s, d) = production_item(s)?;
|
let (s, d) = production_item(s)?;
|
||||||
let (s, e) = production_item(s)?;
|
let (s, e) = production_item(s)?;
|
||||||
@ -267,10 +267,10 @@ pub fn production_item(s: Span) -> IResult<Span, ProductionItem> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn rs_if_else(s: Span) -> IResult<Span, RsIfElse> {
|
pub fn rs_if_else(s: Span) -> IResult<Span, RsIfElse> {
|
||||||
let (s, a) = symbol("if")(s)?;
|
let (s, a) = keyword("if")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = production_item(s)?;
|
let (s, c) = production_item(s)?;
|
||||||
let (s, d) = opt(pair(symbol("else"), production_item))(s)?;
|
let (s, d) = opt(pair(keyword("else"), production_item))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
RsIfElse {
|
RsIfElse {
|
||||||
@ -281,7 +281,7 @@ pub fn rs_if_else(s: Span) -> IResult<Span, RsIfElse> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn rs_repeat(s: Span) -> IResult<Span, RsRepeat> {
|
pub fn rs_repeat(s: Span) -> IResult<Span, RsRepeat> {
|
||||||
let (s, a) = symbol("repeat")(s)?;
|
let (s, a) = keyword("repeat")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = production_item(s)?;
|
let (s, c) = production_item(s)?;
|
||||||
Ok((s, RsRepeat { nodes: (a, b, c) }))
|
Ok((s, RsRepeat { nodes: (a, b, c) }))
|
||||||
@ -289,11 +289,11 @@ pub fn rs_repeat(s: Span) -> IResult<Span, RsRepeat> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn rs_case(s: Span) -> IResult<Span, RsCase> {
|
pub fn rs_case(s: Span) -> IResult<Span, RsCase> {
|
||||||
let (s, a) = symbol("case")(s)?;
|
let (s, a) = keyword("case")(s)?;
|
||||||
let (s, b) = paren(case_expression)(s)?;
|
let (s, b) = paren(case_expression)(s)?;
|
||||||
let (s, c) = rs_case_item(s)?;
|
let (s, c) = rs_case_item(s)?;
|
||||||
let (s, d) = many0(rs_case_item)(s)?;
|
let (s, d) = many0(rs_case_item)(s)?;
|
||||||
let (s, e) = symbol("endcase")(s)?;
|
let (s, e) = keyword("endcase")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
RsCase {
|
RsCase {
|
||||||
@ -323,7 +323,7 @@ pub fn rs_case_item_nondefault(s: Span) -> IResult<Span, RsCaseItem> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn rs_case_item_default(s: Span) -> IResult<Span, RsCaseItem> {
|
pub fn rs_case_item_default(s: Span) -> IResult<Span, RsCaseItem> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
let (s, b) = opt(symbol(":"))(s)?;
|
let (s, b) = opt(symbol(":"))(s)?;
|
||||||
let (s, c) = production_item(s)?;
|
let (s, c) = production_item(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
|
@ -37,7 +37,7 @@ pub fn subroutine_call_statement(s: Span) -> IResult<Span, SubroutineCallStateme
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn subroutine_call_statement_function(s: Span) -> IResult<Span, SubroutineCallStatement> {
|
pub fn subroutine_call_statement_function(s: Span) -> IResult<Span, SubroutineCallStatement> {
|
||||||
let (s, a) = symbol("void")(s)?;
|
let (s, a) = keyword("void")(s)?;
|
||||||
let (s, b) = symbol("'")(s)?;
|
let (s, b) = symbol("'")(s)?;
|
||||||
let (s, c) = paren(function_subroutine_call)(s)?;
|
let (s, c) = paren(function_subroutine_call)(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
|
@ -232,7 +232,7 @@ pub fn delay_or_event_control(s: Span) -> IResult<Span, DelayOrEventControl> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn delay_or_event_control_repeat(s: Span) -> IResult<Span, DelayOrEventControl> {
|
pub fn delay_or_event_control_repeat(s: Span) -> IResult<Span, DelayOrEventControl> {
|
||||||
let (s, a) = symbol("repeat")(s)?;
|
let (s, a) = keyword("repeat")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = event_control(s)?;
|
let (s, c) = event_control(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -338,7 +338,7 @@ pub fn event_expression(s: Span) -> IResult<Span, EventExpression> {
|
|||||||
pub fn event_expression_expression(s: Span) -> IResult<Span, EventExpression> {
|
pub fn event_expression_expression(s: Span) -> IResult<Span, EventExpression> {
|
||||||
let (s, a) = opt(edge_identifier)(s)?;
|
let (s, a) = opt(edge_identifier)(s)?;
|
||||||
let (s, b) = expression(s)?;
|
let (s, b) = expression(s)?;
|
||||||
let (s, c) = opt(pair(symbol("iff"), expression))(s)?;
|
let (s, c) = opt(pair(keyword("iff"), expression))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
EventExpression::Expression(Box::new(EventExpressionExpression { nodes: (a, b, c) })),
|
EventExpression::Expression(Box::new(EventExpressionExpression { nodes: (a, b, c) })),
|
||||||
@ -348,7 +348,7 @@ pub fn event_expression_expression(s: Span) -> IResult<Span, EventExpression> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn event_expression_sequence(s: Span) -> IResult<Span, EventExpression> {
|
pub fn event_expression_sequence(s: Span) -> IResult<Span, EventExpression> {
|
||||||
let (s, a) = sequence_instance(s)?;
|
let (s, a) = sequence_instance(s)?;
|
||||||
let (s, b) = opt(pair(symbol("iff"), expression))(s)?;
|
let (s, b) = opt(pair(keyword("iff"), expression))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
EventExpression::Sequence(Box::new(EventExpressionSequence { nodes: (a, b) })),
|
EventExpression::Sequence(Box::new(EventExpressionSequence { nodes: (a, b) })),
|
||||||
@ -358,7 +358,7 @@ pub fn event_expression_sequence(s: Span) -> IResult<Span, EventExpression> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn event_expression_or(s: Span) -> IResult<Span, EventExpression> {
|
pub fn event_expression_or(s: Span) -> IResult<Span, EventExpression> {
|
||||||
let (s, a) = event_expression(s)?;
|
let (s, a) = event_expression(s)?;
|
||||||
let (s, b) = symbol("or")(s)?;
|
let (s, b) = keyword("or")(s)?;
|
||||||
let (s, c) = event_expression(s)?;
|
let (s, c) = event_expression(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -406,7 +406,7 @@ pub fn jump_statement(s: Span) -> IResult<Span, JumpStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn jump_statement_return(s: Span) -> IResult<Span, JumpStatement> {
|
pub fn jump_statement_return(s: Span) -> IResult<Span, JumpStatement> {
|
||||||
let (s, a) = symbol("return")(s)?;
|
let (s, a) = keyword("return")(s)?;
|
||||||
let (s, b) = opt(expression)(s)?;
|
let (s, b) = opt(expression)(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -417,7 +417,7 @@ pub fn jump_statement_return(s: Span) -> IResult<Span, JumpStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn jump_statement_break(s: Span) -> IResult<Span, JumpStatement> {
|
pub fn jump_statement_break(s: Span) -> IResult<Span, JumpStatement> {
|
||||||
let (s, a) = symbol("break")(s)?;
|
let (s, a) = keyword("break")(s)?;
|
||||||
let (s, b) = symbol(";")(s)?;
|
let (s, b) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -427,7 +427,7 @@ pub fn jump_statement_break(s: Span) -> IResult<Span, JumpStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn jump_statement_continue(s: Span) -> IResult<Span, JumpStatement> {
|
pub fn jump_statement_continue(s: Span) -> IResult<Span, JumpStatement> {
|
||||||
let (s, a) = symbol("continue")(s)?;
|
let (s, a) = keyword("continue")(s)?;
|
||||||
let (s, b) = symbol(";")(s)?;
|
let (s, b) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -446,7 +446,7 @@ pub fn wait_statement(s: Span) -> IResult<Span, WaitStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn wait_statement_wait(s: Span) -> IResult<Span, WaitStatement> {
|
pub fn wait_statement_wait(s: Span) -> IResult<Span, WaitStatement> {
|
||||||
let (s, a) = symbol("wait")(s)?;
|
let (s, a) = keyword("wait")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = statement_or_null(s)?;
|
let (s, c) = statement_or_null(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -457,8 +457,8 @@ pub fn wait_statement_wait(s: Span) -> IResult<Span, WaitStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn wait_statement_fork(s: Span) -> IResult<Span, WaitStatement> {
|
pub fn wait_statement_fork(s: Span) -> IResult<Span, WaitStatement> {
|
||||||
let (s, a) = symbol("wait")(s)?;
|
let (s, a) = keyword("wait")(s)?;
|
||||||
let (s, b) = symbol("fork")(s)?;
|
let (s, b) = keyword("fork")(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -468,7 +468,7 @@ pub fn wait_statement_fork(s: Span) -> IResult<Span, WaitStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn wait_statement_order(s: Span) -> IResult<Span, WaitStatement> {
|
pub fn wait_statement_order(s: Span) -> IResult<Span, WaitStatement> {
|
||||||
let (s, a) = symbol("wait_order")(s)?;
|
let (s, a) = keyword("wait_order")(s)?;
|
||||||
let (s, b) = paren(list(symbol(","), hierarchical_identifier))(s)?;
|
let (s, b) = paren(list(symbol(","), hierarchical_identifier))(s)?;
|
||||||
let (s, c) = action_block(s)?;
|
let (s, c) = action_block(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -518,7 +518,7 @@ pub fn disable_statement(s: Span) -> IResult<Span, DisableStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn disable_statement_task(s: Span) -> IResult<Span, DisableStatement> {
|
pub fn disable_statement_task(s: Span) -> IResult<Span, DisableStatement> {
|
||||||
let (s, a) = symbol("disable")(s)?;
|
let (s, a) = keyword("disable")(s)?;
|
||||||
let (s, b) = hierarchical_task_identifier(s)?;
|
let (s, b) = hierarchical_task_identifier(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -529,7 +529,7 @@ pub fn disable_statement_task(s: Span) -> IResult<Span, DisableStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn disable_statement_block(s: Span) -> IResult<Span, DisableStatement> {
|
pub fn disable_statement_block(s: Span) -> IResult<Span, DisableStatement> {
|
||||||
let (s, a) = symbol("disable")(s)?;
|
let (s, a) = keyword("disable")(s)?;
|
||||||
let (s, b) = hierarchical_block_identifier(s)?;
|
let (s, b) = hierarchical_block_identifier(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -540,8 +540,8 @@ pub fn disable_statement_block(s: Span) -> IResult<Span, DisableStatement> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn disable_statement_fork(s: Span) -> IResult<Span, DisableStatement> {
|
pub fn disable_statement_fork(s: Span) -> IResult<Span, DisableStatement> {
|
||||||
let (s, a) = symbol("disable")(s)?;
|
let (s, a) = keyword("disable")(s)?;
|
||||||
let (s, b) = symbol("fork")(s)?;
|
let (s, b) = keyword("fork")(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
|
@ -799,8 +799,8 @@ pub fn concurrent_assertion_statement(s: Span) -> IResult<Span, ConcurrentAssert
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn assert_property_statement(s: Span) -> IResult<Span, AssertPropertyStatement> {
|
pub fn assert_property_statement(s: Span) -> IResult<Span, AssertPropertyStatement> {
|
||||||
let (s, a) = symbol("assert")(s)?;
|
let (s, a) = keyword("assert")(s)?;
|
||||||
let (s, b) = symbol("property")(s)?;
|
let (s, b) = keyword("property")(s)?;
|
||||||
let (s, c) = paren(property_spec)(s)?;
|
let (s, c) = paren(property_spec)(s)?;
|
||||||
let (s, d) = action_block(s)?;
|
let (s, d) = action_block(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -813,8 +813,8 @@ pub fn assert_property_statement(s: Span) -> IResult<Span, AssertPropertyStateme
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn assume_property_statement(s: Span) -> IResult<Span, AssumePropertyStatement> {
|
pub fn assume_property_statement(s: Span) -> IResult<Span, AssumePropertyStatement> {
|
||||||
let (s, a) = symbol("assume")(s)?;
|
let (s, a) = keyword("assume")(s)?;
|
||||||
let (s, b) = symbol("property")(s)?;
|
let (s, b) = keyword("property")(s)?;
|
||||||
let (s, c) = paren(property_spec)(s)?;
|
let (s, c) = paren(property_spec)(s)?;
|
||||||
let (s, d) = action_block(s)?;
|
let (s, d) = action_block(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -827,8 +827,8 @@ pub fn assume_property_statement(s: Span) -> IResult<Span, AssumePropertyStateme
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn cover_property_statement(s: Span) -> IResult<Span, CoverPropertyStatement> {
|
pub fn cover_property_statement(s: Span) -> IResult<Span, CoverPropertyStatement> {
|
||||||
let (s, a) = symbol("cover")(s)?;
|
let (s, a) = keyword("cover")(s)?;
|
||||||
let (s, b) = symbol("property")(s)?;
|
let (s, b) = keyword("property")(s)?;
|
||||||
let (s, c) = paren(property_spec)(s)?;
|
let (s, c) = paren(property_spec)(s)?;
|
||||||
let (s, d) = statement_or_null(s)?;
|
let (s, d) = statement_or_null(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -841,7 +841,7 @@ pub fn cover_property_statement(s: Span) -> IResult<Span, CoverPropertyStatement
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn expect_property_statement(s: Span) -> IResult<Span, ExpectPropertyStatement> {
|
pub fn expect_property_statement(s: Span) -> IResult<Span, ExpectPropertyStatement> {
|
||||||
let (s, a) = symbol("expect")(s)?;
|
let (s, a) = keyword("expect")(s)?;
|
||||||
let (s, b) = paren(property_spec)(s)?;
|
let (s, b) = paren(property_spec)(s)?;
|
||||||
let (s, c) = action_block(s)?;
|
let (s, c) = action_block(s)?;
|
||||||
Ok((s, ExpectPropertyStatement { nodes: (a, b, c) }))
|
Ok((s, ExpectPropertyStatement { nodes: (a, b, c) }))
|
||||||
@ -849,13 +849,13 @@ pub fn expect_property_statement(s: Span) -> IResult<Span, ExpectPropertyStateme
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn cover_sequence_statement(s: Span) -> IResult<Span, CoverSequenceStatement> {
|
pub fn cover_sequence_statement(s: Span) -> IResult<Span, CoverSequenceStatement> {
|
||||||
let (s, a) = symbol("cover")(s)?;
|
let (s, a) = keyword("cover")(s)?;
|
||||||
let (s, b) = symbol("sequence")(s)?;
|
let (s, b) = keyword("sequence")(s)?;
|
||||||
let (s, c) = paren(triple(
|
let (s, c) = paren(triple(
|
||||||
opt(clocking_event),
|
opt(clocking_event),
|
||||||
opt(triple(
|
opt(triple(
|
||||||
symbol("disable"),
|
keyword("disable"),
|
||||||
symbol("iff"),
|
keyword("iff"),
|
||||||
paren(expression_or_dist),
|
paren(expression_or_dist),
|
||||||
)),
|
)),
|
||||||
sequence_expr,
|
sequence_expr,
|
||||||
@ -871,8 +871,8 @@ pub fn cover_sequence_statement(s: Span) -> IResult<Span, CoverSequenceStatement
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn restrict_property_statement(s: Span) -> IResult<Span, RestrictPropertyStatement> {
|
pub fn restrict_property_statement(s: Span) -> IResult<Span, RestrictPropertyStatement> {
|
||||||
let (s, a) = symbol("restrict")(s)?;
|
let (s, a) = keyword("restrict")(s)?;
|
||||||
let (s, b) = symbol("property")(s)?;
|
let (s, b) = keyword("property")(s)?;
|
||||||
let (s, c) = paren(property_spec)(s)?;
|
let (s, c) = paren(property_spec)(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -952,14 +952,14 @@ pub fn assertion_item_declaration(s: Span) -> IResult<Span, AssertionItemDeclara
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_declaration(s: Span) -> IResult<Span, PropertyDeclaration> {
|
pub fn property_declaration(s: Span) -> IResult<Span, PropertyDeclaration> {
|
||||||
let (s, a) = symbol("property")(s)?;
|
let (s, a) = keyword("property")(s)?;
|
||||||
let (s, b) = property_identifier(s)?;
|
let (s, b) = property_identifier(s)?;
|
||||||
let (s, c) = opt(paren(opt(property_port_list)))(s)?;
|
let (s, c) = opt(paren(opt(property_port_list)))(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
let (s, e) = many0(assertion_variable_declaration)(s)?;
|
let (s, e) = many0(assertion_variable_declaration)(s)?;
|
||||||
let (s, f) = property_spec(s)?;
|
let (s, f) = property_spec(s)?;
|
||||||
let (s, g) = opt(symbol(";"))(s)?;
|
let (s, g) = opt(symbol(";"))(s)?;
|
||||||
let (s, h) = symbol("endproperty")(s)?;
|
let (s, h) = keyword("endproperty")(s)?;
|
||||||
let (s, i) = opt(pair(symbol(":"), property_identifier))(s)?;
|
let (s, i) = opt(pair(symbol(":"), property_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -993,7 +993,7 @@ pub fn property_port_item(s: Span) -> IResult<Span, PropertyPortItem> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_lvar_port_direction(s: Span) -> IResult<Span, PropertyLvarPortDirection> {
|
pub fn property_lvar_port_direction(s: Span) -> IResult<Span, PropertyLvarPortDirection> {
|
||||||
let (s, a) = symbol("input")(s)?;
|
let (s, a) = keyword("input")(s)?;
|
||||||
Ok((s, PropertyLvarPortDirection::Input(a)))
|
Ok((s, PropertyLvarPortDirection::Input(a)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1003,7 +1003,7 @@ pub fn property_formal_type(s: Span) -> IResult<Span, PropertyFormalType> {
|
|||||||
map(sequence_formal_type, |x| {
|
map(sequence_formal_type, |x| {
|
||||||
PropertyFormalType::SequenceFormalType(x)
|
PropertyFormalType::SequenceFormalType(x)
|
||||||
}),
|
}),
|
||||||
map(symbol("property"), |x| PropertyFormalType::Property(x)),
|
map(keyword("property"), |x| PropertyFormalType::Property(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1011,8 +1011,8 @@ pub fn property_formal_type(s: Span) -> IResult<Span, PropertyFormalType> {
|
|||||||
pub fn property_spec(s: Span) -> IResult<Span, PropertySpec> {
|
pub fn property_spec(s: Span) -> IResult<Span, PropertySpec> {
|
||||||
let (s, a) = opt(clocking_event)(s)?;
|
let (s, a) = opt(clocking_event)(s)?;
|
||||||
let (s, b) = opt(triple(
|
let (s, b) = opt(triple(
|
||||||
symbol("disable"),
|
keyword("disable"),
|
||||||
symbol("iff"),
|
keyword("iff"),
|
||||||
paren(expression_or_dist),
|
paren(expression_or_dist),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
@ -1064,7 +1064,7 @@ pub fn property_expr(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_strong(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_strong(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("strong")(s)?;
|
let (s, a) = keyword("strong")(s)?;
|
||||||
let (s, b) = paren(sequence_expr)(s)?;
|
let (s, b) = paren(sequence_expr)(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1074,7 +1074,7 @@ pub fn property_expr_strong(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_weak(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_weak(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("weak")(s)?;
|
let (s, a) = keyword("weak")(s)?;
|
||||||
let (s, b) = paren(sequence_expr)(s)?;
|
let (s, b) = paren(sequence_expr)(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1093,7 +1093,7 @@ pub fn property_expr_paren(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_not(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_not(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("not")(s)?;
|
let (s, a) = keyword("not")(s)?;
|
||||||
let (s, b) = property_expr(s)?;
|
let (s, b) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1104,7 +1104,7 @@ pub fn property_expr_not(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn property_expr_or(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_or(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = property_expr(s)?;
|
let (s, a) = property_expr(s)?;
|
||||||
let (s, b) = symbol("or")(s)?;
|
let (s, b) = keyword("or")(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1115,7 +1115,7 @@ pub fn property_expr_or(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn property_expr_and(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_and(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = property_expr(s)?;
|
let (s, a) = property_expr(s)?;
|
||||||
let (s, b) = symbol("and")(s)?;
|
let (s, b) = keyword("and")(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1151,10 +1151,10 @@ pub fn property_expr_implication_nonoverlapped(s: Span) -> IResult<Span, Propert
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_if(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_if(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("if")(s)?;
|
let (s, a) = keyword("if")(s)?;
|
||||||
let (s, b) = paren(expression_or_dist)(s)?;
|
let (s, b) = paren(expression_or_dist)(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
let (s, d) = opt(pair(symbol("else"), property_expr))(s)?;
|
let (s, d) = opt(pair(keyword("else"), property_expr))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
PropertyExpr::If(Box::new(PropertyExprIf {
|
PropertyExpr::If(Box::new(PropertyExprIf {
|
||||||
@ -1165,11 +1165,11 @@ pub fn property_expr_if(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_case(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_case(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("case")(s)?;
|
let (s, a) = keyword("case")(s)?;
|
||||||
let (s, b) = paren(expression_or_dist)(s)?;
|
let (s, b) = paren(expression_or_dist)(s)?;
|
||||||
let (s, c) = property_case_item(s)?;
|
let (s, c) = property_case_item(s)?;
|
||||||
let (s, d) = many0(property_case_item)(s)?;
|
let (s, d) = many0(property_case_item)(s)?;
|
||||||
let (s, e) = symbol("endcase")(s)?;
|
let (s, e) = keyword("endcase")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
PropertyExpr::Case(Box::new(PropertyExprCase {
|
PropertyExpr::Case(Box::new(PropertyExprCase {
|
||||||
@ -1206,7 +1206,7 @@ pub fn property_expr_followed_by_nonoverlapped(s: Span) -> IResult<Span, Propert
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("nexttime")(s)?;
|
let (s, a) = keyword("nexttime")(s)?;
|
||||||
let (s, b) = opt(bracket(constant_expression))(s)?;
|
let (s, b) = opt(bracket(constant_expression))(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1217,7 +1217,7 @@ pub fn property_expr_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_s_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_s_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("s_nexttime")(s)?;
|
let (s, a) = keyword("s_nexttime")(s)?;
|
||||||
let (s, b) = opt(bracket(constant_expression))(s)?;
|
let (s, b) = opt(bracket(constant_expression))(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1228,7 +1228,7 @@ pub fn property_expr_s_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_always(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_always(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("always")(s)?;
|
let (s, a) = keyword("always")(s)?;
|
||||||
let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?;
|
let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1239,7 +1239,7 @@ pub fn property_expr_always(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_s_always(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_s_always(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("s_always")(s)?;
|
let (s, a) = keyword("s_always")(s)?;
|
||||||
let (s, b) = bracket(cycle_delay_const_range_expression)(s)?;
|
let (s, b) = bracket(cycle_delay_const_range_expression)(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1250,7 +1250,7 @@ pub fn property_expr_s_always(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_eventually(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_eventually(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("eventually")(s)?;
|
let (s, a) = keyword("eventually")(s)?;
|
||||||
let (s, b) = bracket(constant_range)(s)?;
|
let (s, b) = bracket(constant_range)(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1261,7 +1261,7 @@ pub fn property_expr_eventually(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_s_eventually(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_s_eventually(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("s_eventually")(s)?;
|
let (s, a) = keyword("s_eventually")(s)?;
|
||||||
let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?;
|
let (s, b) = opt(bracket(cycle_delay_const_range_expression))(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1273,7 +1273,7 @@ pub fn property_expr_s_eventually(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn property_expr_until(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_until(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = property_expr(s)?;
|
let (s, a) = property_expr(s)?;
|
||||||
let (s, b) = symbol("until")(s)?;
|
let (s, b) = keyword("until")(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1284,7 +1284,7 @@ pub fn property_expr_until(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn property_expr_s_until(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_s_until(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = property_expr(s)?;
|
let (s, a) = property_expr(s)?;
|
||||||
let (s, b) = symbol("s_until")(s)?;
|
let (s, b) = keyword("s_until")(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1295,7 +1295,7 @@ pub fn property_expr_s_until(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn property_expr_until_with(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_until_with(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = property_expr(s)?;
|
let (s, a) = property_expr(s)?;
|
||||||
let (s, b) = symbol("until_with")(s)?;
|
let (s, b) = keyword("until_with")(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1306,7 +1306,7 @@ pub fn property_expr_until_with(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn property_expr_s_until_with(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_s_until_with(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = property_expr(s)?;
|
let (s, a) = property_expr(s)?;
|
||||||
let (s, b) = symbol("s_until_with")(s)?;
|
let (s, b) = keyword("s_until_with")(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1317,7 +1317,7 @@ pub fn property_expr_s_until_with(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn property_expr_implies(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_implies(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = property_expr(s)?;
|
let (s, a) = property_expr(s)?;
|
||||||
let (s, b) = symbol("implies")(s)?;
|
let (s, b) = keyword("implies")(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1328,7 +1328,7 @@ pub fn property_expr_implies(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn property_expr_iff(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_iff(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = property_expr(s)?;
|
let (s, a) = property_expr(s)?;
|
||||||
let (s, b) = symbol("iff")(s)?;
|
let (s, b) = keyword("iff")(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1338,7 +1338,7 @@ pub fn property_expr_iff(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("accept_on")(s)?;
|
let (s, a) = keyword("accept_on")(s)?;
|
||||||
let (s, b) = paren(expression_or_dist)(s)?;
|
let (s, b) = paren(expression_or_dist)(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1349,7 +1349,7 @@ pub fn property_expr_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_reject_on(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_reject_on(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("reject_on")(s)?;
|
let (s, a) = keyword("reject_on")(s)?;
|
||||||
let (s, b) = paren(expression_or_dist)(s)?;
|
let (s, b) = paren(expression_or_dist)(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1360,7 +1360,7 @@ pub fn property_expr_reject_on(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_sync_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_sync_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("sync_accept_on")(s)?;
|
let (s, a) = keyword("sync_accept_on")(s)?;
|
||||||
let (s, b) = paren(expression_or_dist)(s)?;
|
let (s, b) = paren(expression_or_dist)(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1371,7 +1371,7 @@ pub fn property_expr_sync_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_expr_sync_reject_on(s: Span) -> IResult<Span, PropertyExpr> {
|
pub fn property_expr_sync_reject_on(s: Span) -> IResult<Span, PropertyExpr> {
|
||||||
let (s, a) = symbol("sync_reject_on")(s)?;
|
let (s, a) = keyword("sync_reject_on")(s)?;
|
||||||
let (s, b) = paren(expression_or_dist)(s)?;
|
let (s, b) = paren(expression_or_dist)(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1411,7 +1411,7 @@ pub fn property_case_item_nondefault(s: Span) -> IResult<Span, PropertyCaseItem>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn property_case_item_default(s: Span) -> IResult<Span, PropertyCaseItem> {
|
pub fn property_case_item_default(s: Span) -> IResult<Span, PropertyCaseItem> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
let (s, b) = opt(symbol(":"))(s)?;
|
let (s, b) = opt(symbol(":"))(s)?;
|
||||||
let (s, c) = property_expr(s)?;
|
let (s, c) = property_expr(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
@ -1425,14 +1425,14 @@ pub fn property_case_item_default(s: Span) -> IResult<Span, PropertyCaseItem> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn sequence_declaration(s: Span) -> IResult<Span, SequenceDeclaration> {
|
pub fn sequence_declaration(s: Span) -> IResult<Span, SequenceDeclaration> {
|
||||||
let (s, a) = symbol("sequence")(s)?;
|
let (s, a) = keyword("sequence")(s)?;
|
||||||
let (s, b) = sequence_identifier(s)?;
|
let (s, b) = sequence_identifier(s)?;
|
||||||
let (s, c) = opt(paren(opt(sequence_port_list)))(s)?;
|
let (s, c) = opt(paren(opt(sequence_port_list)))(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
let (s, e) = many0(assertion_variable_declaration)(s)?;
|
let (s, e) = many0(assertion_variable_declaration)(s)?;
|
||||||
let (s, f) = sequence_expr(s)?;
|
let (s, f) = sequence_expr(s)?;
|
||||||
let (s, g) = opt(symbol(";"))(s)?;
|
let (s, g) = opt(symbol(";"))(s)?;
|
||||||
let (s, h) = symbol("endsequence")(s)?;
|
let (s, h) = keyword("endsequence")(s)?;
|
||||||
let (s, i) = opt(pair(symbol(":"), sequence_identifier))(s)?;
|
let (s, i) = opt(pair(symbol(":"), sequence_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1467,9 +1467,9 @@ pub fn sequence_port_item(s: Span) -> IResult<Span, SequencePortItem> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn sequence_lvar_port_direction(s: Span) -> IResult<Span, SequenceLvarPortDirection> {
|
pub fn sequence_lvar_port_direction(s: Span) -> IResult<Span, SequenceLvarPortDirection> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("input"), |x| SequenceLvarPortDirection::Input(x)),
|
map(keyword("input"), |x| SequenceLvarPortDirection::Input(x)),
|
||||||
map(symbol("inout"), |x| SequenceLvarPortDirection::Inout(x)),
|
map(keyword("inout"), |x| SequenceLvarPortDirection::Inout(x)),
|
||||||
map(symbol("output"), |x| SequenceLvarPortDirection::Output(x)),
|
map(keyword("output"), |x| SequenceLvarPortDirection::Output(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1479,8 +1479,8 @@ pub fn sequence_formal_type(s: Span) -> IResult<Span, SequenceFormalType> {
|
|||||||
map(data_type_or_implicit, |x| {
|
map(data_type_or_implicit, |x| {
|
||||||
SequenceFormalType::DataTypeOrImplicit(x)
|
SequenceFormalType::DataTypeOrImplicit(x)
|
||||||
}),
|
}),
|
||||||
map(symbol("sequence"), |x| SequenceFormalType::Sequence(x)),
|
map(keyword("sequence"), |x| SequenceFormalType::Sequence(x)),
|
||||||
map(symbol("untyped"), |x| SequenceFormalType::Untyped(x)),
|
map(keyword("untyped"), |x| SequenceFormalType::Untyped(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1563,7 +1563,7 @@ pub fn sequence_expr_paren(s: Span) -> IResult<Span, SequenceExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn sequence_expr_and(s: Span) -> IResult<Span, SequenceExpr> {
|
pub fn sequence_expr_and(s: Span) -> IResult<Span, SequenceExpr> {
|
||||||
let (s, a) = sequence_expr(s)?;
|
let (s, a) = sequence_expr(s)?;
|
||||||
let (s, b) = symbol("and")(s)?;
|
let (s, b) = keyword("and")(s)?;
|
||||||
let (s, c) = sequence_expr(s)?;
|
let (s, c) = sequence_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1574,7 +1574,7 @@ pub fn sequence_expr_and(s: Span) -> IResult<Span, SequenceExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn sequence_expr_intersect(s: Span) -> IResult<Span, SequenceExpr> {
|
pub fn sequence_expr_intersect(s: Span) -> IResult<Span, SequenceExpr> {
|
||||||
let (s, a) = sequence_expr(s)?;
|
let (s, a) = sequence_expr(s)?;
|
||||||
let (s, b) = symbol("intersect")(s)?;
|
let (s, b) = keyword("intersect")(s)?;
|
||||||
let (s, c) = sequence_expr(s)?;
|
let (s, c) = sequence_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1585,7 +1585,7 @@ pub fn sequence_expr_intersect(s: Span) -> IResult<Span, SequenceExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn sequence_expr_or(s: Span) -> IResult<Span, SequenceExpr> {
|
pub fn sequence_expr_or(s: Span) -> IResult<Span, SequenceExpr> {
|
||||||
let (s, a) = sequence_expr(s)?;
|
let (s, a) = sequence_expr(s)?;
|
||||||
let (s, b) = symbol("or")(s)?;
|
let (s, b) = keyword("or")(s)?;
|
||||||
let (s, c) = sequence_expr(s)?;
|
let (s, c) = sequence_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1595,7 +1595,7 @@ pub fn sequence_expr_or(s: Span) -> IResult<Span, SequenceExpr> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn sequence_expr_first_match(s: Span) -> IResult<Span, SequenceExpr> {
|
pub fn sequence_expr_first_match(s: Span) -> IResult<Span, SequenceExpr> {
|
||||||
let (s, a) = symbol("first_match")(s)?;
|
let (s, a) = keyword("first_match")(s)?;
|
||||||
let (s, b) = paren(pair(
|
let (s, b) = paren(pair(
|
||||||
sequence_expr,
|
sequence_expr,
|
||||||
many0(pair(symbol(","), sequence_match_item)),
|
many0(pair(symbol(","), sequence_match_item)),
|
||||||
@ -1609,7 +1609,7 @@ pub fn sequence_expr_first_match(s: Span) -> IResult<Span, SequenceExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn sequence_expr_throughout(s: Span) -> IResult<Span, SequenceExpr> {
|
pub fn sequence_expr_throughout(s: Span) -> IResult<Span, SequenceExpr> {
|
||||||
let (s, a) = expression_or_dist(s)?;
|
let (s, a) = expression_or_dist(s)?;
|
||||||
let (s, b) = symbol("throughout")(s)?;
|
let (s, b) = keyword("throughout")(s)?;
|
||||||
let (s, c) = sequence_expr(s)?;
|
let (s, c) = sequence_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1620,7 +1620,7 @@ pub fn sequence_expr_throughout(s: Span) -> IResult<Span, SequenceExpr> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn sequence_expr_within(s: Span) -> IResult<Span, SequenceExpr> {
|
pub fn sequence_expr_within(s: Span) -> IResult<Span, SequenceExpr> {
|
||||||
let (s, a) = sequence_expr(s)?;
|
let (s, a) = sequence_expr(s)?;
|
||||||
let (s, b) = symbol("within")(s)?;
|
let (s, b) = keyword("within")(s)?;
|
||||||
let (s, c) = sequence_expr(s)?;
|
let (s, c) = sequence_expr(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1881,7 +1881,7 @@ pub fn cycle_delay_const_range_expression_dollar(
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn expression_or_dist(s: Span) -> IResult<Span, ExpressionOrDist> {
|
pub fn expression_or_dist(s: Span) -> IResult<Span, ExpressionOrDist> {
|
||||||
let (s, a) = expression(s)?;
|
let (s, a) = expression(s)?;
|
||||||
let (s, b) = opt(pair(symbol("dist"), brace(dist_list)))(s)?;
|
let (s, b) = opt(pair(keyword("dist"), brace(dist_list)))(s)?;
|
||||||
Ok((s, ExpressionOrDist { nodes: (a, b) }))
|
Ok((s, ExpressionOrDist { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,13 +523,13 @@ pub struct CovergroupExpression<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn covergroup_declaration(s: Span) -> IResult<Span, CovergroupDeclaration> {
|
pub fn covergroup_declaration(s: Span) -> IResult<Span, CovergroupDeclaration> {
|
||||||
let (s, a) = symbol("covergroup")(s)?;
|
let (s, a) = keyword("covergroup")(s)?;
|
||||||
let (s, b) = covergroup_identifier(s)?;
|
let (s, b) = covergroup_identifier(s)?;
|
||||||
let (s, c) = opt(paren(opt(tf_port_list)))(s)?;
|
let (s, c) = opt(paren(opt(tf_port_list)))(s)?;
|
||||||
let (s, d) = opt(coverage_event)(s)?;
|
let (s, d) = opt(coverage_event)(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
let (s, f) = many0(coverage_spec_or_option)(s)?;
|
let (s, f) = many0(coverage_spec_or_option)(s)?;
|
||||||
let (s, g) = symbol("endgroup")(s)?;
|
let (s, g) = keyword("endgroup")(s)?;
|
||||||
let (s, h) = opt(pair(symbol(":"), covergroup_identifier))(s)?;
|
let (s, h) = opt(pair(symbol(":"), covergroup_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -572,7 +572,7 @@ pub fn coverage_option(s: Span) -> IResult<Span, CoverageOption> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn coverage_option_option(s: Span) -> IResult<Span, CoverageOption> {
|
pub fn coverage_option_option(s: Span) -> IResult<Span, CoverageOption> {
|
||||||
let (s, a) = symbol("option")(s)?;
|
let (s, a) = keyword("option")(s)?;
|
||||||
let (s, b) = symbol(".")(s)?;
|
let (s, b) = symbol(".")(s)?;
|
||||||
let (s, c) = member_identifier(s)?;
|
let (s, c) = member_identifier(s)?;
|
||||||
let (s, d) = symbol("=")(s)?;
|
let (s, d) = symbol("=")(s)?;
|
||||||
@ -587,7 +587,7 @@ pub fn coverage_option_option(s: Span) -> IResult<Span, CoverageOption> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn coverage_option_type_option(s: Span) -> IResult<Span, CoverageOption> {
|
pub fn coverage_option_type_option(s: Span) -> IResult<Span, CoverageOption> {
|
||||||
let (s, a) = symbol("type_option")(s)?;
|
let (s, a) = keyword("type_option")(s)?;
|
||||||
let (s, b) = symbol(".")(s)?;
|
let (s, b) = symbol(".")(s)?;
|
||||||
let (s, c) = member_identifier(s)?;
|
let (s, c) = member_identifier(s)?;
|
||||||
let (s, d) = symbol("=")(s)?;
|
let (s, d) = symbol("=")(s)?;
|
||||||
@ -619,9 +619,9 @@ pub fn coverage_event(s: Span) -> IResult<Span, CoverageEvent> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn coverage_event_sample(s: Span) -> IResult<Span, CoverageEvent> {
|
pub fn coverage_event_sample(s: Span) -> IResult<Span, CoverageEvent> {
|
||||||
let (s, a) = symbol("with")(s)?;
|
let (s, a) = keyword("with")(s)?;
|
||||||
let (s, b) = symbol("function")(s)?;
|
let (s, b) = keyword("function")(s)?;
|
||||||
let (s, c) = symbol("sample")(s)?;
|
let (s, c) = keyword("sample")(s)?;
|
||||||
let (s, d) = paren(opt(tf_port_list))(s)?;
|
let (s, d) = paren(opt(tf_port_list))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -650,7 +650,7 @@ pub fn block_event_expression(s: Span) -> IResult<Span, BlockEventExpression> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn block_event_expression_or(s: Span) -> IResult<Span, BlockEventExpression> {
|
pub fn block_event_expression_or(s: Span) -> IResult<Span, BlockEventExpression> {
|
||||||
let (s, a) = block_event_expression(s)?;
|
let (s, a) = block_event_expression(s)?;
|
||||||
let (s, b) = symbol("or")(s)?;
|
let (s, b) = keyword("or")(s)?;
|
||||||
let (s, c) = block_event_expression(s)?;
|
let (s, c) = block_event_expression(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -660,7 +660,7 @@ pub fn block_event_expression_or(s: Span) -> IResult<Span, BlockEventExpression>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn block_event_expression_begin(s: Span) -> IResult<Span, BlockEventExpression> {
|
pub fn block_event_expression_begin(s: Span) -> IResult<Span, BlockEventExpression> {
|
||||||
let (s, a) = symbol("begin")(s)?;
|
let (s, a) = keyword("begin")(s)?;
|
||||||
let (s, b) = hierarchical_btf_identifier(s)?;
|
let (s, b) = hierarchical_btf_identifier(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -670,7 +670,7 @@ pub fn block_event_expression_begin(s: Span) -> IResult<Span, BlockEventExpressi
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn block_event_expression_end(s: Span) -> IResult<Span, BlockEventExpression> {
|
pub fn block_event_expression_end(s: Span) -> IResult<Span, BlockEventExpression> {
|
||||||
let (s, a) = symbol("end")(s)?;
|
let (s, a) = keyword("end")(s)?;
|
||||||
let (s, b) = hierarchical_btf_identifier(s)?;
|
let (s, b) = hierarchical_btf_identifier(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -722,9 +722,9 @@ pub fn cover_point(s: Span) -> IResult<Span, CoverPoint> {
|
|||||||
cover_point_identifier,
|
cover_point_identifier,
|
||||||
symbol(":"),
|
symbol(":"),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
let (s, b) = symbol("coverpoint")(s)?;
|
let (s, b) = keyword("coverpoint")(s)?;
|
||||||
let (s, c) = expression(s)?;
|
let (s, c) = expression(s)?;
|
||||||
let (s, d) = opt(pair(symbol("iff"), paren(expression)))(s)?;
|
let (s, d) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||||
let (s, e) = bins_or_empty(s)?;
|
let (s, e) = bins_or_empty(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -775,8 +775,8 @@ pub fn bins_or_options_covergroup(s: Span) -> IResult<Span, BinsOrOptions> {
|
|||||||
let (s, d) = opt(bracket(opt(covergroup_expression)))(s)?;
|
let (s, d) = opt(bracket(opt(covergroup_expression)))(s)?;
|
||||||
let (s, e) = symbol("=")(s)?;
|
let (s, e) = symbol("=")(s)?;
|
||||||
let (s, f) = brace(covergroup_range_list)(s)?;
|
let (s, f) = brace(covergroup_range_list)(s)?;
|
||||||
let (s, g) = opt(pair(symbol("with"), paren(with_covergroup_expression)))(s)?;
|
let (s, g) = opt(pair(keyword("with"), paren(with_covergroup_expression)))(s)?;
|
||||||
let (s, h) = opt(pair(symbol("iff"), paren(expression)))(s)?;
|
let (s, h) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
BinsOrOptions::Covergroup(BinsOrOptionsCovergroup {
|
BinsOrOptions::Covergroup(BinsOrOptionsCovergroup {
|
||||||
@ -787,7 +787,7 @@ pub fn bins_or_options_covergroup(s: Span) -> IResult<Span, BinsOrOptions> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn wildcard(s: Span) -> IResult<Span, Wildcard> {
|
pub fn wildcard(s: Span) -> IResult<Span, Wildcard> {
|
||||||
let (s, a) = symbol("wildcard")(s)?;
|
let (s, a) = keyword("wildcard")(s)?;
|
||||||
Ok((s, Wildcard { nodes: (a,) }))
|
Ok((s, Wildcard { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -799,9 +799,9 @@ pub fn bins_or_options_cover_point(s: Span) -> IResult<Span, BinsOrOptions> {
|
|||||||
let (s, d) = opt(bracket(opt(covergroup_expression)))(s)?;
|
let (s, d) = opt(bracket(opt(covergroup_expression)))(s)?;
|
||||||
let (s, e) = symbol("=")(s)?;
|
let (s, e) = symbol("=")(s)?;
|
||||||
let (s, f) = cover_point_identifier(s)?;
|
let (s, f) = cover_point_identifier(s)?;
|
||||||
let (s, g) = symbol("with")(s)?;
|
let (s, g) = keyword("with")(s)?;
|
||||||
let (s, h) = paren(with_covergroup_expression)(s)?;
|
let (s, h) = paren(with_covergroup_expression)(s)?;
|
||||||
let (s, i) = opt(pair(symbol("iff"), paren(expression)))(s)?;
|
let (s, i) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
BinsOrOptions::CoverPoint(BinsOrOptionsCoverPoint {
|
BinsOrOptions::CoverPoint(BinsOrOptionsCoverPoint {
|
||||||
@ -818,7 +818,7 @@ pub fn bins_or_options_set_covergroup(s: Span) -> IResult<Span, BinsOrOptions> {
|
|||||||
let (s, d) = opt(bracket(opt(covergroup_expression)))(s)?;
|
let (s, d) = opt(bracket(opt(covergroup_expression)))(s)?;
|
||||||
let (s, e) = symbol("=")(s)?;
|
let (s, e) = symbol("=")(s)?;
|
||||||
let (s, f) = set_covergroup_expression(s)?;
|
let (s, f) = set_covergroup_expression(s)?;
|
||||||
let (s, g) = opt(pair(symbol("iff"), paren(expression)))(s)?;
|
let (s, g) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
BinsOrOptions::SetCovergroup(BinsOrOptionsSetCovergroup {
|
BinsOrOptions::SetCovergroup(BinsOrOptionsSetCovergroup {
|
||||||
@ -835,7 +835,7 @@ pub fn bins_or_options_trans_list(s: Span) -> IResult<Span, BinsOrOptions> {
|
|||||||
let (s, d) = opt(pair(symbol("["), symbol("]")))(s)?;
|
let (s, d) = opt(pair(symbol("["), symbol("]")))(s)?;
|
||||||
let (s, e) = symbol("=")(s)?;
|
let (s, e) = symbol("=")(s)?;
|
||||||
let (s, f) = trans_list(s)?;
|
let (s, f) = trans_list(s)?;
|
||||||
let (s, g) = opt(pair(symbol("iff"), paren(expression)))(s)?;
|
let (s, g) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
BinsOrOptions::TransList(BinsOrOptionsTransList {
|
BinsOrOptions::TransList(BinsOrOptionsTransList {
|
||||||
@ -850,8 +850,8 @@ pub fn bins_or_options_default(s: Span) -> IResult<Span, BinsOrOptions> {
|
|||||||
let (s, b) = bin_identifier(s)?;
|
let (s, b) = bin_identifier(s)?;
|
||||||
let (s, c) = opt(bracket(opt(covergroup_expression)))(s)?;
|
let (s, c) = opt(bracket(opt(covergroup_expression)))(s)?;
|
||||||
let (s, d) = symbol("=")(s)?;
|
let (s, d) = symbol("=")(s)?;
|
||||||
let (s, e) = symbol("default")(s)?;
|
let (s, e) = keyword("default")(s)?;
|
||||||
let (s, f) = opt(pair(symbol("iff"), paren(expression)))(s)?;
|
let (s, f) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
BinsOrOptions::Default(BinsOrOptionsDefault {
|
BinsOrOptions::Default(BinsOrOptionsDefault {
|
||||||
@ -865,9 +865,9 @@ pub fn bins_or_options_default_sequence(s: Span) -> IResult<Span, BinsOrOptions>
|
|||||||
let (s, a) = bins_keyword(s)?;
|
let (s, a) = bins_keyword(s)?;
|
||||||
let (s, b) = bin_identifier(s)?;
|
let (s, b) = bin_identifier(s)?;
|
||||||
let (s, c) = symbol("=")(s)?;
|
let (s, c) = symbol("=")(s)?;
|
||||||
let (s, d) = symbol("default")(s)?;
|
let (s, d) = keyword("default")(s)?;
|
||||||
let (s, e) = symbol("sequence")(s)?;
|
let (s, e) = keyword("sequence")(s)?;
|
||||||
let (s, f) = opt(pair(symbol("iff"), paren(expression)))(s)?;
|
let (s, f) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
BinsOrOptions::DefaultSequence(BinsOrOptionsDefaultSequence {
|
BinsOrOptions::DefaultSequence(BinsOrOptionsDefaultSequence {
|
||||||
@ -879,9 +879,9 @@ pub fn bins_or_options_default_sequence(s: Span) -> IResult<Span, BinsOrOptions>
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn bins_keyword(s: Span) -> IResult<Span, BinsKeyword> {
|
pub fn bins_keyword(s: Span) -> IResult<Span, BinsKeyword> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("bins"), |x| BinsKeyword::Bins(x)),
|
map(keyword("bins"), |x| BinsKeyword::Bins(x)),
|
||||||
map(symbol("illegal_bins"), |x| BinsKeyword::IllegalBins(x)),
|
map(keyword("illegal_bins"), |x| BinsKeyword::IllegalBins(x)),
|
||||||
map(symbol("ignore_bins"), |x| BinsKeyword::IgnoreBins(x)),
|
map(keyword("ignore_bins"), |x| BinsKeyword::IgnoreBins(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -967,9 +967,9 @@ pub fn repeat_range_binary(s: Span) -> IResult<Span, RepeatRange> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn cover_cross(s: Span) -> IResult<Span, CoverCross> {
|
pub fn cover_cross(s: Span) -> IResult<Span, CoverCross> {
|
||||||
let (s, a) = opt(pair(cross_identifier, symbol(":")))(s)?;
|
let (s, a) = opt(pair(cross_identifier, symbol(":")))(s)?;
|
||||||
let (s, b) = symbol("cross")(s)?;
|
let (s, b) = keyword("cross")(s)?;
|
||||||
let (s, c) = list_of_cross_items(s)?;
|
let (s, c) = list_of_cross_items(s)?;
|
||||||
let (s, d) = opt(pair(symbol("iff"), paren(expression)))(s)?;
|
let (s, d) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||||
let (s, e) = cross_body(s)?;
|
let (s, e) = cross_body(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -1056,7 +1056,7 @@ pub fn bins_selection(s: Span) -> IResult<Span, BinsSelection> {
|
|||||||
let (s, b) = bin_identifier(s)?;
|
let (s, b) = bin_identifier(s)?;
|
||||||
let (s, c) = symbol("=")(s)?;
|
let (s, c) = symbol("=")(s)?;
|
||||||
let (s, d) = select_expression(s)?;
|
let (s, d) = select_expression(s)?;
|
||||||
let (s, e) = opt(pair(symbol("iff"), paren(expression)))(s)?;
|
let (s, e) = opt(pair(keyword("iff"), paren(expression)))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
BinsSelection {
|
BinsSelection {
|
||||||
@ -1123,9 +1123,9 @@ pub fn select_expression_paren(s: Span) -> IResult<Span, SelectExpression> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn select_expression_with(s: Span) -> IResult<Span, SelectExpression> {
|
pub fn select_expression_with(s: Span) -> IResult<Span, SelectExpression> {
|
||||||
let (s, a) = select_expression(s)?;
|
let (s, a) = select_expression(s)?;
|
||||||
let (s, b) = symbol("with")(s)?;
|
let (s, b) = keyword("with")(s)?;
|
||||||
let (s, c) = paren(with_covergroup_expression)(s)?;
|
let (s, c) = paren(with_covergroup_expression)(s)?;
|
||||||
let (s, d) = opt(pair(symbol("matches"), integer_covergroup_expression))(s)?;
|
let (s, d) = opt(pair(keyword("matches"), integer_covergroup_expression))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
SelectExpression::With(Box::new(SelectExpressionWith {
|
SelectExpression::With(Box::new(SelectExpressionWith {
|
||||||
@ -1137,7 +1137,7 @@ pub fn select_expression_with(s: Span) -> IResult<Span, SelectExpression> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn select_expression_cross_set(s: Span) -> IResult<Span, SelectExpression> {
|
pub fn select_expression_cross_set(s: Span) -> IResult<Span, SelectExpression> {
|
||||||
let (s, a) = cross_set_expression(s)?;
|
let (s, a) = cross_set_expression(s)?;
|
||||||
let (s, b) = opt(pair(symbol("matches"), integer_covergroup_expression))(s)?;
|
let (s, b) = opt(pair(keyword("matches"), integer_covergroup_expression))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
SelectExpression::CrossSet(SelectExpressionCrossSet { nodes: (a, b) }),
|
SelectExpression::CrossSet(SelectExpressionCrossSet { nodes: (a, b) }),
|
||||||
@ -1146,9 +1146,9 @@ pub fn select_expression_cross_set(s: Span) -> IResult<Span, SelectExpression> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn select_condition(s: Span) -> IResult<Span, SelectCondition> {
|
pub fn select_condition(s: Span) -> IResult<Span, SelectCondition> {
|
||||||
let (s, a) = symbol("binsof")(s)?;
|
let (s, a) = keyword("binsof")(s)?;
|
||||||
let (s, b) = paren(bins_expression)(s)?;
|
let (s, b) = paren(bins_expression)(s)?;
|
||||||
let (s, c) = opt(pair(symbol("intersect"), brace(covergroup_range_list)))(s)?;
|
let (s, c) = opt(pair(keyword("intersect"), brace(covergroup_range_list)))(s)?;
|
||||||
Ok((s, SelectCondition { nodes: (a, b, c) }))
|
Ok((s, SelectCondition { nodes: (a, b, c) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,14 +339,14 @@ pub fn class_new(s: Span) -> IResult<Span, ClassNew> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_new_argument(s: Span) -> IResult<Span, ClassNew> {
|
pub fn class_new_argument(s: Span) -> IResult<Span, ClassNew> {
|
||||||
let (s, a) = opt(class_scope)(s)?;
|
let (s, a) = opt(class_scope)(s)?;
|
||||||
let (s, b) = symbol("new")(s)?;
|
let (s, b) = keyword("new")(s)?;
|
||||||
let (s, c) = opt(paren(list_of_arguments))(s)?;
|
let (s, c) = opt(paren(list_of_arguments))(s)?;
|
||||||
Ok((s, ClassNew::Argument(ClassNewArgument { nodes: (a, b, c) })))
|
Ok((s, ClassNew::Argument(ClassNewArgument { nodes: (a, b, c) })))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_new_expression(s: Span) -> IResult<Span, ClassNew> {
|
pub fn class_new_expression(s: Span) -> IResult<Span, ClassNew> {
|
||||||
let (s, a) = symbol("new")(s)?;
|
let (s, a) = keyword("new")(s)?;
|
||||||
let (s, b) = expression(s)?;
|
let (s, b) = expression(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -356,7 +356,7 @@ pub fn class_new_expression(s: Span) -> IResult<Span, ClassNew> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn dynamic_array_new(s: Span) -> IResult<Span, DynamicArrayNew> {
|
pub fn dynamic_array_new(s: Span) -> IResult<Span, DynamicArrayNew> {
|
||||||
let (s, a) = symbol("new")(s)?;
|
let (s, a) = keyword("new")(s)?;
|
||||||
let (s, b) = bracket(expression)(s)?;
|
let (s, b) = bracket(expression)(s)?;
|
||||||
let (s, c) = opt(paren(expression))(s)?;
|
let (s, c) = opt(paren(expression))(s)?;
|
||||||
Ok((s, DynamicArrayNew { nodes: (a, b, c) }))
|
Ok((s, DynamicArrayNew { nodes: (a, b, c) }))
|
||||||
|
@ -127,6 +127,6 @@ pub fn delay_value(s: Span) -> IResult<Span, DelayValue> {
|
|||||||
map(real_number, |x| DelayValue::RealNumber(x)),
|
map(real_number, |x| DelayValue::RealNumber(x)),
|
||||||
map(ps_identifier, |x| DelayValue::PsIdentifier(x)),
|
map(ps_identifier, |x| DelayValue::PsIdentifier(x)),
|
||||||
map(time_literal, |x| DelayValue::TimeLiteral(x)),
|
map(time_literal, |x| DelayValue::TimeLiteral(x)),
|
||||||
map(symbol("1step"), |x| DelayValue::Step1(x)),
|
map(keyword("1step"), |x| DelayValue::Step1(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ pub fn function_data_type_or_implicit(s: Span) -> IResult<Span, FunctionDataType
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn function_declaration(s: Span) -> IResult<Span, FunctionDeclaration> {
|
pub fn function_declaration(s: Span) -> IResult<Span, FunctionDeclaration> {
|
||||||
let (s, a) = symbol("function")(s)?;
|
let (s, a) = keyword("function")(s)?;
|
||||||
let (s, b) = opt(lifetime)(s)?;
|
let (s, b) = opt(lifetime)(s)?;
|
||||||
let (s, c) = function_body_declaration(s)?;
|
let (s, c) = function_body_declaration(s)?;
|
||||||
Ok((s, FunctionDeclaration { nodes: (a, b, c) }))
|
Ok((s, FunctionDeclaration { nodes: (a, b, c) }))
|
||||||
@ -195,7 +195,7 @@ pub fn function_body_declaration_without_port(s: Span) -> IResult<Span, Function
|
|||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
let (s, e) = many0(tf_item_declaration)(s)?;
|
let (s, e) = many0(tf_item_declaration)(s)?;
|
||||||
let (s, f) = many0(function_statement_or_null)(s)?;
|
let (s, f) = many0(function_statement_or_null)(s)?;
|
||||||
let (s, g) = symbol("endfunction")(s)?;
|
let (s, g) = keyword("endfunction")(s)?;
|
||||||
let (s, h) = opt(pair(symbol(":"), function_identifier))(s)?;
|
let (s, h) = opt(pair(symbol(":"), function_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -214,7 +214,7 @@ pub fn function_body_declaration_with_port(s: Span) -> IResult<Span, FunctionBod
|
|||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
let (s, f) = many0(block_item_declaration)(s)?;
|
let (s, f) = many0(block_item_declaration)(s)?;
|
||||||
let (s, g) = many0(function_statement_or_null)(s)?;
|
let (s, g) = many0(function_statement_or_null)(s)?;
|
||||||
let (s, h) = symbol("endfunction")(s)?;
|
let (s, h) = keyword("endfunction")(s)?;
|
||||||
let (s, i) = opt(pair(symbol(":"), function_identifier))(s)?;
|
let (s, i) = opt(pair(symbol(":"), function_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -240,7 +240,7 @@ pub fn interface_identifier_or_class_scope(
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn function_prototype(s: Span) -> IResult<Span, FunctionPrototype> {
|
pub fn function_prototype(s: Span) -> IResult<Span, FunctionPrototype> {
|
||||||
let (s, a) = symbol("function")(s)?;
|
let (s, a) = keyword("function")(s)?;
|
||||||
let (s, b) = data_type_or_void(s)?;
|
let (s, b) = data_type_or_void(s)?;
|
||||||
let (s, c) = function_identifier(s)?;
|
let (s, c) = function_identifier(s)?;
|
||||||
let (s, d) = opt(paren(opt(tf_port_list)))(s)?;
|
let (s, d) = opt(paren(opt(tf_port_list)))(s)?;
|
||||||
@ -264,7 +264,7 @@ pub fn dpi_import_export(s: Span) -> IResult<Span, DpiImportExport> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn dpi_import_export_import_function(s: Span) -> IResult<Span, DpiImportExport> {
|
pub fn dpi_import_export_import_function(s: Span) -> IResult<Span, DpiImportExport> {
|
||||||
let (s, a) = symbol("import")(s)?;
|
let (s, a) = keyword("import")(s)?;
|
||||||
let (s, b) = dpi_spec_string(s)?;
|
let (s, b) = dpi_spec_string(s)?;
|
||||||
let (s, c) = opt(dpi_function_import_property)(s)?;
|
let (s, c) = opt(dpi_function_import_property)(s)?;
|
||||||
let (s, d) = opt(pair(c_identifier, symbol("=")))(s)?;
|
let (s, d) = opt(pair(c_identifier, symbol("=")))(s)?;
|
||||||
@ -280,7 +280,7 @@ pub fn dpi_import_export_import_function(s: Span) -> IResult<Span, DpiImportExpo
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn dpi_import_export_import_task(s: Span) -> IResult<Span, DpiImportExport> {
|
pub fn dpi_import_export_import_task(s: Span) -> IResult<Span, DpiImportExport> {
|
||||||
let (s, a) = symbol("import")(s)?;
|
let (s, a) = keyword("import")(s)?;
|
||||||
let (s, b) = dpi_spec_string(s)?;
|
let (s, b) = dpi_spec_string(s)?;
|
||||||
let (s, c) = opt(dpi_task_import_property)(s)?;
|
let (s, c) = opt(dpi_task_import_property)(s)?;
|
||||||
let (s, d) = opt(pair(c_identifier, symbol("=")))(s)?;
|
let (s, d) = opt(pair(c_identifier, symbol("=")))(s)?;
|
||||||
@ -296,10 +296,10 @@ pub fn dpi_import_export_import_task(s: Span) -> IResult<Span, DpiImportExport>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn dpi_import_export_export_function(s: Span) -> IResult<Span, DpiImportExport> {
|
pub fn dpi_import_export_export_function(s: Span) -> IResult<Span, DpiImportExport> {
|
||||||
let (s, a) = symbol("export")(s)?;
|
let (s, a) = keyword("export")(s)?;
|
||||||
let (s, b) = dpi_spec_string(s)?;
|
let (s, b) = dpi_spec_string(s)?;
|
||||||
let (s, c) = opt(pair(c_identifier, symbol("=")))(s)?;
|
let (s, c) = opt(pair(c_identifier, symbol("=")))(s)?;
|
||||||
let (s, d) = symbol("function")(s)?;
|
let (s, d) = keyword("function")(s)?;
|
||||||
let (s, e) = function_identifier(s)?;
|
let (s, e) = function_identifier(s)?;
|
||||||
let (s, f) = symbol(";")(s)?;
|
let (s, f) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -312,10 +312,10 @@ pub fn dpi_import_export_export_function(s: Span) -> IResult<Span, DpiImportExpo
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn dpi_import_export_export_task(s: Span) -> IResult<Span, DpiImportExport> {
|
pub fn dpi_import_export_export_task(s: Span) -> IResult<Span, DpiImportExport> {
|
||||||
let (s, a) = symbol("export")(s)?;
|
let (s, a) = keyword("export")(s)?;
|
||||||
let (s, b) = dpi_spec_string(s)?;
|
let (s, b) = dpi_spec_string(s)?;
|
||||||
let (s, c) = opt(pair(c_identifier, symbol("=")))(s)?;
|
let (s, c) = opt(pair(c_identifier, symbol("=")))(s)?;
|
||||||
let (s, d) = symbol("task")(s)?;
|
let (s, d) = keyword("task")(s)?;
|
||||||
let (s, e) = task_identifier(s)?;
|
let (s, e) = task_identifier(s)?;
|
||||||
let (s, f) = symbol(";")(s)?;
|
let (s, f) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -329,22 +329,24 @@ pub fn dpi_import_export_export_task(s: Span) -> IResult<Span, DpiImportExport>
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn dpi_spec_string(s: Span) -> IResult<Span, DpiSpecString> {
|
pub fn dpi_spec_string(s: Span) -> IResult<Span, DpiSpecString> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("DPI-C"), |x| DpiSpecString::DpiC(x)),
|
map(keyword("DPI-C"), |x| DpiSpecString::DpiC(x)),
|
||||||
map(symbol("DPI"), |x| DpiSpecString::Dpi(x)),
|
map(keyword("DPI"), |x| DpiSpecString::Dpi(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn dpi_function_import_property(s: Span) -> IResult<Span, DpiFunctionImportProperty> {
|
pub fn dpi_function_import_property(s: Span) -> IResult<Span, DpiFunctionImportProperty> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("context"), |x| DpiFunctionImportProperty::Context(x)),
|
map(keyword("context"), |x| {
|
||||||
map(symbol("pure"), |x| DpiFunctionImportProperty::Pure(x)),
|
DpiFunctionImportProperty::Context(x)
|
||||||
|
}),
|
||||||
|
map(keyword("pure"), |x| DpiFunctionImportProperty::Pure(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn dpi_task_import_property(s: Span) -> IResult<Span, DpiTaskImportProperty> {
|
pub fn dpi_task_import_property(s: Span) -> IResult<Span, DpiTaskImportProperty> {
|
||||||
let (s, a) = symbol("context")(s)?;
|
let (s, a) = keyword("context")(s)?;
|
||||||
Ok((s, DpiTaskImportProperty::Context(a)))
|
Ok((s, DpiTaskImportProperty::Context(a)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ pub enum ImportExport<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn modport_declaration(s: Span) -> IResult<Span, ModportDeclaration> {
|
pub fn modport_declaration(s: Span) -> IResult<Span, ModportDeclaration> {
|
||||||
let (s, a) = symbol("modport")(s)?;
|
let (s, a) = keyword("modport")(s)?;
|
||||||
let (s, b) = list(symbol(","), modport_item)(s)?;
|
let (s, b) = list(symbol(","), modport_item)(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((s, ModportDeclaration { nodes: (a, b, c) }))
|
Ok((s, ModportDeclaration { nodes: (a, b, c) }))
|
||||||
@ -150,7 +150,7 @@ pub fn modport_ports_declaration_clocking(s: Span) -> IResult<Span, ModportPorts
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn modport_clocking_declaration(s: Span) -> IResult<Span, ModportClockingDeclaration> {
|
pub fn modport_clocking_declaration(s: Span) -> IResult<Span, ModportClockingDeclaration> {
|
||||||
let (s, a) = symbol("clocking")(s)?;
|
let (s, a) = keyword("clocking")(s)?;
|
||||||
let (s, b) = clocking_identifier(s)?;
|
let (s, b) = clocking_identifier(s)?;
|
||||||
Ok((s, ModportClockingDeclaration { nodes: (a, b) }))
|
Ok((s, ModportClockingDeclaration { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ pub fn modport_tf_port(s: Span) -> IResult<Span, ModportTfPort> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn import_export(s: Span) -> IResult<Span, ImportExport> {
|
pub fn import_export(s: Span) -> IResult<Span, ImportExport> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("import"), |x| ImportExport::Import(x)),
|
map(keyword("import"), |x| ImportExport::Import(x)),
|
||||||
map(symbol("export"), |x| ImportExport::Export(x)),
|
map(keyword("export"), |x| ImportExport::Export(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ pub struct LetActualArg<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn let_declaration(s: Span) -> IResult<Span, LetDeclaration> {
|
pub fn let_declaration(s: Span) -> IResult<Span, LetDeclaration> {
|
||||||
let (s, a) = symbol("let")(s)?;
|
let (s, a) = keyword("let")(s)?;
|
||||||
let (s, b) = let_identifier(s)?;
|
let (s, b) = let_identifier(s)?;
|
||||||
let (s, c) = opt(paren(opt(let_port_list)))(s)?;
|
let (s, c) = opt(paren(opt(let_port_list)))(s)?;
|
||||||
let (s, d) = symbol("=")(s)?;
|
let (s, d) = symbol("=")(s)?;
|
||||||
@ -145,7 +145,7 @@ pub fn let_formal_type(s: Span) -> IResult<Span, LetFormalType> {
|
|||||||
map(data_type_or_implicit, |x| {
|
map(data_type_or_implicit, |x| {
|
||||||
LetFormalType::DataTypeOrImplicit(x)
|
LetFormalType::DataTypeOrImplicit(x)
|
||||||
}),
|
}),
|
||||||
map(symbol("untyped"), |x| LetFormalType::Untyped(x)),
|
map(keyword("untyped"), |x| LetFormalType::Untyped(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ pub fn local_parameter_declaration(s: Span) -> IResult<Span, LocalParameterDecla
|
|||||||
|
|
||||||
#[parser(Ambiguous)]
|
#[parser(Ambiguous)]
|
||||||
pub fn local_parameter_declaration_param(s: Span) -> IResult<Span, LocalParameterDeclaration> {
|
pub fn local_parameter_declaration_param(s: Span) -> IResult<Span, LocalParameterDeclaration> {
|
||||||
let (s, a) = symbol("localparam")(s)?;
|
let (s, a) = keyword("localparam")(s)?;
|
||||||
let (s, b) = ambiguous_opt(data_type_or_implicit)(s)?;
|
let (s, b) = ambiguous_opt(data_type_or_implicit)(s)?;
|
||||||
let (s, c) = list_of_param_assignments(s)?;
|
let (s, c) = list_of_param_assignments(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -79,8 +79,8 @@ pub fn local_parameter_declaration_param(s: Span) -> IResult<Span, LocalParamete
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn local_parameter_declaration_type(s: Span) -> IResult<Span, LocalParameterDeclaration> {
|
pub fn local_parameter_declaration_type(s: Span) -> IResult<Span, LocalParameterDeclaration> {
|
||||||
let (s, a) = symbol("localparam")(s)?;
|
let (s, a) = keyword("localparam")(s)?;
|
||||||
let (s, b) = symbol("type")(s)?;
|
let (s, b) = keyword("type")(s)?;
|
||||||
let (s, c) = list_of_type_assignments(s)?;
|
let (s, c) = list_of_type_assignments(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -95,7 +95,7 @@ pub fn parameter_declaration(s: Span) -> IResult<Span, ParameterDeclaration> {
|
|||||||
|
|
||||||
#[parser(Ambiguous)]
|
#[parser(Ambiguous)]
|
||||||
pub fn parameter_declaration_param(s: Span) -> IResult<Span, ParameterDeclaration> {
|
pub fn parameter_declaration_param(s: Span) -> IResult<Span, ParameterDeclaration> {
|
||||||
let (s, a) = symbol("parameter")(s)?;
|
let (s, a) = keyword("parameter")(s)?;
|
||||||
let (s, b) = ambiguous_opt(data_type_or_implicit)(s)?;
|
let (s, b) = ambiguous_opt(data_type_or_implicit)(s)?;
|
||||||
let (s, c) = list_of_param_assignments(s)?;
|
let (s, c) = list_of_param_assignments(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -106,8 +106,8 @@ pub fn parameter_declaration_param(s: Span) -> IResult<Span, ParameterDeclaratio
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn parameter_declaration_type(s: Span) -> IResult<Span, ParameterDeclaration> {
|
pub fn parameter_declaration_type(s: Span) -> IResult<Span, ParameterDeclaration> {
|
||||||
let (s, a) = symbol("parameter")(s)?;
|
let (s, a) = keyword("parameter")(s)?;
|
||||||
let (s, b) = symbol("type")(s)?;
|
let (s, b) = keyword("type")(s)?;
|
||||||
let (s, c) = list_of_type_assignments(s)?;
|
let (s, c) = list_of_type_assignments(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -117,7 +117,7 @@ pub fn parameter_declaration_type(s: Span) -> IResult<Span, ParameterDeclaration
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn specparam_declaration(s: Span) -> IResult<Span, SpecparamDeclaration> {
|
pub fn specparam_declaration(s: Span) -> IResult<Span, SpecparamDeclaration> {
|
||||||
let (s, a) = symbol("specparam")(s)?;
|
let (s, a) = keyword("specparam")(s)?;
|
||||||
let (s, b) = opt(packed_dimension)(s)?;
|
let (s, b) = opt(packed_dimension)(s)?;
|
||||||
let (s, c) = list_of_specparam_assignments(s)?;
|
let (s, c) = list_of_specparam_assignments(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
|
@ -305,8 +305,8 @@ pub fn casting_type(s: Span) -> IResult<Span, CastingType> {
|
|||||||
CastingType::ConstantPrimary(Box::new(x))
|
CastingType::ConstantPrimary(Box::new(x))
|
||||||
}),
|
}),
|
||||||
map(signing, |x| CastingType::Signing(Box::new(x))),
|
map(signing, |x| CastingType::Signing(Box::new(x))),
|
||||||
map(symbol("string"), |x| CastingType::String(x)),
|
map(keyword("string"), |x| CastingType::String(x)),
|
||||||
map(symbol("const"), |x| CastingType::Const(x)),
|
map(keyword("const"), |x| CastingType::Const(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,12 +318,12 @@ pub fn data_type(s: Span) -> IResult<Span, DataType> {
|
|||||||
map(non_integer_type, |x| DataType::NonIntegerType(x)),
|
map(non_integer_type, |x| DataType::NonIntegerType(x)),
|
||||||
data_type_union,
|
data_type_union,
|
||||||
data_type_enum,
|
data_type_enum,
|
||||||
map(symbol("string"), |x| DataType::String(x)),
|
map(keyword("string"), |x| DataType::String(x)),
|
||||||
map(symbol("chandle"), |x| DataType::Chandle(x)),
|
map(keyword("chandle"), |x| DataType::Chandle(x)),
|
||||||
data_type_virtual,
|
data_type_virtual,
|
||||||
data_type_type,
|
data_type_type,
|
||||||
map(class_type, |x| DataType::ClassType(x)),
|
map(class_type, |x| DataType::ClassType(x)),
|
||||||
map(symbol("event"), |x| DataType::Chandle(x)),
|
map(keyword("event"), |x| DataType::Chandle(x)),
|
||||||
map(ps_covergroup_identifier, |x| {
|
map(ps_covergroup_identifier, |x| {
|
||||||
DataType::PsCovergroupIdentifier(x)
|
DataType::PsCovergroupIdentifier(x)
|
||||||
}),
|
}),
|
||||||
@ -362,13 +362,13 @@ pub fn data_type_union(s: Span) -> IResult<Span, DataType> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn packed(s: Span) -> IResult<Span, Packed> {
|
pub fn packed(s: Span) -> IResult<Span, Packed> {
|
||||||
let (s, a) = symbol("packed")(s)?;
|
let (s, a) = keyword("packed")(s)?;
|
||||||
Ok((s, Packed { nodes: (a,) }))
|
Ok((s, Packed { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn data_type_enum(s: Span) -> IResult<Span, DataType> {
|
pub fn data_type_enum(s: Span) -> IResult<Span, DataType> {
|
||||||
let (s, a) = symbol("enum")(s)?;
|
let (s, a) = keyword("enum")(s)?;
|
||||||
let (s, b) = opt(enum_base_type)(s)?;
|
let (s, b) = opt(enum_base_type)(s)?;
|
||||||
let (s, c) = brace(list(symbol(","), enum_name_declaration))(s)?;
|
let (s, c) = brace(list(symbol(","), enum_name_declaration))(s)?;
|
||||||
let (s, d) = many0(packed_dimension)(s)?;
|
let (s, d) = many0(packed_dimension)(s)?;
|
||||||
@ -382,7 +382,7 @@ pub fn data_type_enum(s: Span) -> IResult<Span, DataType> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn data_type_virtual(s: Span) -> IResult<Span, DataType> {
|
pub fn data_type_virtual(s: Span) -> IResult<Span, DataType> {
|
||||||
let (s, a) = symbol("virtual")(s)?;
|
let (s, a) = keyword("virtual")(s)?;
|
||||||
let (s, b) = opt(interface)(s)?;
|
let (s, b) = opt(interface)(s)?;
|
||||||
let (s, c) = interface_identifier(s)?;
|
let (s, c) = interface_identifier(s)?;
|
||||||
let (s, d) = opt(parameter_value_assignment)(s)?;
|
let (s, d) = opt(parameter_value_assignment)(s)?;
|
||||||
@ -397,7 +397,7 @@ pub fn data_type_virtual(s: Span) -> IResult<Span, DataType> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn interface(s: Span) -> IResult<Span, Interface> {
|
pub fn interface(s: Span) -> IResult<Span, Interface> {
|
||||||
let (s, a) = symbol("interface")(s)?;
|
let (s, a) = keyword("interface")(s)?;
|
||||||
Ok((s, Interface { nodes: (a,) }))
|
Ok((s, Interface { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,48 +501,48 @@ pub fn integer_type(s: Span) -> IResult<Span, IntegerType> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn integer_atom_type(s: Span) -> IResult<Span, IntegerAtomType> {
|
pub fn integer_atom_type(s: Span) -> IResult<Span, IntegerAtomType> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("byte"), |x| IntegerAtomType::Byte(x)),
|
map(keyword("byte"), |x| IntegerAtomType::Byte(x)),
|
||||||
map(symbol("shortint"), |x| IntegerAtomType::Shortint(x)),
|
map(keyword("shortint"), |x| IntegerAtomType::Shortint(x)),
|
||||||
map(symbol("int"), |x| IntegerAtomType::Int(x)),
|
map(keyword("int"), |x| IntegerAtomType::Int(x)),
|
||||||
map(symbol("longint"), |x| IntegerAtomType::Longint(x)),
|
map(keyword("longint"), |x| IntegerAtomType::Longint(x)),
|
||||||
map(symbol("integer"), |x| IntegerAtomType::Integer(x)),
|
map(keyword("integer"), |x| IntegerAtomType::Integer(x)),
|
||||||
map(symbol("time"), |x| IntegerAtomType::Time(x)),
|
map(keyword("time"), |x| IntegerAtomType::Time(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn integer_vector_type(s: Span) -> IResult<Span, IntegerVectorType> {
|
pub fn integer_vector_type(s: Span) -> IResult<Span, IntegerVectorType> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("bit"), |x| IntegerVectorType::Bit(x)),
|
map(keyword("bit"), |x| IntegerVectorType::Bit(x)),
|
||||||
map(symbol("logic"), |x| IntegerVectorType::Logic(x)),
|
map(keyword("logic"), |x| IntegerVectorType::Logic(x)),
|
||||||
map(symbol("reg"), |x| IntegerVectorType::Reg(x)),
|
map(keyword("reg"), |x| IntegerVectorType::Reg(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn non_integer_type(s: Span) -> IResult<Span, NonIntegerType> {
|
pub fn non_integer_type(s: Span) -> IResult<Span, NonIntegerType> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("shortreal"), |x| NonIntegerType::Shortreal(x)),
|
map(keyword("shortreal"), |x| NonIntegerType::Shortreal(x)),
|
||||||
map(symbol("realtime"), |x| NonIntegerType::Realtime(x)),
|
map(keyword("realtime"), |x| NonIntegerType::Realtime(x)),
|
||||||
map(symbol("real"), |x| NonIntegerType::Real(x)),
|
map(keyword("real"), |x| NonIntegerType::Real(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn net_type(s: Span) -> IResult<Span, NetType> {
|
pub fn net_type(s: Span) -> IResult<Span, NetType> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("supply0"), |x| NetType::Supply0(x)),
|
map(keyword("supply0"), |x| NetType::Supply0(x)),
|
||||||
map(symbol("supply1"), |x| NetType::Supply1(x)),
|
map(keyword("supply1"), |x| NetType::Supply1(x)),
|
||||||
map(symbol("triand"), |x| NetType::Triand(x)),
|
map(keyword("triand"), |x| NetType::Triand(x)),
|
||||||
map(symbol("trior"), |x| NetType::Trior(x)),
|
map(keyword("trior"), |x| NetType::Trior(x)),
|
||||||
map(symbol("trireg"), |x| NetType::Trireg(x)),
|
map(keyword("trireg"), |x| NetType::Trireg(x)),
|
||||||
map(symbol("tri0"), |x| NetType::Tri0(x)),
|
map(keyword("tri0"), |x| NetType::Tri0(x)),
|
||||||
map(symbol("tri1"), |x| NetType::Tri1(x)),
|
map(keyword("tri1"), |x| NetType::Tri1(x)),
|
||||||
map(symbol("tri"), |x| NetType::Tri(x)),
|
map(keyword("tri"), |x| NetType::Tri(x)),
|
||||||
map(symbol("uwire"), |x| NetType::Uwire(x)),
|
map(keyword("uwire"), |x| NetType::Uwire(x)),
|
||||||
map(symbol("wire"), |x| NetType::Wire(x)),
|
map(keyword("wire"), |x| NetType::Wire(x)),
|
||||||
map(symbol("wand"), |x| NetType::Wand(x)),
|
map(keyword("wand"), |x| NetType::Wand(x)),
|
||||||
map(symbol("wor"), |x| NetType::Wor(x)),
|
map(keyword("wor"), |x| NetType::Wor(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ pub fn net_port_type_data_type(s: Span) -> IResult<Span, NetPortType> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn net_port_type_interconnect(s: Span) -> IResult<Span, NetPortType> {
|
pub fn net_port_type_interconnect(s: Span) -> IResult<Span, NetPortType> {
|
||||||
let (s, a) = symbol("interconnect")(s)?;
|
let (s, a) = keyword("interconnect")(s)?;
|
||||||
let (s, b) = implicit_data_type(s)?;
|
let (s, b) = implicit_data_type(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -591,7 +591,7 @@ pub fn var_data_type(s: Span) -> IResult<Span, VarDataType> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn var_data_type_var(s: Span) -> IResult<Span, VarDataType> {
|
pub fn var_data_type_var(s: Span) -> IResult<Span, VarDataType> {
|
||||||
let (s, a) = symbol("var")(s)?;
|
let (s, a) = keyword("var")(s)?;
|
||||||
let (s, b) = data_type_or_implicit(s)?;
|
let (s, b) = data_type_or_implicit(s)?;
|
||||||
Ok((s, VarDataType::Var(VarDataTypeVar { nodes: (a, b) })))
|
Ok((s, VarDataType::Var(VarDataTypeVar { nodes: (a, b) })))
|
||||||
}
|
}
|
||||||
@ -599,8 +599,8 @@ pub fn var_data_type_var(s: Span) -> IResult<Span, VarDataType> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn signing(s: Span) -> IResult<Span, Signing> {
|
pub fn signing(s: Span) -> IResult<Span, Signing> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("signed"), |x| Signing::Signed(x)),
|
map(keyword("signed"), |x| Signing::Signed(x)),
|
||||||
map(symbol("unsigned"), |x| Signing::Unsigned(x)),
|
map(keyword("unsigned"), |x| Signing::Unsigned(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,18 +635,18 @@ pub fn struct_union_member(s: Span) -> IResult<Span, StructUnionMember> {
|
|||||||
pub fn data_type_or_void(s: Span) -> IResult<Span, DataTypeOrVoid> {
|
pub fn data_type_or_void(s: Span) -> IResult<Span, DataTypeOrVoid> {
|
||||||
alt((
|
alt((
|
||||||
map(data_type, |x| DataTypeOrVoid::DataType(x)),
|
map(data_type, |x| DataTypeOrVoid::DataType(x)),
|
||||||
map(symbol("void"), |x| DataTypeOrVoid::Void(x)),
|
map(keyword("void"), |x| DataTypeOrVoid::Void(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn struct_union(s: Span) -> IResult<Span, StructUnion> {
|
pub fn struct_union(s: Span) -> IResult<Span, StructUnion> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("struct"), |x| StructUnion::Struct(x)),
|
map(keyword("struct"), |x| StructUnion::Struct(x)),
|
||||||
map(pair(symbol("union"), symbol("tagged")), |x| {
|
map(pair(keyword("union"), keyword("tagged")), |x| {
|
||||||
StructUnion::UnionTagged(x)
|
StructUnion::UnionTagged(x)
|
||||||
}),
|
}),
|
||||||
map(symbol("union"), |x| StructUnion::Union(x)),
|
map(keyword("union"), |x| StructUnion::Union(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,7 +657,7 @@ pub fn type_reference(s: Span) -> IResult<Span, TypeReference> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn type_reference_expression(s: Span) -> IResult<Span, TypeReference> {
|
pub fn type_reference_expression(s: Span) -> IResult<Span, TypeReference> {
|
||||||
let (s, a) = symbol("type")(s)?;
|
let (s, a) = keyword("type")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -667,7 +667,7 @@ pub fn type_reference_expression(s: Span) -> IResult<Span, TypeReference> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn type_reference_data_type(s: Span) -> IResult<Span, TypeReference> {
|
pub fn type_reference_data_type(s: Span) -> IResult<Span, TypeReference> {
|
||||||
let (s, a) = symbol("type")(s)?;
|
let (s, a) = keyword("type")(s)?;
|
||||||
let (s, b) = paren(data_type)(s)?;
|
let (s, b) = paren(data_type)(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
|
@ -86,7 +86,7 @@ pub struct RefDeclaration<'a> {
|
|||||||
|
|
||||||
#[parser(Ambiguous)]
|
#[parser(Ambiguous)]
|
||||||
pub fn inout_declaration(s: Span) -> IResult<Span, InoutDeclaration> {
|
pub fn inout_declaration(s: Span) -> IResult<Span, InoutDeclaration> {
|
||||||
let (s, a) = symbol("inout")(s)?;
|
let (s, a) = keyword("inout")(s)?;
|
||||||
let (s, b) = ambiguous_opt(net_port_type)(s)?;
|
let (s, b) = ambiguous_opt(net_port_type)(s)?;
|
||||||
let (s, c) = list_of_port_identifiers(s)?;
|
let (s, c) = list_of_port_identifiers(s)?;
|
||||||
Ok((s, InoutDeclaration { nodes: (a, b, c) }))
|
Ok((s, InoutDeclaration { nodes: (a, b, c) }))
|
||||||
@ -99,7 +99,7 @@ pub fn input_declaration(s: Span) -> IResult<Span, InputDeclaration> {
|
|||||||
|
|
||||||
#[parser(Ambiguous)]
|
#[parser(Ambiguous)]
|
||||||
pub fn input_declaration_net(s: Span) -> IResult<Span, InputDeclaration> {
|
pub fn input_declaration_net(s: Span) -> IResult<Span, InputDeclaration> {
|
||||||
let (s, a) = symbol("input")(s)?;
|
let (s, a) = keyword("input")(s)?;
|
||||||
let (s, b) = ambiguous_opt(net_port_type)(s)?;
|
let (s, b) = ambiguous_opt(net_port_type)(s)?;
|
||||||
let (s, c) = list_of_port_identifiers(s)?;
|
let (s, c) = list_of_port_identifiers(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -108,10 +108,10 @@ pub fn input_declaration_net(s: Span) -> IResult<Span, InputDeclaration> {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser(Ambiguous)]
|
||||||
pub fn input_declaration_variable(s: Span) -> IResult<Span, InputDeclaration> {
|
pub fn input_declaration_variable(s: Span) -> IResult<Span, InputDeclaration> {
|
||||||
let (s, a) = symbol("input")(s)?;
|
let (s, a) = keyword("input")(s)?;
|
||||||
let (s, b) = variable_port_type(s)?;
|
let (s, b) = ambiguous_alt(variable_port_type, implicit_var)(s)?;
|
||||||
let (s, c) = list_of_variable_identifiers(s)?;
|
let (s, c) = list_of_variable_identifiers(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -126,7 +126,7 @@ pub fn output_declaration(s: Span) -> IResult<Span, OutputDeclaration> {
|
|||||||
|
|
||||||
#[parser(Ambiguous)]
|
#[parser(Ambiguous)]
|
||||||
pub fn output_declaration_net(s: Span) -> IResult<Span, OutputDeclaration> {
|
pub fn output_declaration_net(s: Span) -> IResult<Span, OutputDeclaration> {
|
||||||
let (s, a) = symbol("output")(s)?;
|
let (s, a) = keyword("output")(s)?;
|
||||||
let (s, b) = ambiguous_opt(net_port_type)(s)?;
|
let (s, b) = ambiguous_opt(net_port_type)(s)?;
|
||||||
let (s, c) = list_of_port_identifiers(s)?;
|
let (s, c) = list_of_port_identifiers(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -135,10 +135,10 @@ pub fn output_declaration_net(s: Span) -> IResult<Span, OutputDeclaration> {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser(Ambiguous)]
|
||||||
pub fn output_declaration_variable(s: Span) -> IResult<Span, OutputDeclaration> {
|
pub fn output_declaration_variable(s: Span) -> IResult<Span, OutputDeclaration> {
|
||||||
let (s, a) = symbol("output")(s)?;
|
let (s, a) = keyword("output")(s)?;
|
||||||
let (s, b) = variable_port_type(s)?;
|
let (s, b) = ambiguous_alt(variable_port_type, implicit_var)(s)?;
|
||||||
let (s, c) = list_of_variable_identifiers(s)?;
|
let (s, c) = list_of_variable_identifiers(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -154,14 +154,32 @@ pub fn interface_port_declaration(s: Span) -> IResult<Span, InterfacePortDeclara
|
|||||||
Ok((s, InterfacePortDeclaration { nodes: (a, b, c) }))
|
Ok((s, InterfacePortDeclaration { nodes: (a, b, c) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser(Ambiguous)]
|
||||||
pub fn ref_declaration(s: Span) -> IResult<Span, RefDeclaration> {
|
pub fn ref_declaration(s: Span) -> IResult<Span, RefDeclaration> {
|
||||||
let (s, a) = symbol("ref")(s)?;
|
let (s, a) = keyword("ref")(s)?;
|
||||||
let (s, b) = variable_port_type(s)?;
|
let (s, b) = ambiguous_alt(variable_port_type, implicit_var)(s)?;
|
||||||
let (s, c) = list_of_variable_identifiers(s)?;
|
let (s, c) = list_of_variable_identifiers(s)?;
|
||||||
Ok((s, RefDeclaration { nodes: (a, b, c) }))
|
Ok((s, RefDeclaration { nodes: (a, b, c) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[parser]
|
||||||
|
pub fn implicit_var(s: Span) -> IResult<Span, VariablePortType> {
|
||||||
|
let (s, a) = keyword("var")(s)?;
|
||||||
|
Ok((
|
||||||
|
s,
|
||||||
|
VariablePortType {
|
||||||
|
nodes: (VarDataType::Var(VarDataTypeVar {
|
||||||
|
nodes: (
|
||||||
|
a,
|
||||||
|
DataTypeOrImplicit::ImplicitDataType(ImplicitDataType {
|
||||||
|
nodes: (None, vec![]),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
}),),
|
||||||
|
},
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -173,6 +191,5 @@ mod tests {
|
|||||||
parser_test!(inout_declaration, "inout a", Ok((_, _)));
|
parser_test!(inout_declaration, "inout a", Ok((_, _)));
|
||||||
parser_test!(inout_declaration, "inout [7:0] a", Ok((_, _)));
|
parser_test!(inout_declaration, "inout [7:0] a", Ok((_, _)));
|
||||||
parser_test!(inout_declaration, "inout signed [7:0] a", Ok((_, _)));
|
parser_test!(inout_declaration, "inout signed [7:0] a", Ok((_, _)));
|
||||||
parser_test!(inout_declaration, "inout var a", Ok((_, _)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ pub fn drive_strength10(s: Span) -> IResult<Span, DriveStrength> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn drive_strength0z(s: Span) -> IResult<Span, DriveStrength> {
|
pub fn drive_strength0z(s: Span) -> IResult<Span, DriveStrength> {
|
||||||
let (s, a) = paren(triple(strength0, symbol(","), symbol("highz1")))(s)?;
|
let (s, a) = paren(triple(strength0, symbol(","), keyword("highz1")))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
DriveStrength::Strength0z(DriveStrength0z { nodes: (a,) }),
|
DriveStrength::Strength0z(DriveStrength0z { nodes: (a,) }),
|
||||||
@ -127,7 +127,7 @@ pub fn drive_strength0z(s: Span) -> IResult<Span, DriveStrength> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn drive_strength1z(s: Span) -> IResult<Span, DriveStrength> {
|
pub fn drive_strength1z(s: Span) -> IResult<Span, DriveStrength> {
|
||||||
let (s, a) = paren(triple(strength1, symbol(","), symbol("highz0")))(s)?;
|
let (s, a) = paren(triple(strength1, symbol(","), keyword("highz0")))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
DriveStrength::Strength1z(DriveStrength1z { nodes: (a,) }),
|
DriveStrength::Strength1z(DriveStrength1z { nodes: (a,) }),
|
||||||
@ -136,7 +136,7 @@ pub fn drive_strength1z(s: Span) -> IResult<Span, DriveStrength> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn drive_strengthz1(s: Span) -> IResult<Span, DriveStrength> {
|
pub fn drive_strengthz1(s: Span) -> IResult<Span, DriveStrength> {
|
||||||
let (s, a) = paren(triple(symbol("highz0"), symbol(","), strength1))(s)?;
|
let (s, a) = paren(triple(keyword("highz0"), symbol(","), strength1))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
DriveStrength::Strengthz1(DriveStrengthz1 { nodes: (a,) }),
|
DriveStrength::Strengthz1(DriveStrengthz1 { nodes: (a,) }),
|
||||||
@ -145,7 +145,7 @@ pub fn drive_strengthz1(s: Span) -> IResult<Span, DriveStrength> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn drive_strengthz0(s: Span) -> IResult<Span, DriveStrength> {
|
pub fn drive_strengthz0(s: Span) -> IResult<Span, DriveStrength> {
|
||||||
let (s, a) = paren(triple(symbol("highz1"), symbol(","), strength0))(s)?;
|
let (s, a) = paren(triple(keyword("highz1"), symbol(","), strength0))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
DriveStrength::Strengthz0(DriveStrengthz0 { nodes: (a,) }),
|
DriveStrength::Strengthz0(DriveStrengthz0 { nodes: (a,) }),
|
||||||
@ -155,20 +155,20 @@ pub fn drive_strengthz0(s: Span) -> IResult<Span, DriveStrength> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn strength0(s: Span) -> IResult<Span, Strength0> {
|
pub fn strength0(s: Span) -> IResult<Span, Strength0> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("supply0"), |x| Strength0::Supply0(x)),
|
map(keyword("supply0"), |x| Strength0::Supply0(x)),
|
||||||
map(symbol("strong0"), |x| Strength0::Strong0(x)),
|
map(keyword("strong0"), |x| Strength0::Strong0(x)),
|
||||||
map(symbol("pull0"), |x| Strength0::Pull0(x)),
|
map(keyword("pull0"), |x| Strength0::Pull0(x)),
|
||||||
map(symbol("weak0"), |x| Strength0::Weak0(x)),
|
map(keyword("weak0"), |x| Strength0::Weak0(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn strength1(s: Span) -> IResult<Span, Strength1> {
|
pub fn strength1(s: Span) -> IResult<Span, Strength1> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("supply1"), |x| Strength1::Supply1(x)),
|
map(keyword("supply1"), |x| Strength1::Supply1(x)),
|
||||||
map(symbol("strong1"), |x| Strength1::Strong1(x)),
|
map(keyword("strong1"), |x| Strength1::Strong1(x)),
|
||||||
map(symbol("pull1"), |x| Strength1::Pull1(x)),
|
map(keyword("pull1"), |x| Strength1::Pull1(x)),
|
||||||
map(symbol("weak1"), |x| Strength1::Weak1(x)),
|
map(keyword("weak1"), |x| Strength1::Weak1(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ pub fn charge_strength(s: Span) -> IResult<Span, ChargeStrength> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn charge_strength_small(s: Span) -> IResult<Span, ChargeStrength> {
|
pub fn charge_strength_small(s: Span) -> IResult<Span, ChargeStrength> {
|
||||||
let (s, a) = paren(symbol("small"))(s)?;
|
let (s, a) = paren(keyword("small"))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
ChargeStrength::Small(ChargeStrengthSmall { nodes: (a,) }),
|
ChargeStrength::Small(ChargeStrengthSmall { nodes: (a,) }),
|
||||||
@ -192,7 +192,7 @@ pub fn charge_strength_small(s: Span) -> IResult<Span, ChargeStrength> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn charge_strength_medium(s: Span) -> IResult<Span, ChargeStrength> {
|
pub fn charge_strength_medium(s: Span) -> IResult<Span, ChargeStrength> {
|
||||||
let (s, a) = paren(symbol("medium"))(s)?;
|
let (s, a) = paren(keyword("medium"))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
ChargeStrength::Medium(ChargeStrengthMedium { nodes: (a,) }),
|
ChargeStrength::Medium(ChargeStrengthMedium { nodes: (a,) }),
|
||||||
@ -201,7 +201,7 @@ pub fn charge_strength_medium(s: Span) -> IResult<Span, ChargeStrength> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn charge_strength_large(s: Span) -> IResult<Span, ChargeStrength> {
|
pub fn charge_strength_large(s: Span) -> IResult<Span, ChargeStrength> {
|
||||||
let (s, a) = paren(symbol("large"))(s)?;
|
let (s, a) = paren(keyword("large"))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
ChargeStrength::Large(ChargeStrengthLarge { nodes: (a,) }),
|
ChargeStrength::Large(ChargeStrengthLarge { nodes: (a,) }),
|
||||||
|
@ -103,7 +103,7 @@ pub struct TaskPrototype<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn task_declaration(s: Span) -> IResult<Span, TaskDeclaration> {
|
pub fn task_declaration(s: Span) -> IResult<Span, TaskDeclaration> {
|
||||||
let (s, a) = symbol("task")(s)?;
|
let (s, a) = keyword("task")(s)?;
|
||||||
let (s, b) = opt(lifetime)(s)?;
|
let (s, b) = opt(lifetime)(s)?;
|
||||||
let (s, c) = task_body_declaration(s)?;
|
let (s, c) = task_body_declaration(s)?;
|
||||||
Ok((s, TaskDeclaration { nodes: (a, b, c) }))
|
Ok((s, TaskDeclaration { nodes: (a, b, c) }))
|
||||||
@ -124,7 +124,7 @@ pub fn task_body_declaration_without_port(s: Span) -> IResult<Span, TaskBodyDecl
|
|||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
let (s, d) = many0(tf_item_declaration)(s)?;
|
let (s, d) = many0(tf_item_declaration)(s)?;
|
||||||
let (s, e) = many0(statement_or_null)(s)?;
|
let (s, e) = many0(statement_or_null)(s)?;
|
||||||
let (s, f) = symbol("endtask")(s)?;
|
let (s, f) = keyword("endtask")(s)?;
|
||||||
let (s, g) = opt(pair(symbol(":"), task_identifier))(s)?;
|
let (s, g) = opt(pair(symbol(":"), task_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -142,7 +142,7 @@ pub fn task_body_declaration_with_port(s: Span) -> IResult<Span, TaskBodyDeclara
|
|||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
let (s, e) = many0(block_item_declaration)(s)?;
|
let (s, e) = many0(block_item_declaration)(s)?;
|
||||||
let (s, f) = many0(statement_or_null)(s)?;
|
let (s, f) = many0(statement_or_null)(s)?;
|
||||||
let (s, g) = symbol("endtask")(s)?;
|
let (s, g) = keyword("endtask")(s)?;
|
||||||
let (s, h) = opt(pair(symbol(":"), task_identifier))(s)?;
|
let (s, h) = opt(pair(symbol(":"), task_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -193,7 +193,7 @@ pub fn tf_port_item(s: Span) -> IResult<Span, TfPortItem> {
|
|||||||
pub fn tf_port_direction(s: Span) -> IResult<Span, TfPortDirection> {
|
pub fn tf_port_direction(s: Span) -> IResult<Span, TfPortDirection> {
|
||||||
alt((
|
alt((
|
||||||
map(port_direction, |x| TfPortDirection::PortDirection(x)),
|
map(port_direction, |x| TfPortDirection::PortDirection(x)),
|
||||||
map(pair(symbol("const"), symbol("ref")), |x| {
|
map(pair(keyword("const"), keyword("ref")), |x| {
|
||||||
TfPortDirection::ConstRef(x)
|
TfPortDirection::ConstRef(x)
|
||||||
}),
|
}),
|
||||||
))(s)
|
))(s)
|
||||||
@ -217,7 +217,7 @@ pub fn tf_port_declaration(s: Span) -> IResult<Span, TfPortDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn task_prototype(s: Span) -> IResult<Span, TaskPrototype> {
|
pub fn task_prototype(s: Span) -> IResult<Span, TaskPrototype> {
|
||||||
let (s, a) = symbol("task")(s)?;
|
let (s, a) = keyword("task")(s)?;
|
||||||
let (s, b) = task_identifier(s)?;
|
let (s, b) = task_identifier(s)?;
|
||||||
let (s, c) = opt(paren(opt(tf_port_list)))(s)?;
|
let (s, c) = opt(paren(opt(tf_port_list)))(s)?;
|
||||||
Ok((s, TaskPrototype { nodes: (a, b, c) }))
|
Ok((s, TaskPrototype { nodes: (a, b, c) }))
|
||||||
|
@ -173,7 +173,7 @@ pub struct TypeDeclarationInterface<'a> {
|
|||||||
pub struct TypeDeclarationReserved<'a> {
|
pub struct TypeDeclarationReserved<'a> {
|
||||||
pub nodes: (
|
pub nodes: (
|
||||||
Symbol<'a>,
|
Symbol<'a>,
|
||||||
TypeDeclarationKeyword<'a>,
|
Option<TypeDeclarationKeyword<'a>>,
|
||||||
TypeIdentifier<'a>,
|
TypeIdentifier<'a>,
|
||||||
Symbol<'a>,
|
Symbol<'a>,
|
||||||
),
|
),
|
||||||
@ -260,13 +260,13 @@ pub fn data_declaration_variable(s: Span) -> IResult<Span, DataDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn r#const(s: Span) -> IResult<Span, Const> {
|
pub fn r#const(s: Span) -> IResult<Span, Const> {
|
||||||
let (s, a) = symbol("const")(s)?;
|
let (s, a) = keyword("const")(s)?;
|
||||||
Ok((s, Const { nodes: (a,) }))
|
Ok((s, Const { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn package_import_declaration(s: Span) -> IResult<Span, PackageImportDeclaration> {
|
pub fn package_import_declaration(s: Span) -> IResult<Span, PackageImportDeclaration> {
|
||||||
let (s, a) = symbol("import")(s)?;
|
let (s, a) = keyword("import")(s)?;
|
||||||
let (s, b) = list(symbol(","), package_import_item)(s)?;
|
let (s, b) = list(symbol(","), package_import_item)(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((s, PackageImportDeclaration { nodes: (a, b, c) }))
|
Ok((s, PackageImportDeclaration { nodes: (a, b, c) }))
|
||||||
@ -309,7 +309,7 @@ pub fn package_export_declaration(s: Span) -> IResult<Span, PackageExportDeclara
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn package_export_declaration_asterisk(s: Span) -> IResult<Span, PackageExportDeclaration> {
|
pub fn package_export_declaration_asterisk(s: Span) -> IResult<Span, PackageExportDeclaration> {
|
||||||
let (s, a) = symbol("export")(s)?;
|
let (s, a) = keyword("export")(s)?;
|
||||||
let (s, b) = symbol("*::*")(s)?;
|
let (s, b) = symbol("*::*")(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -320,7 +320,7 @@ pub fn package_export_declaration_asterisk(s: Span) -> IResult<Span, PackageExpo
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn package_export_declaration_item(s: Span) -> IResult<Span, PackageExportDeclaration> {
|
pub fn package_export_declaration_item(s: Span) -> IResult<Span, PackageExportDeclaration> {
|
||||||
let (s, a) = symbol("export")(s)?;
|
let (s, a) = keyword("export")(s)?;
|
||||||
let (s, b) = list(symbol(","), package_import_item)(s)?;
|
let (s, b) = list(symbol(","), package_import_item)(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -331,7 +331,7 @@ pub fn package_export_declaration_item(s: Span) -> IResult<Span, PackageExportDe
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn genvar_declaration(s: Span) -> IResult<Span, GenvarDeclaration> {
|
pub fn genvar_declaration(s: Span) -> IResult<Span, GenvarDeclaration> {
|
||||||
let (s, a) = symbol("genvar")(s)?;
|
let (s, a) = keyword("genvar")(s)?;
|
||||||
let (s, b) = list_of_genvar_identifiers(s)?;
|
let (s, b) = list_of_genvar_identifiers(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((s, GenvarDeclaration { nodes: (a, b, c) }))
|
Ok((s, GenvarDeclaration { nodes: (a, b, c) }))
|
||||||
@ -374,8 +374,8 @@ pub fn strength(s: Span) -> IResult<Span, Strength> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn vector_scalar(s: Span) -> IResult<Span, VectorScalar> {
|
pub fn vector_scalar(s: Span) -> IResult<Span, VectorScalar> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("vectored"), |x| VectorScalar::Vectored(x)),
|
map(keyword("vectored"), |x| VectorScalar::Vectored(x)),
|
||||||
map(symbol("scalared"), |x| VectorScalar::Scalared(x)),
|
map(keyword("scalared"), |x| VectorScalar::Scalared(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ pub fn net_declaration_net_type_identifier(s: Span) -> IResult<Span, NetDeclarat
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn net_declaration_interconnect(s: Span) -> IResult<Span, NetDeclaration> {
|
pub fn net_declaration_interconnect(s: Span) -> IResult<Span, NetDeclaration> {
|
||||||
let (s, a) = symbol("interconnect")(s)?;
|
let (s, a) = keyword("interconnect")(s)?;
|
||||||
let (s, b) = implicit_data_type(s)?;
|
let (s, b) = implicit_data_type(s)?;
|
||||||
let (s, c) = opt(pair(symbol("#"), delay_value))(s)?;
|
let (s, c) = opt(pair(symbol("#"), delay_value))(s)?;
|
||||||
let (s, d) = net_identifier(s)?;
|
let (s, d) = net_identifier(s)?;
|
||||||
@ -425,7 +425,7 @@ pub fn type_declaration(s: Span) -> IResult<Span, TypeDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn type_declaration_data_type(s: Span) -> IResult<Span, TypeDeclaration> {
|
pub fn type_declaration_data_type(s: Span) -> IResult<Span, TypeDeclaration> {
|
||||||
let (s, a) = symbol("typedef")(s)?;
|
let (s, a) = keyword("typedef")(s)?;
|
||||||
let (s, b) = data_type(s)?;
|
let (s, b) = data_type(s)?;
|
||||||
let (s, c) = type_identifier(s)?;
|
let (s, c) = type_identifier(s)?;
|
||||||
let (s, d) = many0(variable_dimension)(s)?;
|
let (s, d) = many0(variable_dimension)(s)?;
|
||||||
@ -440,7 +440,7 @@ pub fn type_declaration_data_type(s: Span) -> IResult<Span, TypeDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn type_declaration_interface(s: Span) -> IResult<Span, TypeDeclaration> {
|
pub fn type_declaration_interface(s: Span) -> IResult<Span, TypeDeclaration> {
|
||||||
let (s, a) = symbol("typedef")(s)?;
|
let (s, a) = keyword("typedef")(s)?;
|
||||||
let (s, b) = interface_instance_identifier(s)?;
|
let (s, b) = interface_instance_identifier(s)?;
|
||||||
let (s, c) = constant_bit_select(s)?;
|
let (s, c) = constant_bit_select(s)?;
|
||||||
let (s, d) = symbol(".")(s)?;
|
let (s, d) = symbol(".")(s)?;
|
||||||
@ -457,8 +457,8 @@ pub fn type_declaration_interface(s: Span) -> IResult<Span, TypeDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn type_declaration_reserved(s: Span) -> IResult<Span, TypeDeclaration> {
|
pub fn type_declaration_reserved(s: Span) -> IResult<Span, TypeDeclaration> {
|
||||||
let (s, a) = symbol("typedef")(s)?;
|
let (s, a) = keyword("typedef")(s)?;
|
||||||
let (s, b) = type_declaration_keyword(s)?;
|
let (s, b) = opt(type_declaration_keyword)(s)?;
|
||||||
let (s, c) = type_identifier(s)?;
|
let (s, c) = type_identifier(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -472,11 +472,11 @@ pub fn type_declaration_reserved(s: Span) -> IResult<Span, TypeDeclaration> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn type_declaration_keyword(s: Span) -> IResult<Span, TypeDeclarationKeyword> {
|
pub fn type_declaration_keyword(s: Span) -> IResult<Span, TypeDeclarationKeyword> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("enum"), |x| TypeDeclarationKeyword::Enum(x)),
|
map(keyword("enum"), |x| TypeDeclarationKeyword::Enum(x)),
|
||||||
map(symbol("struct"), |x| TypeDeclarationKeyword::Struct(x)),
|
map(keyword("struct"), |x| TypeDeclarationKeyword::Struct(x)),
|
||||||
map(symbol("union"), |x| TypeDeclarationKeyword::Union(x)),
|
map(keyword("union"), |x| TypeDeclarationKeyword::Union(x)),
|
||||||
map(symbol("class"), |x| TypeDeclarationKeyword::Class(x)),
|
map(keyword("class"), |x| TypeDeclarationKeyword::Class(x)),
|
||||||
map(pair(symbol("interface"), symbol("class")), |x| {
|
map(pair(keyword("interface"), keyword("class")), |x| {
|
||||||
TypeDeclarationKeyword::InterfaceClass(x)
|
TypeDeclarationKeyword::InterfaceClass(x)
|
||||||
}),
|
}),
|
||||||
))(s)
|
))(s)
|
||||||
@ -492,11 +492,11 @@ pub fn net_type_declaration(s: Span) -> IResult<Span, NetTypeDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn net_type_declaration_data_type(s: Span) -> IResult<Span, NetTypeDeclaration> {
|
pub fn net_type_declaration_data_type(s: Span) -> IResult<Span, NetTypeDeclaration> {
|
||||||
let (s, a) = symbol("nettype")(s)?;
|
let (s, a) = keyword("nettype")(s)?;
|
||||||
let (s, b) = data_type(s)?;
|
let (s, b) = data_type(s)?;
|
||||||
let (s, c) = net_type_identifier(s)?;
|
let (s, c) = net_type_identifier(s)?;
|
||||||
let (s, d) = opt(triple(
|
let (s, d) = opt(triple(
|
||||||
symbol("with"),
|
keyword("with"),
|
||||||
opt(package_scope_or_class_scope),
|
opt(package_scope_or_class_scope),
|
||||||
tf_identifier,
|
tf_identifier,
|
||||||
))(s)?;
|
))(s)?;
|
||||||
@ -511,7 +511,7 @@ pub fn net_type_declaration_data_type(s: Span) -> IResult<Span, NetTypeDeclarati
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn net_type_declaration_net_type(s: Span) -> IResult<Span, NetTypeDeclaration> {
|
pub fn net_type_declaration_net_type(s: Span) -> IResult<Span, NetTypeDeclaration> {
|
||||||
let (s, a) = symbol("nettype")(s)?;
|
let (s, a) = keyword("nettype")(s)?;
|
||||||
let (s, b) = opt(package_scope_or_class_scope)(s)?;
|
let (s, b) = opt(package_scope_or_class_scope)(s)?;
|
||||||
let (s, c) = net_type_identifier(s)?;
|
let (s, c) = net_type_identifier(s)?;
|
||||||
let (s, d) = net_type_identifier(s)?;
|
let (s, d) = net_type_identifier(s)?;
|
||||||
@ -527,8 +527,8 @@ pub fn net_type_declaration_net_type(s: Span) -> IResult<Span, NetTypeDeclaratio
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn lifetime(s: Span) -> IResult<Span, Lifetime> {
|
pub fn lifetime(s: Span) -> IResult<Span, Lifetime> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("static"), |x| Lifetime::Static(x)),
|
map(keyword("static"), |x| Lifetime::Static(x)),
|
||||||
map(symbol("automatic"), |x| Lifetime::Automatic(x)),
|
map(keyword("automatic"), |x| Lifetime::Automatic(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,5 +601,189 @@ mod tests {
|
|||||||
);
|
);
|
||||||
parser_test!(net_declaration, "interconnect logic [3:0] w4;", Err(_));
|
parser_test!(net_declaration, "interconnect logic [3:0] w4;", Err(_));
|
||||||
parser_test!(net_declaration, "interconnect #(1,2,3) w5;", Err(_));
|
parser_test!(net_declaration, "interconnect #(1,2,3) w5;", Err(_));
|
||||||
|
parser_test!(
|
||||||
|
net_declaration,
|
||||||
|
"wand w;",
|
||||||
|
Ok((_, NetDeclaration::NetType(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
net_declaration,
|
||||||
|
"tri [15:0] busa;",
|
||||||
|
Ok((_, NetDeclaration::NetType(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
net_declaration,
|
||||||
|
"trireg (small) storeit;",
|
||||||
|
Ok((_, NetDeclaration::NetType(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
net_declaration,
|
||||||
|
"wire w1, w2;",
|
||||||
|
Ok((_, NetDeclaration::NetType(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
net_declaration,
|
||||||
|
"tri1 scalared [63:0] bus64;",
|
||||||
|
Ok((_, NetDeclaration::NetType(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
net_declaration,
|
||||||
|
"tri vectored [31:0] data;",
|
||||||
|
Ok((_, NetDeclaration::NetType(_)))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_data_declaration() {
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"shortint s1, s2[0:9];",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"var byte my_byte;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"var v;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"var [15:0] vw;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"var enum bit { clear, error } status;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"var reg r;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"int i = 0;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"logic a;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"logic[3:0] v;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"logic signed [3:0] signed_reg;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"logic [-1:4] b;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"logic [4:0] x, y, z;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"int unsigned ui;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"int signed si;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"string myName = default_name;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"byte c = \"A\";",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"bit [10:0] b = \"x41\";",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"bit [1:4][7:0] h = \"hello\" ;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"event done;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"event done_too = done;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"event empty = null;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"typedef int intP;",
|
||||||
|
Ok((_, DataDeclaration::TypeDeclaration(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"intP a, b;",
|
||||||
|
Ok((_, DataDeclaration::Variable(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"typedef enum type_identifier;",
|
||||||
|
Ok((_, DataDeclaration::TypeDeclaration(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"typedef struct type_identifier;",
|
||||||
|
Ok((_, DataDeclaration::TypeDeclaration(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"typedef union type_identifier;",
|
||||||
|
Ok((_, DataDeclaration::TypeDeclaration(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"typedef class type_identifier;",
|
||||||
|
Ok((_, DataDeclaration::TypeDeclaration(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"typedef interface class type_identifier;",
|
||||||
|
Ok((_, DataDeclaration::TypeDeclaration(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"typedef type_identifier;",
|
||||||
|
Ok((_, DataDeclaration::TypeDeclaration(_)))
|
||||||
|
);
|
||||||
|
parser_test!(
|
||||||
|
data_declaration,
|
||||||
|
"typedef C::T c_t;",
|
||||||
|
Ok((_, DataDeclaration::TypeDeclaration(_)))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ pub fn stream_concatenation(s: Span) -> IResult<Span, StreamConcatenation> {
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn stream_expression(s: Span) -> IResult<Span, StreamExpression> {
|
pub fn stream_expression(s: Span) -> IResult<Span, StreamExpression> {
|
||||||
let (s, a) = expression(s)?;
|
let (s, a) = expression(s)?;
|
||||||
let (s, b) = opt(pair(symbol("with"), bracket(array_range_expression)))(s)?;
|
let (s, b) = opt(pair(keyword("with"), bracket(array_range_expression)))(s)?;
|
||||||
Ok((s, StreamExpression { nodes: (a, b) }))
|
Ok((s, StreamExpression { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ pub fn expression_binary(s: Span) -> IResult<Span, Expression> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn tagged_union_expression(s: Span) -> IResult<Span, TaggedUnionExpression> {
|
pub fn tagged_union_expression(s: Span) -> IResult<Span, TaggedUnionExpression> {
|
||||||
let (s, a) = symbol("tagged")(s)?;
|
let (s, a) = keyword("tagged")(s)?;
|
||||||
let (s, b) = member_identifier(s)?;
|
let (s, b) = member_identifier(s)?;
|
||||||
let (s, c) = opt(expression)(s)?;
|
let (s, c) = opt(expression)(s)?;
|
||||||
Ok((s, TaggedUnionExpression { nodes: (a, b, c) }))
|
Ok((s, TaggedUnionExpression { nodes: (a, b, c) }))
|
||||||
@ -531,7 +531,7 @@ pub fn tagged_union_expression(s: Span) -> IResult<Span, TaggedUnionExpression>
|
|||||||
#[parser(MaybeRecursive)]
|
#[parser(MaybeRecursive)]
|
||||||
pub fn inside_expression(s: Span) -> IResult<Span, InsideExpression> {
|
pub fn inside_expression(s: Span) -> IResult<Span, InsideExpression> {
|
||||||
let (s, a) = expression(s)?;
|
let (s, a) = expression(s)?;
|
||||||
let (s, b) = symbol("inside")(s)?;
|
let (s, b) = keyword("inside")(s)?;
|
||||||
let (s, c) = brace(open_range_list)(s)?;
|
let (s, c) = brace(open_range_list)(s)?;
|
||||||
Ok((s, InsideExpression { nodes: (a, b, c) }))
|
Ok((s, InsideExpression { nodes: (a, b, c) }))
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ pub struct Cast<'a> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
|
pub fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("null"), |x| ConstantPrimary::Null(x)),
|
map(keyword("null"), |x| ConstantPrimary::Null(x)),
|
||||||
map(primary_literal, |x| ConstantPrimary::PrimaryLiteral(x)),
|
map(primary_literal, |x| ConstantPrimary::PrimaryLiteral(x)),
|
||||||
constant_primary_ps_parameter,
|
constant_primary_ps_parameter,
|
||||||
constant_primary_specparam,
|
constant_primary_specparam,
|
||||||
@ -389,9 +389,9 @@ pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult<Span, Module
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn primary(s: Span) -> IResult<Span, Primary> {
|
pub fn primary(s: Span) -> IResult<Span, Primary> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("this"), |x| Primary::This(x)),
|
map(keyword("this"), |x| Primary::This(x)),
|
||||||
map(symbol("$"), |x| Primary::Dollar(x)),
|
map(symbol("$"), |x| Primary::Dollar(x)),
|
||||||
map(symbol("null"), |x| Primary::Null(x)),
|
map(keyword("null"), |x| Primary::Null(x)),
|
||||||
map(primary_literal, |x| Primary::PrimaryLiteral(x)),
|
map(primary_literal, |x| Primary::PrimaryLiteral(x)),
|
||||||
primary_hierarchical,
|
primary_hierarchical,
|
||||||
map(empty_unpacked_array_concatenation, |x| {
|
map(empty_unpacked_array_concatenation, |x| {
|
||||||
@ -521,12 +521,12 @@ pub fn time_literal_fixed_point(s: Span) -> IResult<Span, TimeLiteral> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn time_unit(s: Span) -> IResult<Span, TimeUnit> {
|
pub fn time_unit(s: Span) -> IResult<Span, TimeUnit> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("s"), |x| TimeUnit::S(x)),
|
map(keyword("s"), |x| TimeUnit::S(x)),
|
||||||
map(symbol("ms"), |x| TimeUnit::MS(x)),
|
map(keyword("ms"), |x| TimeUnit::MS(x)),
|
||||||
map(symbol("us"), |x| TimeUnit::US(x)),
|
map(keyword("us"), |x| TimeUnit::US(x)),
|
||||||
map(symbol("ns"), |x| TimeUnit::NS(x)),
|
map(keyword("ns"), |x| TimeUnit::NS(x)),
|
||||||
map(symbol("ps"), |x| TimeUnit::PS(x)),
|
map(keyword("ps"), |x| TimeUnit::PS(x)),
|
||||||
map(symbol("fs"), |x| TimeUnit::FS(x)),
|
map(keyword("fs"), |x| TimeUnit::FS(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,11 +534,11 @@ pub fn time_unit(s: Span) -> IResult<Span, TimeUnit> {
|
|||||||
pub fn implicit_class_handle(s: Span) -> IResult<Span, ImplicitClassHandle> {
|
pub fn implicit_class_handle(s: Span) -> IResult<Span, ImplicitClassHandle> {
|
||||||
alt((
|
alt((
|
||||||
map(
|
map(
|
||||||
triple(symbol("this"), symbol("."), symbol("super")),
|
triple(keyword("this"), symbol("."), keyword("super")),
|
||||||
|(x, y, z)| ImplicitClassHandle::ThisSuper((x, y, z)),
|
|(x, y, z)| ImplicitClassHandle::ThisSuper((x, y, z)),
|
||||||
),
|
),
|
||||||
map(symbol("this"), |x| ImplicitClassHandle::This(x)),
|
map(keyword("this"), |x| ImplicitClassHandle::This(x)),
|
||||||
map(symbol("super"), |x| ImplicitClassHandle::Super(x)),
|
map(keyword("super"), |x| ImplicitClassHandle::Super(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ pub fn subroutine_call(s: Span) -> IResult<Span, SubroutineCall> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn subroutine_call_randomize(s: Span) -> IResult<Span, SubroutineCall> {
|
pub fn subroutine_call_randomize(s: Span) -> IResult<Span, SubroutineCall> {
|
||||||
let (s, a) = opt(pair(symbol("std"), symbol("::")))(s)?;
|
let (s, a) = opt(pair(keyword("std"), symbol("::")))(s)?;
|
||||||
let (s, b) = randomize_call(s)?;
|
let (s, b) = randomize_call(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -351,7 +351,7 @@ pub fn array_manipulation_call(s: Span) -> IResult<Span, ArrayManipulationCall>
|
|||||||
let (s, a) = array_method_name(s)?;
|
let (s, a) = array_method_name(s)?;
|
||||||
let (s, b) = many0(attribute_instance)(s)?;
|
let (s, b) = many0(attribute_instance)(s)?;
|
||||||
let (s, c) = opt(paren(list_of_arguments))(s)?;
|
let (s, c) = opt(paren(list_of_arguments))(s)?;
|
||||||
let (s, d) = opt(pair(symbol("with"), paren(expression)))(s)?;
|
let (s, d) = opt(pair(keyword("with"), paren(expression)))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
ArrayManipulationCall {
|
ArrayManipulationCall {
|
||||||
@ -362,11 +362,11 @@ pub fn array_manipulation_call(s: Span) -> IResult<Span, ArrayManipulationCall>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn randomize_call(s: Span) -> IResult<Span, RandomizeCall> {
|
pub fn randomize_call(s: Span) -> IResult<Span, RandomizeCall> {
|
||||||
let (s, a) = symbol("randomize")(s)?;
|
let (s, a) = keyword("randomize")(s)?;
|
||||||
let (s, b) = many0(attribute_instance)(s)?;
|
let (s, b) = many0(attribute_instance)(s)?;
|
||||||
let (s, c) = opt(paren(opt(variable_identifier_list_or_null)))(s)?;
|
let (s, c) = opt(paren(opt(variable_identifier_list_or_null)))(s)?;
|
||||||
let (s, d) = opt(triple(
|
let (s, d) = opt(triple(
|
||||||
symbol("with"),
|
keyword("with"),
|
||||||
opt(paren(opt(identifier_list))),
|
opt(paren(opt(identifier_list))),
|
||||||
constraint_block,
|
constraint_block,
|
||||||
))(s)?;
|
))(s)?;
|
||||||
@ -384,7 +384,7 @@ pub fn variable_identifier_list_or_null(s: Span) -> IResult<Span, VariableIdenti
|
|||||||
map(variable_identifier_list, |x| {
|
map(variable_identifier_list, |x| {
|
||||||
VariableIdentifierListOrNull::VariableIdentifierList(x)
|
VariableIdentifierListOrNull::VariableIdentifierList(x)
|
||||||
}),
|
}),
|
||||||
map(symbol("null"), |x| VariableIdentifierListOrNull::Null(x)),
|
map(keyword("null"), |x| VariableIdentifierListOrNull::Null(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,10 +401,10 @@ pub fn method_call_root(s: Span) -> IResult<Span, MethodCallRoot> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn array_method_name(s: Span) -> IResult<Span, ArrayMethodName> {
|
pub fn array_method_name(s: Span) -> IResult<Span, ArrayMethodName> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("unique"), |x| ArrayMethodName::Unique(x)),
|
map(keyword("unique"), |x| ArrayMethodName::Unique(x)),
|
||||||
map(symbol("and"), |x| ArrayMethodName::And(x)),
|
map(keyword("and"), |x| ArrayMethodName::And(x)),
|
||||||
map(symbol("or"), |x| ArrayMethodName::Or(x)),
|
map(keyword("or"), |x| ArrayMethodName::Or(x)),
|
||||||
map(symbol("xor"), |x| ArrayMethodName::Xor(x)),
|
map(keyword("xor"), |x| ArrayMethodName::Xor(x)),
|
||||||
map(method_identifier, |x| ArrayMethodName::MethodIdentifier(x)),
|
map(method_identifier, |x| ArrayMethodName::MethodIdentifier(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
@ -3,15 +3,16 @@ use crate::parser::*;
|
|||||||
use nom::branch::*;
|
use nom::branch::*;
|
||||||
use nom::bytes::complete::*;
|
use nom::bytes::complete::*;
|
||||||
use nom::combinator::*;
|
use nom::combinator::*;
|
||||||
|
use nom::error::*;
|
||||||
use nom::multi::*;
|
use nom::multi::*;
|
||||||
use nom::sequence::*;
|
use nom::sequence::*;
|
||||||
use nom::IResult;
|
use nom::{Err, IResult};
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
const AZ_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
|
pub const AZ_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
|
||||||
const AZ09_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
|
pub const AZ09_: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
|
||||||
const AZ09_DOLLAR: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$";
|
pub const AZ09_DOLLAR: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$";
|
||||||
|
|
||||||
#[derive(Debug, Node)]
|
#[derive(Debug, Node)]
|
||||||
pub struct ArrayIdentifier<'a> {
|
pub struct ArrayIdentifier<'a> {
|
||||||
@ -577,7 +578,11 @@ pub fn c_identifier_impl(s: Span) -> IResult<Span, Span> {
|
|||||||
} else {
|
} else {
|
||||||
a
|
a
|
||||||
};
|
};
|
||||||
|
if is_keyword(&a) {
|
||||||
|
Err(Err::Error(make_error(s, ErrorKind::Fix)))
|
||||||
|
} else {
|
||||||
Ok((s, a))
|
Ok((s, a))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
@ -736,7 +741,7 @@ pub fn hierarchical_identifier(s: Span) -> IResult<Span, HierarchicalIdentifier>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn root(s: Span) -> IResult<Span, Root> {
|
pub fn root(s: Span) -> IResult<Span, Root> {
|
||||||
let (s, a) = symbol("$root")(s)?;
|
let (s, a) = keyword("$root")(s)?;
|
||||||
let (s, b) = symbol(".")(s)?;
|
let (s, b) = symbol(".")(s)?;
|
||||||
Ok((s, Root { nodes: (a, b) }))
|
Ok((s, Root { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
@ -900,7 +905,7 @@ pub fn package_scope_package(s: Span) -> IResult<Span, PackageScope> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn unit(s: Span) -> IResult<Span, Unit> {
|
pub fn unit(s: Span) -> IResult<Span, Unit> {
|
||||||
let (s, a) = symbol("$unit")(s)?;
|
let (s, a) = keyword("$unit")(s)?;
|
||||||
let (s, b) = symbol("::")(s)?;
|
let (s, b) = symbol("::")(s)?;
|
||||||
Ok((s, Unit { nodes: (a, b) }))
|
Ok((s, Unit { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
@ -1138,7 +1143,11 @@ pub fn simple_identifier_impl(s: Span) -> IResult<Span, Span> {
|
|||||||
} else {
|
} else {
|
||||||
a
|
a
|
||||||
};
|
};
|
||||||
|
if is_keyword(&a) {
|
||||||
|
Err(Err::Error(make_error(s, ErrorKind::Fix)))
|
||||||
|
} else {
|
||||||
Ok((s, a))
|
Ok((s, a))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
@ -1273,7 +1282,7 @@ pub fn local_or_package_scope_or_class_scope(
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn local(s: Span) -> IResult<Span, Local> {
|
pub fn local(s: Span) -> IResult<Span, Local> {
|
||||||
let (s, a) = symbol("local")(s)?;
|
let (s, a) = keyword("local")(s)?;
|
||||||
let (s, b) = symbol("::")(s)?;
|
let (s, b) = symbol("::")(s)?;
|
||||||
Ok((s, Local { nodes: (a, b) }))
|
Ok((s, Local { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
|
@ -147,15 +147,15 @@ pub enum GenerateItem<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn generate_region(s: Span) -> IResult<Span, GenerateRegion> {
|
pub fn generate_region(s: Span) -> IResult<Span, GenerateRegion> {
|
||||||
let (s, a) = symbol("generate")(s)?;
|
let (s, a) = keyword("generate")(s)?;
|
||||||
let (s, b) = many0(generate_item)(s)?;
|
let (s, b) = many0(generate_item)(s)?;
|
||||||
let (s, c) = symbol("endgenerate")(s)?;
|
let (s, c) = keyword("endgenerate")(s)?;
|
||||||
Ok((s, GenerateRegion { nodes: (a, b, c) }))
|
Ok((s, GenerateRegion { nodes: (a, b, c) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn loop_generate_construct(s: Span) -> IResult<Span, LoopGenerateConstruct> {
|
pub fn loop_generate_construct(s: Span) -> IResult<Span, LoopGenerateConstruct> {
|
||||||
let (s, a) = symbol("for")(s)?;
|
let (s, a) = keyword("for")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
generate_initialization,
|
generate_initialization,
|
||||||
symbol(";"),
|
symbol(";"),
|
||||||
@ -169,7 +169,7 @@ pub fn loop_generate_construct(s: Span) -> IResult<Span, LoopGenerateConstruct>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn generate_initialization(s: Span) -> IResult<Span, GenvarInitialization> {
|
pub fn generate_initialization(s: Span) -> IResult<Span, GenvarInitialization> {
|
||||||
let (s, a) = opt(map(symbol("genvar"), |x| Genvar { nodes: (x,) }))(s)?;
|
let (s, a) = opt(map(keyword("genvar"), |x| Genvar { nodes: (x,) }))(s)?;
|
||||||
let (s, b) = genvar_identifier(s)?;
|
let (s, b) = genvar_identifier(s)?;
|
||||||
let (s, c) = symbol("=")(s)?;
|
let (s, c) = symbol("=")(s)?;
|
||||||
let (s, d) = constant_expression(s)?;
|
let (s, d) = constant_expression(s)?;
|
||||||
@ -235,10 +235,10 @@ pub fn conditional_generate_construct(s: Span) -> IResult<Span, ConditionalGener
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn if_generate_construct(s: Span) -> IResult<Span, IfGenerateConstruct> {
|
pub fn if_generate_construct(s: Span) -> IResult<Span, IfGenerateConstruct> {
|
||||||
let (s, a) = symbol("if")(s)?;
|
let (s, a) = keyword("if")(s)?;
|
||||||
let (s, b) = paren(constant_expression)(s)?;
|
let (s, b) = paren(constant_expression)(s)?;
|
||||||
let (s, c) = generate_block(s)?;
|
let (s, c) = generate_block(s)?;
|
||||||
let (s, d) = opt(pair(symbol("else"), generate_block))(s)?;
|
let (s, d) = opt(pair(keyword("else"), generate_block))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
IfGenerateConstruct {
|
IfGenerateConstruct {
|
||||||
@ -249,10 +249,10 @@ pub fn if_generate_construct(s: Span) -> IResult<Span, IfGenerateConstruct> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn case_generate_construct(s: Span) -> IResult<Span, CaseGenerateConstruct> {
|
pub fn case_generate_construct(s: Span) -> IResult<Span, CaseGenerateConstruct> {
|
||||||
let (s, a) = symbol("case")(s)?;
|
let (s, a) = keyword("case")(s)?;
|
||||||
let (s, b) = paren(constant_expression)(s)?;
|
let (s, b) = paren(constant_expression)(s)?;
|
||||||
let (s, c) = many1(case_generate_item)(s)?;
|
let (s, c) = many1(case_generate_item)(s)?;
|
||||||
let (s, d) = symbol("endcase")(s)?;
|
let (s, d) = keyword("endcase")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
CaseGenerateConstruct {
|
CaseGenerateConstruct {
|
||||||
@ -279,7 +279,7 @@ pub fn case_generate_item_nondefault(s: Span) -> IResult<Span, CaseGenerateItem>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn case_generate_item_default(s: Span) -> IResult<Span, CaseGenerateItem> {
|
pub fn case_generate_item_default(s: Span) -> IResult<Span, CaseGenerateItem> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
let (s, b) = opt(symbol(":"))(s)?;
|
let (s, b) = opt(symbol(":"))(s)?;
|
||||||
let (s, c) = generate_block(s)?;
|
let (s, c) = generate_block(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -299,10 +299,10 @@ pub fn generate_block(s: Span) -> IResult<Span, GenerateBlock> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn generate_block_multiple(s: Span) -> IResult<Span, GenerateBlock> {
|
pub fn generate_block_multiple(s: Span) -> IResult<Span, GenerateBlock> {
|
||||||
let (s, a) = opt(pair(generate_block_identifier, symbol(":")))(s)?;
|
let (s, a) = opt(pair(generate_block_identifier, symbol(":")))(s)?;
|
||||||
let (s, b) = symbol("begin")(s)?;
|
let (s, b) = keyword("begin")(s)?;
|
||||||
let (s, c) = opt(pair(symbol(":"), generate_block_identifier))(s)?;
|
let (s, c) = opt(pair(symbol(":"), generate_block_identifier))(s)?;
|
||||||
let (s, d) = many0(generate_item)(s)?;
|
let (s, d) = many0(generate_item)(s)?;
|
||||||
let (s, e) = symbol("end")(s)?;
|
let (s, e) = keyword("end")(s)?;
|
||||||
let (s, f) = opt(pair(symbol(":"), generate_block_identifier))(s)?;
|
let (s, f) = opt(pair(symbol(":"), generate_block_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
|
@ -44,17 +44,17 @@ pub struct PassSwitchtype<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn cmos_switchtype(s: Span) -> IResult<Span, CmosSwitchtype> {
|
pub fn cmos_switchtype(s: Span) -> IResult<Span, CmosSwitchtype> {
|
||||||
let (s, a) = alt((symbol("cmos"), symbol("rcmos")))(s)?;
|
let (s, a) = alt((keyword("cmos"), keyword("rcmos")))(s)?;
|
||||||
Ok((s, CmosSwitchtype { nodes: (a,) }))
|
Ok((s, CmosSwitchtype { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn enable_gatetype(s: Span) -> IResult<Span, EnableGatetype> {
|
pub fn enable_gatetype(s: Span) -> IResult<Span, EnableGatetype> {
|
||||||
let (s, a) = alt((
|
let (s, a) = alt((
|
||||||
symbol("bufif0"),
|
keyword("bufif0"),
|
||||||
symbol("bufif1"),
|
keyword("bufif1"),
|
||||||
symbol("notif0"),
|
keyword("notif0"),
|
||||||
symbol("notif1"),
|
keyword("notif1"),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
Ok((s, EnableGatetype { nodes: (a,) }))
|
Ok((s, EnableGatetype { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
@ -62,10 +62,10 @@ pub fn enable_gatetype(s: Span) -> IResult<Span, EnableGatetype> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn mos_switchtype(s: Span) -> IResult<Span, MosSwitchtype> {
|
pub fn mos_switchtype(s: Span) -> IResult<Span, MosSwitchtype> {
|
||||||
let (s, a) = alt((
|
let (s, a) = alt((
|
||||||
symbol("nmos"),
|
keyword("nmos"),
|
||||||
symbol("pmos"),
|
keyword("pmos"),
|
||||||
symbol("rnmos"),
|
keyword("rnmos"),
|
||||||
symbol("rpmos"),
|
keyword("rpmos"),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
Ok((s, MosSwitchtype { nodes: (a,) }))
|
Ok((s, MosSwitchtype { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
@ -73,36 +73,36 @@ pub fn mos_switchtype(s: Span) -> IResult<Span, MosSwitchtype> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn n_input_gatetype(s: Span) -> IResult<Span, NInputGatetype> {
|
pub fn n_input_gatetype(s: Span) -> IResult<Span, NInputGatetype> {
|
||||||
let (s, a) = alt((
|
let (s, a) = alt((
|
||||||
symbol("and"),
|
keyword("and"),
|
||||||
symbol("nand"),
|
keyword("nand"),
|
||||||
symbol("or"),
|
keyword("or"),
|
||||||
symbol("nor"),
|
keyword("nor"),
|
||||||
symbol("xor"),
|
keyword("xor"),
|
||||||
symbol("xnor"),
|
keyword("xnor"),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
Ok((s, NInputGatetype { nodes: (a,) }))
|
Ok((s, NInputGatetype { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn n_output_gatetype(s: Span) -> IResult<Span, NOutputGatetype> {
|
pub fn n_output_gatetype(s: Span) -> IResult<Span, NOutputGatetype> {
|
||||||
let (s, a) = alt((symbol("buf"), symbol("not")))(s)?;
|
let (s, a) = alt((keyword("buf"), keyword("not")))(s)?;
|
||||||
Ok((s, NOutputGatetype { nodes: (a,) }))
|
Ok((s, NOutputGatetype { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn pass_en_switchtype(s: Span) -> IResult<Span, PassEnSwitchtype> {
|
pub fn pass_en_switchtype(s: Span) -> IResult<Span, PassEnSwitchtype> {
|
||||||
let (s, a) = alt((
|
let (s, a) = alt((
|
||||||
symbol("tranif0"),
|
keyword("tranif0"),
|
||||||
symbol("tranif1"),
|
keyword("tranif1"),
|
||||||
symbol("rtranif0"),
|
keyword("rtranif0"),
|
||||||
symbol("rtranif1"),
|
keyword("rtranif1"),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
Ok((s, PassEnSwitchtype { nodes: (a,) }))
|
Ok((s, PassEnSwitchtype { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn pass_switchtype(s: Span) -> IResult<Span, PassSwitchtype> {
|
pub fn pass_switchtype(s: Span) -> IResult<Span, PassSwitchtype> {
|
||||||
let (s, a) = alt((symbol("tran"), symbol("rtran")))(s)?;
|
let (s, a) = alt((keyword("tran"), keyword("rtran")))(s)?;
|
||||||
Ok((s, PassSwitchtype { nodes: (a,) }))
|
Ok((s, PassSwitchtype { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ pub fn checker_port_item(s: Span) -> IResult<Span, CheckerPortItem> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn checker_port_direction(s: Span) -> IResult<Span, CheckerPortDirection> {
|
pub fn checker_port_direction(s: Span) -> IResult<Span, CheckerPortDirection> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("input"), |x| CheckerPortDirection::Input(x)),
|
map(keyword("input"), |x| CheckerPortDirection::Input(x)),
|
||||||
map(symbol("output"), |x| CheckerPortDirection::Output(x)),
|
map(keyword("output"), |x| CheckerPortDirection::Output(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ pub fn checker_or_generate_item_declaration_data(
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn rand(s: Span) -> IResult<Span, Rand> {
|
pub fn rand(s: Span) -> IResult<Span, Rand> {
|
||||||
let (s, a) = symbol("rand")(s)?;
|
let (s, a) = keyword("rand")(s)?;
|
||||||
Ok((s, Rand { nodes: (a,) }))
|
Ok((s, Rand { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,8 +201,8 @@ pub fn rand(s: Span) -> IResult<Span, Rand> {
|
|||||||
pub fn checker_or_generate_item_declaration_clocking(
|
pub fn checker_or_generate_item_declaration_clocking(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, CheckerOrGenerateItemDeclaration> {
|
) -> IResult<Span, CheckerOrGenerateItemDeclaration> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
let (s, b) = symbol("clocking")(s)?;
|
let (s, b) = keyword("clocking")(s)?;
|
||||||
let (s, c) = clocking_identifier(s)?;
|
let (s, c) = clocking_identifier(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -217,9 +217,9 @@ pub fn checker_or_generate_item_declaration_clocking(
|
|||||||
pub fn checker_or_generate_item_declaration_disable(
|
pub fn checker_or_generate_item_declaration_disable(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, CheckerOrGenerateItemDeclaration> {
|
) -> IResult<Span, CheckerOrGenerateItemDeclaration> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
let (s, b) = symbol("disable")(s)?;
|
let (s, b) = keyword("disable")(s)?;
|
||||||
let (s, c) = symbol("iff")(s)?;
|
let (s, c) = keyword("iff")(s)?;
|
||||||
let (s, d) = expression_or_dist(s)?;
|
let (s, d) = expression_or_dist(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
|
@ -279,7 +279,7 @@ pub fn class_property_non_const(s: Span) -> IResult<Span, ClassProperty> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_property_const(s: Span) -> IResult<Span, ClassProperty> {
|
pub fn class_property_const(s: Span) -> IResult<Span, ClassProperty> {
|
||||||
let (s, a) = symbol("const")(s)?;
|
let (s, a) = keyword("const")(s)?;
|
||||||
let (s, b) = many0(class_item_qualifier)(s)?;
|
let (s, b) = many0(class_item_qualifier)(s)?;
|
||||||
let (s, c) = data_type(s)?;
|
let (s, c) = data_type(s)?;
|
||||||
let (s, d) = const_identifier(s)?;
|
let (s, d) = const_identifier(s)?;
|
||||||
@ -324,8 +324,8 @@ pub fn class_method_function(s: Span) -> IResult<Span, ClassMethod> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_method_pure_virtual(s: Span) -> IResult<Span, ClassMethod> {
|
pub fn class_method_pure_virtual(s: Span) -> IResult<Span, ClassMethod> {
|
||||||
let (s, a) = symbol("pure")(s)?;
|
let (s, a) = keyword("pure")(s)?;
|
||||||
let (s, b) = symbol("virtual")(s)?;
|
let (s, b) = keyword("virtual")(s)?;
|
||||||
let (s, c) = many0(class_item_qualifier)(s)?;
|
let (s, c) = many0(class_item_qualifier)(s)?;
|
||||||
let (s, d) = method_prototype(s)?;
|
let (s, d) = method_prototype(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
@ -339,7 +339,7 @@ pub fn class_method_pure_virtual(s: Span) -> IResult<Span, ClassMethod> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_method_extern_method(s: Span) -> IResult<Span, ClassMethod> {
|
pub fn class_method_extern_method(s: Span) -> IResult<Span, ClassMethod> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = many0(method_qualifier)(s)?;
|
let (s, b) = many0(method_qualifier)(s)?;
|
||||||
let (s, c) = method_prototype(s)?;
|
let (s, c) = method_prototype(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
@ -363,7 +363,7 @@ pub fn class_method_constructor(s: Span) -> IResult<Span, ClassMethod> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_method_extern_constructor(s: Span) -> IResult<Span, ClassMethod> {
|
pub fn class_method_extern_constructor(s: Span) -> IResult<Span, ClassMethod> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = many0(method_qualifier)(s)?;
|
let (s, b) = many0(method_qualifier)(s)?;
|
||||||
let (s, c) = class_constructor_prototype(s)?;
|
let (s, c) = class_constructor_prototype(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -374,8 +374,8 @@ pub fn class_method_extern_constructor(s: Span) -> IResult<Span, ClassMethod> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_constructor_prototype(s: Span) -> IResult<Span, ClassConstructorPrototype> {
|
pub fn class_constructor_prototype(s: Span) -> IResult<Span, ClassConstructorPrototype> {
|
||||||
let (s, a) = symbol("function")(s)?;
|
let (s, a) = keyword("function")(s)?;
|
||||||
let (s, b) = symbol("new")(s)?;
|
let (s, b) = keyword("new")(s)?;
|
||||||
let (s, c) = opt(paren(opt(tf_port_list)))(s)?;
|
let (s, c) = opt(paren(opt(tf_port_list)))(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -401,9 +401,9 @@ pub fn class_constraint(s: Span) -> IResult<Span, ClassConstraint> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_item_qualifier(s: Span) -> IResult<Span, ClassItemQualifier> {
|
pub fn class_item_qualifier(s: Span) -> IResult<Span, ClassItemQualifier> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("static"), |x| ClassItemQualifier::Static(x)),
|
map(keyword("static"), |x| ClassItemQualifier::Static(x)),
|
||||||
map(symbol("protected"), |x| ClassItemQualifier::Protected(x)),
|
map(keyword("protected"), |x| ClassItemQualifier::Protected(x)),
|
||||||
map(symbol("local"), |x| ClassItemQualifier::Local(x)),
|
map(keyword("local"), |x| ClassItemQualifier::Local(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,18 +420,18 @@ pub fn property_qualifier(s: Span) -> IResult<Span, PropertyQualifier> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn random_qualifier(s: Span) -> IResult<Span, RandomQualifier> {
|
pub fn random_qualifier(s: Span) -> IResult<Span, RandomQualifier> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("randc"), |x| RandomQualifier::Randc(x)),
|
map(keyword("randc"), |x| RandomQualifier::Randc(x)),
|
||||||
map(symbol("rand"), |x| RandomQualifier::Rand(x)),
|
map(keyword("rand"), |x| RandomQualifier::Rand(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn method_qualifier(s: Span) -> IResult<Span, MethodQualifier> {
|
pub fn method_qualifier(s: Span) -> IResult<Span, MethodQualifier> {
|
||||||
alt((
|
alt((
|
||||||
map(pair(symbol("pure"), symbol("virtual")), |x| {
|
map(pair(keyword("pure"), keyword("virtual")), |x| {
|
||||||
MethodQualifier::PureVirtual(x)
|
MethodQualifier::PureVirtual(x)
|
||||||
}),
|
}),
|
||||||
map(symbol("virtual"), |x| MethodQualifier::Virtual(x)),
|
map(keyword("virtual"), |x| MethodQualifier::Virtual(x)),
|
||||||
map(class_item_qualifier, |x| {
|
map(class_item_qualifier, |x| {
|
||||||
MethodQualifier::ClassItemQualifier(x)
|
MethodQualifier::ClassItemQualifier(x)
|
||||||
}),
|
}),
|
||||||
@ -450,21 +450,21 @@ pub fn method_prototype(s: Span) -> IResult<Span, MethodPrototype> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_constructor_declaration(s: Span) -> IResult<Span, ClassConstructorDeclaration> {
|
pub fn class_constructor_declaration(s: Span) -> IResult<Span, ClassConstructorDeclaration> {
|
||||||
let (s, a) = symbol("function")(s)?;
|
let (s, a) = keyword("function")(s)?;
|
||||||
let (s, b) = opt(class_scope)(s)?;
|
let (s, b) = opt(class_scope)(s)?;
|
||||||
let (s, c) = symbol("new")(s)?;
|
let (s, c) = keyword("new")(s)?;
|
||||||
let (s, d) = opt(paren(opt(tf_port_list)))(s)?;
|
let (s, d) = opt(paren(opt(tf_port_list)))(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
let (s, f) = many0(block_item_declaration)(s)?;
|
let (s, f) = many0(block_item_declaration)(s)?;
|
||||||
let (s, g) = opt(tuple((
|
let (s, g) = opt(tuple((
|
||||||
symbol("super"),
|
keyword("super"),
|
||||||
symbol("."),
|
symbol("."),
|
||||||
symbol("new"),
|
keyword("new"),
|
||||||
opt(paren(list_of_arguments)),
|
opt(paren(list_of_arguments)),
|
||||||
symbol(";"),
|
symbol(";"),
|
||||||
)))(s)?;
|
)))(s)?;
|
||||||
let (s, h) = many0(function_statement_or_null)(s)?;
|
let (s, h) = many0(function_statement_or_null)(s)?;
|
||||||
let (s, i) = symbol("end")(s)?;
|
let (s, i) = keyword("end")(s)?;
|
||||||
let (s, j) = opt(pair(symbol(":"), new))(s)?;
|
let (s, j) = opt(pair(symbol(":"), new))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -476,6 +476,6 @@ pub fn class_constructor_declaration(s: Span) -> IResult<Span, ClassConstructorD
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn new(s: Span) -> IResult<Span, New> {
|
pub fn new(s: Span) -> IResult<Span, New> {
|
||||||
let (s, a) = symbol("new")(s)?;
|
let (s, a) = keyword("new")(s)?;
|
||||||
Ok((s, New { nodes: (a,) }))
|
Ok((s, New { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
@ -146,13 +146,13 @@ pub struct Config<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn config_declaration(s: Span) -> IResult<Span, ConfigDeclaration> {
|
pub fn config_declaration(s: Span) -> IResult<Span, ConfigDeclaration> {
|
||||||
let (s, a) = symbol("config")(s)?;
|
let (s, a) = keyword("config")(s)?;
|
||||||
let (s, b) = config_identifier(s)?;
|
let (s, b) = config_identifier(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
let (s, d) = many0(pair(local_parameter_declaration, symbol(";")))(s)?;
|
let (s, d) = many0(pair(local_parameter_declaration, symbol(";")))(s)?;
|
||||||
let (s, e) = design_statement(s)?;
|
let (s, e) = design_statement(s)?;
|
||||||
let (s, f) = many0(config_rule_statement)(s)?;
|
let (s, f) = many0(config_rule_statement)(s)?;
|
||||||
let (s, g) = symbol("endconfig")(s)?;
|
let (s, g) = keyword("endconfig")(s)?;
|
||||||
let (s, h) = opt(pair(symbol(":"), config_identifier))(s)?;
|
let (s, h) = opt(pair(symbol(":"), config_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -164,7 +164,7 @@ pub fn config_declaration(s: Span) -> IResult<Span, ConfigDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn design_statement(s: Span) -> IResult<Span, DesignStatement> {
|
pub fn design_statement(s: Span) -> IResult<Span, DesignStatement> {
|
||||||
let (s, a) = symbol("design")(s)?;
|
let (s, a) = keyword("design")(s)?;
|
||||||
let (s, b) = many0(pair(
|
let (s, b) = many0(pair(
|
||||||
opt(pair(library_identifier, symbol("."))),
|
opt(pair(library_identifier, symbol("."))),
|
||||||
cell_identifier,
|
cell_identifier,
|
||||||
@ -241,13 +241,13 @@ pub fn config_rule_statement_cell_use(s: Span) -> IResult<Span, ConfigRuleStatem
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn default_clause(s: Span) -> IResult<Span, DefaultClause> {
|
pub fn default_clause(s: Span) -> IResult<Span, DefaultClause> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
Ok((s, DefaultClause { nodes: (a,) }))
|
Ok((s, DefaultClause { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn inst_clause(s: Span) -> IResult<Span, InstClause> {
|
pub fn inst_clause(s: Span) -> IResult<Span, InstClause> {
|
||||||
let (s, a) = symbol("instance")(s)?;
|
let (s, a) = keyword("instance")(s)?;
|
||||||
let (s, b) = inst_name(s)?;
|
let (s, b) = inst_name(s)?;
|
||||||
Ok((s, InstClause { nodes: (a, b) }))
|
Ok((s, InstClause { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ pub fn inst_name(s: Span) -> IResult<Span, InstName> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn cell_clause(s: Span) -> IResult<Span, CellClause> {
|
pub fn cell_clause(s: Span) -> IResult<Span, CellClause> {
|
||||||
let (s, a) = symbol("cell")(s)?;
|
let (s, a) = keyword("cell")(s)?;
|
||||||
let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?;
|
let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?;
|
||||||
let (s, c) = cell_identifier(s)?;
|
let (s, c) = cell_identifier(s)?;
|
||||||
Ok((s, CellClause { nodes: (a, b, c) }))
|
Ok((s, CellClause { nodes: (a, b, c) }))
|
||||||
@ -269,7 +269,7 @@ pub fn cell_clause(s: Span) -> IResult<Span, CellClause> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn liblist_clause(s: Span) -> IResult<Span, LiblistClause> {
|
pub fn liblist_clause(s: Span) -> IResult<Span, LiblistClause> {
|
||||||
let (s, a) = symbol("liblist")(s)?;
|
let (s, a) = keyword("liblist")(s)?;
|
||||||
let (s, b) = many0(library_identifier)(s)?;
|
let (s, b) = many0(library_identifier)(s)?;
|
||||||
Ok((s, LiblistClause { nodes: (a, b) }))
|
Ok((s, LiblistClause { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ pub fn use_clause(s: Span) -> IResult<Span, UseClause> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn use_clause_cell(s: Span) -> IResult<Span, UseClause> {
|
pub fn use_clause_cell(s: Span) -> IResult<Span, UseClause> {
|
||||||
let (s, a) = symbol("use")(s)?;
|
let (s, a) = keyword("use")(s)?;
|
||||||
let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?;
|
let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?;
|
||||||
let (s, c) = cell_identifier(s)?;
|
let (s, c) = cell_identifier(s)?;
|
||||||
let (s, d) = opt(pair(symbol(":"), config))(s)?;
|
let (s, d) = opt(pair(symbol(":"), config))(s)?;
|
||||||
@ -295,7 +295,7 @@ pub fn use_clause_cell(s: Span) -> IResult<Span, UseClause> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn use_clause_named(s: Span) -> IResult<Span, UseClause> {
|
pub fn use_clause_named(s: Span) -> IResult<Span, UseClause> {
|
||||||
let (s, a) = symbol("use")(s)?;
|
let (s, a) = keyword("use")(s)?;
|
||||||
let (s, b) = list(symbol(","), named_parameter_assignment)(s)?;
|
let (s, b) = list(symbol(","), named_parameter_assignment)(s)?;
|
||||||
let (s, c) = opt(pair(symbol(":"), config))(s)?;
|
let (s, c) = opt(pair(symbol(":"), config))(s)?;
|
||||||
Ok((s, UseClause::Named(UseClauseNamed { nodes: (a, b, c) })))
|
Ok((s, UseClause::Named(UseClauseNamed { nodes: (a, b, c) })))
|
||||||
@ -303,7 +303,7 @@ pub fn use_clause_named(s: Span) -> IResult<Span, UseClause> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn use_clause_cell_named(s: Span) -> IResult<Span, UseClause> {
|
pub fn use_clause_cell_named(s: Span) -> IResult<Span, UseClause> {
|
||||||
let (s, a) = symbol("use")(s)?;
|
let (s, a) = keyword("use")(s)?;
|
||||||
let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?;
|
let (s, b) = opt(pair(library_identifier, symbol(".")))(s)?;
|
||||||
let (s, c) = cell_identifier(s)?;
|
let (s, c) = cell_identifier(s)?;
|
||||||
let (s, d) = list(symbol(","), named_parameter_assignment)(s)?;
|
let (s, d) = list(symbol(","), named_parameter_assignment)(s)?;
|
||||||
@ -318,6 +318,6 @@ pub fn use_clause_cell_named(s: Span) -> IResult<Span, UseClause> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn config(s: Span) -> IResult<Span, Config> {
|
pub fn config(s: Span) -> IResult<Span, Config> {
|
||||||
let (s, a) = symbol("config")(s)?;
|
let (s, a) = keyword("config")(s)?;
|
||||||
Ok((s, Config { nodes: (a,) }))
|
Ok((s, Config { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ pub struct IdentifierList<'a> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn constraint_declaration(s: Span) -> IResult<Span, ConstraintDeclaration> {
|
pub fn constraint_declaration(s: Span) -> IResult<Span, ConstraintDeclaration> {
|
||||||
let (s, a) = opt(r#static)(s)?;
|
let (s, a) = opt(r#static)(s)?;
|
||||||
let (s, b) = symbol("constraint")(s)?;
|
let (s, b) = keyword("constraint")(s)?;
|
||||||
let (s, c) = constraint_identifier(s)?;
|
let (s, c) = constraint_identifier(s)?;
|
||||||
let (s, d) = constraint_block(s)?;
|
let (s, d) = constraint_block(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -207,7 +207,7 @@ pub fn constraint_declaration(s: Span) -> IResult<Span, ConstraintDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn r#static(s: Span) -> IResult<Span, Static> {
|
pub fn r#static(s: Span) -> IResult<Span, Static> {
|
||||||
let (s, a) = symbol("static")(s)?;
|
let (s, a) = keyword("static")(s)?;
|
||||||
Ok((s, Static { nodes: (a,) }))
|
Ok((s, Static { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,9 +229,9 @@ pub fn constraint_block_item(s: Span) -> IResult<Span, ConstraintBlockItem> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn constraint_block_item_solve(s: Span) -> IResult<Span, ConstraintBlockItem> {
|
pub fn constraint_block_item_solve(s: Span) -> IResult<Span, ConstraintBlockItem> {
|
||||||
let (s, a) = symbol("solve")(s)?;
|
let (s, a) = keyword("solve")(s)?;
|
||||||
let (s, b) = solve_before_list(s)?;
|
let (s, b) = solve_before_list(s)?;
|
||||||
let (s, c) = symbol("before")(s)?;
|
let (s, c) = keyword("before")(s)?;
|
||||||
let (s, d) = solve_before_list(s)?;
|
let (s, d) = solve_before_list(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -283,7 +283,7 @@ pub fn constraint_expression_expression(s: Span) -> IResult<Span, ConstraintExpr
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn soft(s: Span) -> IResult<Span, Soft> {
|
pub fn soft(s: Span) -> IResult<Span, Soft> {
|
||||||
let (s, a) = symbol("soft")(s)?;
|
let (s, a) = keyword("soft")(s)?;
|
||||||
Ok((s, Soft { nodes: (a,) }))
|
Ok((s, Soft { nodes: (a,) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,10 +300,10 @@ pub fn constraint_expression_arrow(s: Span) -> IResult<Span, ConstraintExpressio
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn constraint_expression_if(s: Span) -> IResult<Span, ConstraintExpression> {
|
pub fn constraint_expression_if(s: Span) -> IResult<Span, ConstraintExpression> {
|
||||||
let (s, a) = symbol("if")(s)?;
|
let (s, a) = keyword("if")(s)?;
|
||||||
let (s, b) = paren(expression)(s)?;
|
let (s, b) = paren(expression)(s)?;
|
||||||
let (s, c) = constraint_set(s)?;
|
let (s, c) = constraint_set(s)?;
|
||||||
let (s, d) = opt(pair(symbol("else"), constraint_set))(s)?;
|
let (s, d) = opt(pair(keyword("else"), constraint_set))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
ConstraintExpression::If(ConstraintExpressionIf {
|
ConstraintExpression::If(ConstraintExpressionIf {
|
||||||
@ -314,7 +314,7 @@ pub fn constraint_expression_if(s: Span) -> IResult<Span, ConstraintExpression>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn constraint_expression_foreach(s: Span) -> IResult<Span, ConstraintExpression> {
|
pub fn constraint_expression_foreach(s: Span) -> IResult<Span, ConstraintExpression> {
|
||||||
let (s, a) = symbol("foreach")(s)?;
|
let (s, a) = keyword("foreach")(s)?;
|
||||||
let (s, b) = paren(pair(
|
let (s, b) = paren(pair(
|
||||||
ps_or_hierarchical_array_identifier,
|
ps_or_hierarchical_array_identifier,
|
||||||
bracket(loop_variables),
|
bracket(loop_variables),
|
||||||
@ -328,8 +328,8 @@ pub fn constraint_expression_foreach(s: Span) -> IResult<Span, ConstraintExpress
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn constraint_expression_disable(s: Span) -> IResult<Span, ConstraintExpression> {
|
pub fn constraint_expression_disable(s: Span) -> IResult<Span, ConstraintExpression> {
|
||||||
let (s, a) = symbol("disable")(s)?;
|
let (s, a) = keyword("disable")(s)?;
|
||||||
let (s, b) = symbol("soft")(s)?;
|
let (s, b) = keyword("soft")(s)?;
|
||||||
let (s, c) = constraint_primary(s)?;
|
let (s, c) = constraint_primary(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -342,7 +342,7 @@ pub fn constraint_expression_disable(s: Span) -> IResult<Span, ConstraintExpress
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn uniqueness_constraint(s: Span) -> IResult<Span, UniquenessConstraint> {
|
pub fn uniqueness_constraint(s: Span) -> IResult<Span, UniquenessConstraint> {
|
||||||
let (s, a) = symbol("unique")(s)?;
|
let (s, a) = keyword("unique")(s)?;
|
||||||
let (s, b) = brace(open_range_list)(s)?;
|
let (s, b) = brace(open_range_list)(s)?;
|
||||||
Ok((s, UniquenessConstraint { nodes: (a, b) }))
|
Ok((s, UniquenessConstraint { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
@ -399,7 +399,7 @@ pub fn dist_weight_divide(s: Span) -> IResult<Span, DistWeight> {
|
|||||||
pub fn constraint_prototype(s: Span) -> IResult<Span, ConstraintPrototype> {
|
pub fn constraint_prototype(s: Span) -> IResult<Span, ConstraintPrototype> {
|
||||||
let (s, a) = opt(constraint_prototype_qualifier)(s)?;
|
let (s, a) = opt(constraint_prototype_qualifier)(s)?;
|
||||||
let (s, b) = opt(r#static)(s)?;
|
let (s, b) = opt(r#static)(s)?;
|
||||||
let (s, c) = symbol("constraint")(s)?;
|
let (s, c) = keyword("constraint")(s)?;
|
||||||
let (s, d) = constraint_identifier(s)?;
|
let (s, d) = constraint_identifier(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -413,17 +413,17 @@ pub fn constraint_prototype(s: Span) -> IResult<Span, ConstraintPrototype> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn constraint_prototype_qualifier(s: Span) -> IResult<Span, ConstraintPrototypeQualifier> {
|
pub fn constraint_prototype_qualifier(s: Span) -> IResult<Span, ConstraintPrototypeQualifier> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("extern"), |x| {
|
map(keyword("extern"), |x| {
|
||||||
ConstraintPrototypeQualifier::Extern(x)
|
ConstraintPrototypeQualifier::Extern(x)
|
||||||
}),
|
}),
|
||||||
map(symbol("pure"), |x| ConstraintPrototypeQualifier::Pure(x)),
|
map(keyword("pure"), |x| ConstraintPrototypeQualifier::Pure(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn extern_constraint_declaration(s: Span) -> IResult<Span, ExternConstraintDeclaration> {
|
pub fn extern_constraint_declaration(s: Span) -> IResult<Span, ExternConstraintDeclaration> {
|
||||||
let (s, a) = opt(r#static)(s)?;
|
let (s, a) = opt(r#static)(s)?;
|
||||||
let (s, b) = symbol("constraint")(s)?;
|
let (s, b) = keyword("constraint")(s)?;
|
||||||
let (s, c) = class_scope(s)?;
|
let (s, c) = class_scope(s)?;
|
||||||
let (s, d) = constraint_identifier(s)?;
|
let (s, d) = constraint_identifier(s)?;
|
||||||
let (s, e) = constraint_block(s)?;
|
let (s, e) = constraint_block(s)?;
|
||||||
|
@ -93,7 +93,7 @@ pub fn extern_tf_declaration(s: Span) -> IResult<Span, ExternTfDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn extern_tf_declaration_method(s: Span) -> IResult<Span, ExternTfDeclaration> {
|
pub fn extern_tf_declaration_method(s: Span) -> IResult<Span, ExternTfDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = method_prototype(s)?;
|
let (s, b) = method_prototype(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -104,8 +104,8 @@ pub fn extern_tf_declaration_method(s: Span) -> IResult<Span, ExternTfDeclaratio
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn extern_tf_declaration_task(s: Span) -> IResult<Span, ExternTfDeclaration> {
|
pub fn extern_tf_declaration_task(s: Span) -> IResult<Span, ExternTfDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = symbol("forkjoin")(s)?;
|
let (s, b) = keyword("forkjoin")(s)?;
|
||||||
let (s, c) = task_prototype(s)?;
|
let (s, c) = task_prototype(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
|
@ -68,10 +68,10 @@ pub fn library_description(s: Span) -> IResult<Span, LibraryDescription> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn library_declaration(s: Span) -> IResult<Span, LibraryDeclaration> {
|
pub fn library_declaration(s: Span) -> IResult<Span, LibraryDeclaration> {
|
||||||
let (s, a) = symbol("library")(s)?;
|
let (s, a) = keyword("library")(s)?;
|
||||||
let (s, b) = library_identifier(s)?;
|
let (s, b) = library_identifier(s)?;
|
||||||
let (s, c) = list(symbol(","), file_path_spec)(s)?;
|
let (s, c) = list(symbol(","), file_path_spec)(s)?;
|
||||||
let (s, d) = opt(pair(symbol("-incdir"), list(symbol(","), file_path_spec)))(s)?;
|
let (s, d) = opt(pair(keyword("-incdir"), list(symbol(","), file_path_spec)))(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -83,7 +83,7 @@ pub fn library_declaration(s: Span) -> IResult<Span, LibraryDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn include_statement(s: Span) -> IResult<Span, IncludeStatement> {
|
pub fn include_statement(s: Span) -> IResult<Span, IncludeStatement> {
|
||||||
let (s, a) = symbol("include")(s)?;
|
let (s, a) = keyword("include")(s)?;
|
||||||
let (s, b) = file_path_spec(s)?;
|
let (s, b) = file_path_spec(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((s, IncludeStatement { nodes: (a, b, c) }))
|
Ok((s, IncludeStatement { nodes: (a, b, c) }))
|
||||||
|
@ -228,7 +228,7 @@ pub fn elaboration_system_task(s: Span) -> IResult<Span, ElaborationSystemTask>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn elaboration_system_task_fatal(s: Span) -> IResult<Span, ElaborationSystemTask> {
|
pub fn elaboration_system_task_fatal(s: Span) -> IResult<Span, ElaborationSystemTask> {
|
||||||
let (s, a) = symbol("$fatal")(s)?;
|
let (s, a) = keyword("$fatal")(s)?;
|
||||||
let (s, b) = opt(paren(pair(
|
let (s, b) = opt(paren(pair(
|
||||||
finish_number,
|
finish_number,
|
||||||
opt(pair(symbol(","), list_of_arguments)),
|
opt(pair(symbol(","), list_of_arguments)),
|
||||||
@ -242,7 +242,7 @@ pub fn elaboration_system_task_fatal(s: Span) -> IResult<Span, ElaborationSystem
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn elaboration_system_task_error(s: Span) -> IResult<Span, ElaborationSystemTask> {
|
pub fn elaboration_system_task_error(s: Span) -> IResult<Span, ElaborationSystemTask> {
|
||||||
let (s, a) = symbol("$error")(s)?;
|
let (s, a) = keyword("$error")(s)?;
|
||||||
let (s, b) = opt(paren(opt(list_of_arguments)))(s)?;
|
let (s, b) = opt(paren(opt(list_of_arguments)))(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -253,7 +253,7 @@ pub fn elaboration_system_task_error(s: Span) -> IResult<Span, ElaborationSystem
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn elaboration_system_task_warning(s: Span) -> IResult<Span, ElaborationSystemTask> {
|
pub fn elaboration_system_task_warning(s: Span) -> IResult<Span, ElaborationSystemTask> {
|
||||||
let (s, a) = symbol("$warning")(s)?;
|
let (s, a) = keyword("$warning")(s)?;
|
||||||
let (s, b) = opt(paren(opt(list_of_arguments)))(s)?;
|
let (s, b) = opt(paren(opt(list_of_arguments)))(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -264,7 +264,7 @@ pub fn elaboration_system_task_warning(s: Span) -> IResult<Span, ElaborationSyst
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn elaboration_system_task_info(s: Span) -> IResult<Span, ElaborationSystemTask> {
|
pub fn elaboration_system_task_info(s: Span) -> IResult<Span, ElaborationSystemTask> {
|
||||||
let (s, a) = symbol("$info")(s)?;
|
let (s, a) = keyword("$info")(s)?;
|
||||||
let (s, b) = opt(paren(opt(list_of_arguments)))(s)?;
|
let (s, b) = opt(paren(opt(list_of_arguments)))(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -409,8 +409,8 @@ pub fn module_or_generate_item_declaration(
|
|||||||
pub fn module_or_generate_item_declaration_clocking(
|
pub fn module_or_generate_item_declaration_clocking(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, ModuleOrGenerateItemDeclaration> {
|
) -> IResult<Span, ModuleOrGenerateItemDeclaration> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
let (s, b) = symbol("clocking")(s)?;
|
let (s, b) = keyword("clocking")(s)?;
|
||||||
let (s, c) = clocking_identifier(s)?;
|
let (s, c) = clocking_identifier(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -425,9 +425,9 @@ pub fn module_or_generate_item_declaration_clocking(
|
|||||||
pub fn module_or_generate_item_declaration_disable(
|
pub fn module_or_generate_item_declaration_disable(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, ModuleOrGenerateItemDeclaration> {
|
) -> IResult<Span, ModuleOrGenerateItemDeclaration> {
|
||||||
let (s, a) = symbol("default")(s)?;
|
let (s, a) = keyword("default")(s)?;
|
||||||
let (s, b) = symbol("disable")(s)?;
|
let (s, b) = keyword("disable")(s)?;
|
||||||
let (s, c) = symbol("iff")(s)?;
|
let (s, c) = keyword("iff")(s)?;
|
||||||
let (s, d) = expression_or_dist(s)?;
|
let (s, d) = expression_or_dist(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -474,7 +474,7 @@ pub fn non_port_module_item_specparam(s: Span) -> IResult<Span, NonPortModuleIte
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn parameter_override(s: Span) -> IResult<Span, ParameterOverride> {
|
pub fn parameter_override(s: Span) -> IResult<Span, ParameterOverride> {
|
||||||
let (s, a) = symbol("defparam")(s)?;
|
let (s, a) = keyword("defparam")(s)?;
|
||||||
let (s, b) = list_of_defparam_assignments(s)?;
|
let (s, b) = list_of_defparam_assignments(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((s, ParameterOverride { nodes: (a, b, c) }))
|
Ok((s, ParameterOverride { nodes: (a, b, c) }))
|
||||||
@ -487,7 +487,7 @@ pub fn bind_directive(s: Span) -> IResult<Span, BindDirective> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn bind_directive_scope(s: Span) -> IResult<Span, BindDirective> {
|
pub fn bind_directive_scope(s: Span) -> IResult<Span, BindDirective> {
|
||||||
let (s, a) = symbol("bind")(s)?;
|
let (s, a) = keyword("bind")(s)?;
|
||||||
let (s, b) = bind_target_scope(s)?;
|
let (s, b) = bind_target_scope(s)?;
|
||||||
let (s, c) = opt(pair(symbol(":"), bind_target_instance_list))(s)?;
|
let (s, c) = opt(pair(symbol(":"), bind_target_instance_list))(s)?;
|
||||||
let (s, d) = bind_instantiation(s)?;
|
let (s, d) = bind_instantiation(s)?;
|
||||||
@ -502,7 +502,7 @@ pub fn bind_directive_scope(s: Span) -> IResult<Span, BindDirective> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn bind_directive_instance(s: Span) -> IResult<Span, BindDirective> {
|
pub fn bind_directive_instance(s: Span) -> IResult<Span, BindDirective> {
|
||||||
let (s, a) = symbol("bind")(s)?;
|
let (s, a) = keyword("bind")(s)?;
|
||||||
let (s, b) = bind_target_instance(s)?;
|
let (s, b) = bind_target_instance(s)?;
|
||||||
let (s, c) = bind_instantiation(s)?;
|
let (s, c) = bind_instantiation(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
|
@ -284,7 +284,7 @@ pub fn parameter_port_declaration_param_list(s: Span) -> IResult<Span, Parameter
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn parameter_port_declaration_type_list(s: Span) -> IResult<Span, ParameterPortDeclaration> {
|
pub fn parameter_port_declaration_type_list(s: Span) -> IResult<Span, ParameterPortDeclaration> {
|
||||||
let (s, a) = symbol("type")(s)?;
|
let (s, a) = keyword("type")(s)?;
|
||||||
let (s, b) = list_of_type_assignments(s)?;
|
let (s, b) = list_of_type_assignments(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -414,10 +414,10 @@ pub fn port_reference(s: Span) -> IResult<Span, PortReference> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn port_direction(s: Span) -> IResult<Span, PortDirection> {
|
pub fn port_direction(s: Span) -> IResult<Span, PortDirection> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("input"), |x| PortDirection::Input(x)),
|
map(keyword("input"), |x| PortDirection::Input(x)),
|
||||||
map(symbol("output"), |x| PortDirection::Output(x)),
|
map(keyword("output"), |x| PortDirection::Output(x)),
|
||||||
map(symbol("inout"), |x| PortDirection::Inout(x)),
|
map(keyword("inout"), |x| PortDirection::Inout(x)),
|
||||||
map(symbol("ref"), |x| PortDirection::Ref(x)),
|
map(keyword("ref"), |x| PortDirection::Ref(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ pub fn interface_port_header_identifier(s: Span) -> IResult<Span, InterfacePortH
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn interface_port_header_interface(s: Span) -> IResult<Span, InterfacePortHeader> {
|
pub fn interface_port_header_interface(s: Span) -> IResult<Span, InterfacePortHeader> {
|
||||||
let (s, a) = symbol("interface")(s)?;
|
let (s, a) = keyword("interface")(s)?;
|
||||||
let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?;
|
let (s, b) = opt(pair(symbol("."), modport_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
|
@ -122,10 +122,10 @@ pub fn package_or_generate_item_declaration(
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn anonymous_program(s: Span) -> IResult<Span, AnonymousProgram> {
|
pub fn anonymous_program(s: Span) -> IResult<Span, AnonymousProgram> {
|
||||||
let (s, a) = symbol("program")(s)?;
|
let (s, a) = keyword("program")(s)?;
|
||||||
let (s, b) = symbol(";")(s)?;
|
let (s, b) = symbol(";")(s)?;
|
||||||
let (s, c) = many0(anonymous_program_item)(s)?;
|
let (s, c) = many0(anonymous_program_item)(s)?;
|
||||||
let (s, d) = symbol("endprogram")(s)?;
|
let (s, d) = keyword("endprogram")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
AnonymousProgram {
|
AnonymousProgram {
|
||||||
|
@ -532,7 +532,7 @@ pub fn module_declaration_nonansi(s: Span) -> IResult<Span, ModuleDeclaration> {
|
|||||||
let (s, a) = module_nonansi_header(s)?;
|
let (s, a) = module_nonansi_header(s)?;
|
||||||
let (s, b) = opt(timeunits_declaration)(s)?;
|
let (s, b) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, c) = many0(module_item)(s)?;
|
let (s, c) = many0(module_item)(s)?;
|
||||||
let (s, d) = symbol("endmodule")(s)?;
|
let (s, d) = keyword("endmodule")(s)?;
|
||||||
let (s, e) = opt(pair(symbol(":"), module_identifier))(s)?;
|
let (s, e) = opt(pair(symbol(":"), module_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -547,7 +547,7 @@ pub fn module_declaration_ansi(s: Span) -> IResult<Span, ModuleDeclaration> {
|
|||||||
let (s, a) = module_ansi_header(s)?;
|
let (s, a) = module_ansi_header(s)?;
|
||||||
let (s, b) = opt(timeunits_declaration)(s)?;
|
let (s, b) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, c) = many0(non_port_module_item)(s)?;
|
let (s, c) = many0(non_port_module_item)(s)?;
|
||||||
let (s, d) = symbol("endmodule")(s)?;
|
let (s, d) = keyword("endmodule")(s)?;
|
||||||
let (s, e) = opt(pair(symbol(":"), module_identifier))(s)?;
|
let (s, e) = opt(pair(symbol(":"), module_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -567,7 +567,7 @@ pub fn module_declaration_wildcard(s: Span) -> IResult<Span, ModuleDeclaration>
|
|||||||
let (s, f) = symbol(";")(s)?;
|
let (s, f) = symbol(";")(s)?;
|
||||||
let (s, g) = opt(timeunits_declaration)(s)?;
|
let (s, g) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, h) = many0(module_item)(s)?;
|
let (s, h) = many0(module_item)(s)?;
|
||||||
let (s, i) = symbol("endmodule")(s)?;
|
let (s, i) = keyword("endmodule")(s)?;
|
||||||
let (s, j) = opt(pair(symbol(":"), module_identifier))(s)?;
|
let (s, j) = opt(pair(symbol(":"), module_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -579,7 +579,7 @@ pub fn module_declaration_wildcard(s: Span) -> IResult<Span, ModuleDeclaration>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn module_declaration_extern_nonansi(s: Span) -> IResult<Span, ModuleDeclaration> {
|
pub fn module_declaration_extern_nonansi(s: Span) -> IResult<Span, ModuleDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = module_nonansi_header(s)?;
|
let (s, b) = module_nonansi_header(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -589,7 +589,7 @@ pub fn module_declaration_extern_nonansi(s: Span) -> IResult<Span, ModuleDeclara
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn module_declaration_extern_ansi(s: Span) -> IResult<Span, ModuleDeclaration> {
|
pub fn module_declaration_extern_ansi(s: Span) -> IResult<Span, ModuleDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = module_ansi_header(s)?;
|
let (s, b) = module_ansi_header(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -600,8 +600,8 @@ pub fn module_declaration_extern_ansi(s: Span) -> IResult<Span, ModuleDeclaratio
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn module_keyword(s: Span) -> IResult<Span, ModuleKeyword> {
|
pub fn module_keyword(s: Span) -> IResult<Span, ModuleKeyword> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("module"), |x| ModuleKeyword::Module(x)),
|
map(keyword("module"), |x| ModuleKeyword::Module(x)),
|
||||||
map(symbol("macromodule"), |x| ModuleKeyword::Macromodule(x)),
|
map(keyword("macromodule"), |x| ModuleKeyword::Macromodule(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,7 +621,7 @@ pub fn interface_declaration_nonansi(s: Span) -> IResult<Span, InterfaceDeclarat
|
|||||||
let (s, a) = interface_nonansi_header(s)?;
|
let (s, a) = interface_nonansi_header(s)?;
|
||||||
let (s, b) = opt(timeunits_declaration)(s)?;
|
let (s, b) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, c) = many0(interface_item)(s)?;
|
let (s, c) = many0(interface_item)(s)?;
|
||||||
let (s, d) = symbol("endinterface")(s)?;
|
let (s, d) = keyword("endinterface")(s)?;
|
||||||
let (s, e) = opt(pair(symbol(":"), interface_identifier))(s)?;
|
let (s, e) = opt(pair(symbol(":"), interface_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -636,7 +636,7 @@ pub fn interface_declaration_ansi(s: Span) -> IResult<Span, InterfaceDeclaration
|
|||||||
let (s, a) = interface_ansi_header(s)?;
|
let (s, a) = interface_ansi_header(s)?;
|
||||||
let (s, b) = opt(timeunits_declaration)(s)?;
|
let (s, b) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, c) = many0(non_port_interface_item)(s)?;
|
let (s, c) = many0(non_port_interface_item)(s)?;
|
||||||
let (s, d) = symbol("endinterface")(s)?;
|
let (s, d) = keyword("endinterface")(s)?;
|
||||||
let (s, e) = opt(pair(symbol(":"), interface_identifier))(s)?;
|
let (s, e) = opt(pair(symbol(":"), interface_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -649,14 +649,14 @@ pub fn interface_declaration_ansi(s: Span) -> IResult<Span, InterfaceDeclaration
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn interface_declaration_wildcard(s: Span) -> IResult<Span, InterfaceDeclaration> {
|
pub fn interface_declaration_wildcard(s: Span) -> IResult<Span, InterfaceDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("interface")(s)?;
|
let (s, b) = keyword("interface")(s)?;
|
||||||
let (s, c) = opt(lifetime)(s)?;
|
let (s, c) = opt(lifetime)(s)?;
|
||||||
let (s, d) = interface_identifier(s)?;
|
let (s, d) = interface_identifier(s)?;
|
||||||
let (s, e) = paren(symbol(".*"))(s)?;
|
let (s, e) = paren(symbol(".*"))(s)?;
|
||||||
let (s, f) = symbol(";")(s)?;
|
let (s, f) = symbol(";")(s)?;
|
||||||
let (s, g) = opt(timeunits_declaration)(s)?;
|
let (s, g) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, h) = many0(interface_item)(s)?;
|
let (s, h) = many0(interface_item)(s)?;
|
||||||
let (s, i) = symbol("endinterface")(s)?;
|
let (s, i) = keyword("endinterface")(s)?;
|
||||||
let (s, j) = opt(pair(symbol(":"), interface_identifier))(s)?;
|
let (s, j) = opt(pair(symbol(":"), interface_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -668,7 +668,7 @@ pub fn interface_declaration_wildcard(s: Span) -> IResult<Span, InterfaceDeclara
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn interface_declaration_extern_nonansi(s: Span) -> IResult<Span, InterfaceDeclaration> {
|
pub fn interface_declaration_extern_nonansi(s: Span) -> IResult<Span, InterfaceDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = interface_nonansi_header(s)?;
|
let (s, b) = interface_nonansi_header(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -678,7 +678,7 @@ pub fn interface_declaration_extern_nonansi(s: Span) -> IResult<Span, InterfaceD
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn interface_declaration_extern_ansi(s: Span) -> IResult<Span, InterfaceDeclaration> {
|
pub fn interface_declaration_extern_ansi(s: Span) -> IResult<Span, InterfaceDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = interface_ansi_header(s)?;
|
let (s, b) = interface_ansi_header(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -689,7 +689,7 @@ pub fn interface_declaration_extern_ansi(s: Span) -> IResult<Span, InterfaceDecl
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn interface_nonansi_header(s: Span) -> IResult<Span, InterfaceNonansiHeader> {
|
pub fn interface_nonansi_header(s: Span) -> IResult<Span, InterfaceNonansiHeader> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("interface")(s)?;
|
let (s, b) = keyword("interface")(s)?;
|
||||||
let (s, c) = opt(lifetime)(s)?;
|
let (s, c) = opt(lifetime)(s)?;
|
||||||
let (s, d) = interface_identifier(s)?;
|
let (s, d) = interface_identifier(s)?;
|
||||||
let (s, e) = many0(package_import_declaration)(s)?;
|
let (s, e) = many0(package_import_declaration)(s)?;
|
||||||
@ -707,7 +707,7 @@ pub fn interface_nonansi_header(s: Span) -> IResult<Span, InterfaceNonansiHeader
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn interface_ansi_header(s: Span) -> IResult<Span, InterfaceAnsiHeader> {
|
pub fn interface_ansi_header(s: Span) -> IResult<Span, InterfaceAnsiHeader> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("interface")(s)?;
|
let (s, b) = keyword("interface")(s)?;
|
||||||
let (s, c) = opt(lifetime)(s)?;
|
let (s, c) = opt(lifetime)(s)?;
|
||||||
let (s, d) = interface_identifier(s)?;
|
let (s, d) = interface_identifier(s)?;
|
||||||
let (s, e) = many0(package_import_declaration)(s)?;
|
let (s, e) = many0(package_import_declaration)(s)?;
|
||||||
@ -738,7 +738,7 @@ pub fn program_declaration_nonansi(s: Span) -> IResult<Span, ProgramDeclaration>
|
|||||||
let (s, a) = program_nonansi_header(s)?;
|
let (s, a) = program_nonansi_header(s)?;
|
||||||
let (s, b) = opt(timeunits_declaration)(s)?;
|
let (s, b) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, c) = many0(program_item)(s)?;
|
let (s, c) = many0(program_item)(s)?;
|
||||||
let (s, d) = symbol("endprogram")(s)?;
|
let (s, d) = keyword("endprogram")(s)?;
|
||||||
let (s, e) = opt(pair(symbol(":"), program_identifier))(s)?;
|
let (s, e) = opt(pair(symbol(":"), program_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -753,7 +753,7 @@ pub fn program_declaration_ansi(s: Span) -> IResult<Span, ProgramDeclaration> {
|
|||||||
let (s, a) = program_ansi_header(s)?;
|
let (s, a) = program_ansi_header(s)?;
|
||||||
let (s, b) = opt(timeunits_declaration)(s)?;
|
let (s, b) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, c) = many0(non_port_program_item)(s)?;
|
let (s, c) = many0(non_port_program_item)(s)?;
|
||||||
let (s, d) = symbol("endprogram")(s)?;
|
let (s, d) = keyword("endprogram")(s)?;
|
||||||
let (s, e) = opt(pair(symbol(":"), program_identifier))(s)?;
|
let (s, e) = opt(pair(symbol(":"), program_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -766,13 +766,13 @@ pub fn program_declaration_ansi(s: Span) -> IResult<Span, ProgramDeclaration> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn program_declaration_wildcard(s: Span) -> IResult<Span, ProgramDeclaration> {
|
pub fn program_declaration_wildcard(s: Span) -> IResult<Span, ProgramDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("program")(s)?;
|
let (s, b) = keyword("program")(s)?;
|
||||||
let (s, c) = program_identifier(s)?;
|
let (s, c) = program_identifier(s)?;
|
||||||
let (s, d) = paren(symbol(".*"))(s)?;
|
let (s, d) = paren(symbol(".*"))(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
let (s, f) = opt(timeunits_declaration)(s)?;
|
let (s, f) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, g) = many0(program_item)(s)?;
|
let (s, g) = many0(program_item)(s)?;
|
||||||
let (s, h) = symbol("endprogram")(s)?;
|
let (s, h) = keyword("endprogram")(s)?;
|
||||||
let (s, i) = opt(pair(symbol(":"), program_identifier))(s)?;
|
let (s, i) = opt(pair(symbol(":"), program_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -784,7 +784,7 @@ pub fn program_declaration_wildcard(s: Span) -> IResult<Span, ProgramDeclaration
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn program_declaration_extern_nonansi(s: Span) -> IResult<Span, ProgramDeclaration> {
|
pub fn program_declaration_extern_nonansi(s: Span) -> IResult<Span, ProgramDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = program_nonansi_header(s)?;
|
let (s, b) = program_nonansi_header(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -794,7 +794,7 @@ pub fn program_declaration_extern_nonansi(s: Span) -> IResult<Span, ProgramDecla
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn program_declaration_extern_ansi(s: Span) -> IResult<Span, ProgramDeclaration> {
|
pub fn program_declaration_extern_ansi(s: Span) -> IResult<Span, ProgramDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = program_ansi_header(s)?;
|
let (s, b) = program_ansi_header(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -805,7 +805,7 @@ pub fn program_declaration_extern_ansi(s: Span) -> IResult<Span, ProgramDeclarat
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn program_nonansi_header(s: Span) -> IResult<Span, ProgramNonansiHeader> {
|
pub fn program_nonansi_header(s: Span) -> IResult<Span, ProgramNonansiHeader> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("prgogram")(s)?;
|
let (s, b) = keyword("prgogram")(s)?;
|
||||||
let (s, c) = opt(lifetime)(s)?;
|
let (s, c) = opt(lifetime)(s)?;
|
||||||
let (s, d) = program_identifier(s)?;
|
let (s, d) = program_identifier(s)?;
|
||||||
let (s, e) = many0(package_import_declaration)(s)?;
|
let (s, e) = many0(package_import_declaration)(s)?;
|
||||||
@ -823,7 +823,7 @@ pub fn program_nonansi_header(s: Span) -> IResult<Span, ProgramNonansiHeader> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn program_ansi_header(s: Span) -> IResult<Span, ProgramAnsiHeader> {
|
pub fn program_ansi_header(s: Span) -> IResult<Span, ProgramAnsiHeader> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("program")(s)?;
|
let (s, b) = keyword("program")(s)?;
|
||||||
let (s, c) = opt(lifetime)(s)?;
|
let (s, c) = opt(lifetime)(s)?;
|
||||||
let (s, d) = program_identifier(s)?;
|
let (s, d) = program_identifier(s)?;
|
||||||
let (s, e) = many0(package_import_declaration)(s)?;
|
let (s, e) = many0(package_import_declaration)(s)?;
|
||||||
@ -840,12 +840,12 @@ pub fn program_ansi_header(s: Span) -> IResult<Span, ProgramAnsiHeader> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn checker_declaration(s: Span) -> IResult<Span, CheckerDeclaration> {
|
pub fn checker_declaration(s: Span) -> IResult<Span, CheckerDeclaration> {
|
||||||
let (s, a) = symbol("checker")(s)?;
|
let (s, a) = keyword("checker")(s)?;
|
||||||
let (s, b) = checker_identifier(s)?;
|
let (s, b) = checker_identifier(s)?;
|
||||||
let (s, c) = opt(paren(opt(checker_port_list)))(s)?;
|
let (s, c) = opt(paren(opt(checker_port_list)))(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
let (s, e) = many0(pair(many0(attribute_instance), checker_or_generate_item))(s)?;
|
let (s, e) = many0(pair(many0(attribute_instance), checker_or_generate_item))(s)?;
|
||||||
let (s, f) = symbol("endchecker")(s)?;
|
let (s, f) = keyword("endchecker")(s)?;
|
||||||
let (s, g) = opt(pair(symbol(":"), checker_identifier))(s)?;
|
let (s, g) = opt(pair(symbol(":"), checker_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -857,23 +857,23 @@ pub fn checker_declaration(s: Span) -> IResult<Span, CheckerDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn class_declaration(s: Span) -> IResult<Span, ClassDeclaration> {
|
pub fn class_declaration(s: Span) -> IResult<Span, ClassDeclaration> {
|
||||||
let (s, a) = opt(map(symbol("virtual"), |x| Virtual { nodes: (x,) }))(s)?;
|
let (s, a) = opt(map(keyword("virtual"), |x| Virtual { nodes: (x,) }))(s)?;
|
||||||
let (s, b) = symbol("class")(s)?;
|
let (s, b) = keyword("class")(s)?;
|
||||||
let (s, c) = opt(lifetime)(s)?;
|
let (s, c) = opt(lifetime)(s)?;
|
||||||
let (s, d) = class_identifier(s)?;
|
let (s, d) = class_identifier(s)?;
|
||||||
let (s, e) = opt(parameter_port_list)(s)?;
|
let (s, e) = opt(parameter_port_list)(s)?;
|
||||||
let (s, f) = opt(triple(
|
let (s, f) = opt(triple(
|
||||||
symbol("extends"),
|
keyword("extends"),
|
||||||
class_type,
|
class_type,
|
||||||
opt(paren(list_of_arguments)),
|
opt(paren(list_of_arguments)),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
let (s, g) = opt(pair(
|
let (s, g) = opt(pair(
|
||||||
symbol("implements"),
|
keyword("implements"),
|
||||||
list(symbol(","), interface_class_type),
|
list(symbol(","), interface_class_type),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
let (s, h) = symbol(";")(s)?;
|
let (s, h) = symbol(";")(s)?;
|
||||||
let (s, i) = many0(class_item)(s)?;
|
let (s, i) = many0(class_item)(s)?;
|
||||||
let (s, j) = symbol("endclass")(s)?;
|
let (s, j) = keyword("endclass")(s)?;
|
||||||
let (s, k) = opt(pair(symbol(":"), class_identifier))(s)?;
|
let (s, k) = opt(pair(symbol(":"), class_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -892,17 +892,17 @@ pub fn interface_class_type(s: Span) -> IResult<Span, InterfaceClassType> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn interface_class_declaration(s: Span) -> IResult<Span, InterfaceClassDeclaration> {
|
pub fn interface_class_declaration(s: Span) -> IResult<Span, InterfaceClassDeclaration> {
|
||||||
let (s, a) = symbol("interface")(s)?;
|
let (s, a) = keyword("interface")(s)?;
|
||||||
let (s, b) = symbol("class")(s)?;
|
let (s, b) = keyword("class")(s)?;
|
||||||
let (s, c) = class_identifier(s)?;
|
let (s, c) = class_identifier(s)?;
|
||||||
let (s, d) = opt(parameter_port_list)(s)?;
|
let (s, d) = opt(parameter_port_list)(s)?;
|
||||||
let (s, e) = opt(pair(
|
let (s, e) = opt(pair(
|
||||||
symbol("extends"),
|
keyword("extends"),
|
||||||
list(symbol(","), interface_class_type),
|
list(symbol(","), interface_class_type),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
let (s, f) = symbol(";")(s)?;
|
let (s, f) = symbol(";")(s)?;
|
||||||
let (s, g) = many0(interface_class_item)(s)?;
|
let (s, g) = many0(interface_class_item)(s)?;
|
||||||
let (s, h) = symbol("endclass")(s)?;
|
let (s, h) = keyword("endclass")(s)?;
|
||||||
let (s, i) = opt(pair(symbol(":"), class_identifier))(s)?;
|
let (s, i) = opt(pair(symbol(":"), class_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -939,8 +939,8 @@ pub fn interface_class_item_method(s: Span) -> IResult<Span, InterfaceClassItem>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn interface_class_method(s: Span) -> IResult<Span, InterfaceClassMethod> {
|
pub fn interface_class_method(s: Span) -> IResult<Span, InterfaceClassMethod> {
|
||||||
let (s, a) = symbol("pure")(s)?;
|
let (s, a) = keyword("pure")(s)?;
|
||||||
let (s, b) = symbol("virtual")(s)?;
|
let (s, b) = keyword("virtual")(s)?;
|
||||||
let (s, c) = method_prototype(s)?;
|
let (s, c) = method_prototype(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -954,13 +954,13 @@ pub fn interface_class_method(s: Span) -> IResult<Span, InterfaceClassMethod> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn package_declaration(s: Span) -> IResult<Span, PackageDeclaration> {
|
pub fn package_declaration(s: Span) -> IResult<Span, PackageDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("package")(s)?;
|
let (s, b) = keyword("package")(s)?;
|
||||||
let (s, c) = opt(lifetime)(s)?;
|
let (s, c) = opt(lifetime)(s)?;
|
||||||
let (s, d) = package_identifier(s)?;
|
let (s, d) = package_identifier(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
let (s, f) = opt(timeunits_declaration)(s)?;
|
let (s, f) = opt(timeunits_declaration)(s)?;
|
||||||
let (s, g) = many0(pair(many0(attribute_instance), package_item))(s)?;
|
let (s, g) = many0(pair(many0(attribute_instance), package_item))(s)?;
|
||||||
let (s, h) = symbol("endpackage")(s)?;
|
let (s, h) = keyword("endpackage")(s)?;
|
||||||
let (s, i) = opt(pair(symbol(":"), package_identifier))(s)?;
|
let (s, i) = opt(pair(symbol(":"), package_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -982,7 +982,7 @@ pub fn timeunits_declaration(s: Span) -> IResult<Span, TimeunitsDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn timeunits_declaration_timeunit(s: Span) -> IResult<Span, TimeunitsDeclaration> {
|
pub fn timeunits_declaration_timeunit(s: Span) -> IResult<Span, TimeunitsDeclaration> {
|
||||||
let (s, a) = symbol("timeunit")(s)?;
|
let (s, a) = keyword("timeunit")(s)?;
|
||||||
let (s, b) = time_literal(s)?;
|
let (s, b) = time_literal(s)?;
|
||||||
let (s, c) = opt(pair(symbol("/"), time_literal))(s)?;
|
let (s, c) = opt(pair(symbol("/"), time_literal))(s)?;
|
||||||
let (s, d) = symbol(";")(s)?;
|
let (s, d) = symbol(";")(s)?;
|
||||||
@ -996,7 +996,7 @@ pub fn timeunits_declaration_timeunit(s: Span) -> IResult<Span, TimeunitsDeclara
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn timeunits_declaration_timeprecision(s: Span) -> IResult<Span, TimeunitsDeclaration> {
|
pub fn timeunits_declaration_timeprecision(s: Span) -> IResult<Span, TimeunitsDeclaration> {
|
||||||
let (s, a) = symbol("timeprecision")(s)?;
|
let (s, a) = keyword("timeprecision")(s)?;
|
||||||
let (s, b) = time_literal(s)?;
|
let (s, b) = time_literal(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1009,10 +1009,10 @@ pub fn timeunits_declaration_timeprecision(s: Span) -> IResult<Span, TimeunitsDe
|
|||||||
pub fn timeunits_declaration_timeunit_timeprecision(
|
pub fn timeunits_declaration_timeunit_timeprecision(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, TimeunitsDeclaration> {
|
) -> IResult<Span, TimeunitsDeclaration> {
|
||||||
let (s, a) = symbol("timeunit")(s)?;
|
let (s, a) = keyword("timeunit")(s)?;
|
||||||
let (s, b) = time_literal(s)?;
|
let (s, b) = time_literal(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
let (s, d) = symbol("timeprecision")(s)?;
|
let (s, d) = keyword("timeprecision")(s)?;
|
||||||
let (s, e) = time_literal(s)?;
|
let (s, e) = time_literal(s)?;
|
||||||
let (s, f) = symbol(";")(s)?;
|
let (s, f) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -1027,10 +1027,10 @@ pub fn timeunits_declaration_timeunit_timeprecision(
|
|||||||
pub fn timeunits_declaration_timeprecision_timeunit(
|
pub fn timeunits_declaration_timeprecision_timeunit(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, TimeunitsDeclaration> {
|
) -> IResult<Span, TimeunitsDeclaration> {
|
||||||
let (s, a) = symbol("timeprecision")(s)?;
|
let (s, a) = keyword("timeprecision")(s)?;
|
||||||
let (s, b) = time_literal(s)?;
|
let (s, b) = time_literal(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
let (s, d) = symbol("timeunit")(s)?;
|
let (s, d) = keyword("timeunit")(s)?;
|
||||||
let (s, e) = time_literal(s)?;
|
let (s, e) = time_literal(s)?;
|
||||||
let (s, f) = symbol(";")(s)?;
|
let (s, f) = symbol(";")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
|
@ -35,9 +35,9 @@ pub struct ShowcancelledDeclaration<'a> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn specify_block(s: Span) -> IResult<Span, SpecifyBlock> {
|
pub fn specify_block(s: Span) -> IResult<Span, SpecifyBlock> {
|
||||||
let (s, a) = symbol("specify")(s)?;
|
let (s, a) = keyword("specify")(s)?;
|
||||||
let (s, b) = many0(specify_item)(s)?;
|
let (s, b) = many0(specify_item)(s)?;
|
||||||
let (s, c) = symbol("endspecify")(s)?;
|
let (s, c) = keyword("endspecify")(s)?;
|
||||||
Ok((s, SpecifyBlock { nodes: (a, b, c) }))
|
Ok((s, SpecifyBlock { nodes: (a, b, c) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,10 @@ pub fn specify_item(s: Span) -> IResult<Span, SpecifyItem> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn pulsestyle_declaration(s: Span) -> IResult<Span, PulsestyleDeclaration> {
|
pub fn pulsestyle_declaration(s: Span) -> IResult<Span, PulsestyleDeclaration> {
|
||||||
let (s, a) = alt((symbol("pulsestyle_onevent"), symbol("pulsestyle_ondetect")))(s)?;
|
let (s, a) = alt((
|
||||||
|
keyword("pulsestyle_onevent"),
|
||||||
|
keyword("pulsestyle_ondetect"),
|
||||||
|
))(s)?;
|
||||||
let (s, b) = list_of_path_outputs(s)?;
|
let (s, b) = list_of_path_outputs(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((s, PulsestyleDeclaration { nodes: (a, b, c) }))
|
Ok((s, PulsestyleDeclaration { nodes: (a, b, c) }))
|
||||||
@ -68,7 +71,7 @@ pub fn pulsestyle_declaration(s: Span) -> IResult<Span, PulsestyleDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn showcancelled_declaration(s: Span) -> IResult<Span, ShowcancelledDeclaration> {
|
pub fn showcancelled_declaration(s: Span) -> IResult<Span, ShowcancelledDeclaration> {
|
||||||
let (s, a) = alt((symbol("showcalcelled"), symbol("noshowcancelled")))(s)?;
|
let (s, a) = alt((keyword("showcalcelled"), keyword("noshowcancelled")))(s)?;
|
||||||
let (s, b) = list_of_path_outputs(s)?;
|
let (s, b) = list_of_path_outputs(s)?;
|
||||||
let (s, c) = symbol(";")(s)?;
|
let (s, c) = symbol(";")(s)?;
|
||||||
Ok((s, ShowcancelledDeclaration { nodes: (a, b, c) }))
|
Ok((s, ShowcancelledDeclaration { nodes: (a, b, c) }))
|
||||||
|
@ -273,9 +273,9 @@ pub fn data_source_expression(s: Span) -> IResult<Span, DataSourceExpression> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn edge_identifier(s: Span) -> IResult<Span, EdgeIdentifier> {
|
pub fn edge_identifier(s: Span) -> IResult<Span, EdgeIdentifier> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("posedge"), |x| EdgeIdentifier::Posedge(x)),
|
map(keyword("posedge"), |x| EdgeIdentifier::Posedge(x)),
|
||||||
map(symbol("negedge"), |x| EdgeIdentifier::Negedge(x)),
|
map(keyword("negedge"), |x| EdgeIdentifier::Negedge(x)),
|
||||||
map(symbol("edge"), |x| EdgeIdentifier::Edge(x)),
|
map(keyword("edge"), |x| EdgeIdentifier::Edge(x)),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ pub fn state_dependent_path_declaration(s: Span) -> IResult<Span, StateDependent
|
|||||||
pub fn state_dependent_path_declaration_if_simple(
|
pub fn state_dependent_path_declaration_if_simple(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, StateDependentPathDeclaration> {
|
) -> IResult<Span, StateDependentPathDeclaration> {
|
||||||
let (s, a) = symbol("if")(s)?;
|
let (s, a) = keyword("if")(s)?;
|
||||||
let (s, b) = paren(module_path_expression)(s)?;
|
let (s, b) = paren(module_path_expression)(s)?;
|
||||||
let (s, c) = simple_path_declaration(s)?;
|
let (s, c) = simple_path_declaration(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -307,7 +307,7 @@ pub fn state_dependent_path_declaration_if_simple(
|
|||||||
pub fn state_dependent_path_declaration_if_edge_sensitive(
|
pub fn state_dependent_path_declaration_if_edge_sensitive(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, StateDependentPathDeclaration> {
|
) -> IResult<Span, StateDependentPathDeclaration> {
|
||||||
let (s, a) = symbol("if")(s)?;
|
let (s, a) = keyword("if")(s)?;
|
||||||
let (s, b) = paren(module_path_expression)(s)?;
|
let (s, b) = paren(module_path_expression)(s)?;
|
||||||
let (s, c) = edge_sensitive_path_declaration(s)?;
|
let (s, c) = edge_sensitive_path_declaration(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -322,7 +322,7 @@ pub fn state_dependent_path_declaration_if_edge_sensitive(
|
|||||||
pub fn state_dependent_path_declaration_if_none(
|
pub fn state_dependent_path_declaration_if_none(
|
||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, StateDependentPathDeclaration> {
|
) -> IResult<Span, StateDependentPathDeclaration> {
|
||||||
let (s, a) = symbol("ifnone")(s)?;
|
let (s, a) = keyword("ifnone")(s)?;
|
||||||
let (s, b) = simple_path_declaration(s)?;
|
let (s, b) = simple_path_declaration(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
|
@ -347,7 +347,7 @@ pub fn system_timing_check(s: Span) -> IResult<Span, SystemTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn setup_timing_check(s: Span) -> IResult<Span, SetupTimingCheck> {
|
pub fn setup_timing_check(s: Span) -> IResult<Span, SetupTimingCheck> {
|
||||||
let (s, a) = symbol("$setup")(s)?;
|
let (s, a) = keyword("$setup")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
data_event,
|
data_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -362,7 +362,7 @@ pub fn setup_timing_check(s: Span) -> IResult<Span, SetupTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn hold_timing_check(s: Span) -> IResult<Span, HoldTimingCheck> {
|
pub fn hold_timing_check(s: Span) -> IResult<Span, HoldTimingCheck> {
|
||||||
let (s, a) = symbol("$setup")(s)?;
|
let (s, a) = keyword("$setup")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
referecne_event,
|
referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -377,7 +377,7 @@ pub fn hold_timing_check(s: Span) -> IResult<Span, HoldTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn setuphold_timing_check(s: Span) -> IResult<Span, SetupholdTimingCheck> {
|
pub fn setuphold_timing_check(s: Span) -> IResult<Span, SetupholdTimingCheck> {
|
||||||
let (s, a) = symbol("$setuphold")(s)?;
|
let (s, a) = keyword("$setuphold")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
referecne_event,
|
referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -410,7 +410,7 @@ pub fn setuphold_timing_check(s: Span) -> IResult<Span, SetupholdTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn recovery_timing_check(s: Span) -> IResult<Span, RecoveryTimingCheck> {
|
pub fn recovery_timing_check(s: Span) -> IResult<Span, RecoveryTimingCheck> {
|
||||||
let (s, a) = symbol("$recovery")(s)?;
|
let (s, a) = keyword("$recovery")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
referecne_event,
|
referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -425,7 +425,7 @@ pub fn recovery_timing_check(s: Span) -> IResult<Span, RecoveryTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn removal_timing_check(s: Span) -> IResult<Span, RemovalTimingCheck> {
|
pub fn removal_timing_check(s: Span) -> IResult<Span, RemovalTimingCheck> {
|
||||||
let (s, a) = symbol("$removal")(s)?;
|
let (s, a) = keyword("$removal")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
referecne_event,
|
referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -440,7 +440,7 @@ pub fn removal_timing_check(s: Span) -> IResult<Span, RemovalTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn recrem_timing_check(s: Span) -> IResult<Span, RecremTimingCheck> {
|
pub fn recrem_timing_check(s: Span) -> IResult<Span, RecremTimingCheck> {
|
||||||
let (s, a) = symbol("$recrem")(s)?;
|
let (s, a) = keyword("$recrem")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
referecne_event,
|
referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -473,7 +473,7 @@ pub fn recrem_timing_check(s: Span) -> IResult<Span, RecremTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn skew_timing_check(s: Span) -> IResult<Span, SkewTimingCheck> {
|
pub fn skew_timing_check(s: Span) -> IResult<Span, SkewTimingCheck> {
|
||||||
let (s, a) = symbol("$skew")(s)?;
|
let (s, a) = keyword("$skew")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
referecne_event,
|
referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -488,7 +488,7 @@ pub fn skew_timing_check(s: Span) -> IResult<Span, SkewTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn timeskew_timing_check(s: Span) -> IResult<Span, TimeskewTimingCheck> {
|
pub fn timeskew_timing_check(s: Span) -> IResult<Span, TimeskewTimingCheck> {
|
||||||
let (s, a) = symbol("$timeskew")(s)?;
|
let (s, a) = keyword("$timeskew")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
referecne_event,
|
referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -511,7 +511,7 @@ pub fn timeskew_timing_check(s: Span) -> IResult<Span, TimeskewTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn fullskew_timing_check(s: Span) -> IResult<Span, FullskewTimingCheck> {
|
pub fn fullskew_timing_check(s: Span) -> IResult<Span, FullskewTimingCheck> {
|
||||||
let (s, a) = symbol("$fullskew")(s)?;
|
let (s, a) = keyword("$fullskew")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
referecne_event,
|
referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -536,7 +536,7 @@ pub fn fullskew_timing_check(s: Span) -> IResult<Span, FullskewTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn period_timing_check(s: Span) -> IResult<Span, PeriodTimingCheck> {
|
pub fn period_timing_check(s: Span) -> IResult<Span, PeriodTimingCheck> {
|
||||||
let (s, a) = symbol("$period")(s)?;
|
let (s, a) = keyword("$period")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
controlled_referecne_event,
|
controlled_referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -549,7 +549,7 @@ pub fn period_timing_check(s: Span) -> IResult<Span, PeriodTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn width_timing_check(s: Span) -> IResult<Span, WidthTimingCheck> {
|
pub fn width_timing_check(s: Span) -> IResult<Span, WidthTimingCheck> {
|
||||||
let (s, a) = symbol("$width")(s)?;
|
let (s, a) = keyword("$width")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
controlled_referecne_event,
|
controlled_referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
@ -564,7 +564,7 @@ pub fn width_timing_check(s: Span) -> IResult<Span, WidthTimingCheck> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn nocharge_timing_check(s: Span) -> IResult<Span, NochargeTimingCheck> {
|
pub fn nocharge_timing_check(s: Span) -> IResult<Span, NochargeTimingCheck> {
|
||||||
let (s, a) = symbol("$nocharge")(s)?;
|
let (s, a) = keyword("$nocharge")(s)?;
|
||||||
let (s, b) = paren(tuple((
|
let (s, b) = paren(tuple((
|
||||||
referecne_event,
|
referecne_event,
|
||||||
symbol(","),
|
symbol(","),
|
||||||
|
@ -106,9 +106,9 @@ pub fn controlled_timing_check_event(s: Span) -> IResult<Span, ControlledTimingC
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn timing_check_event_control(s: Span) -> IResult<Span, TimingCheckEventControl> {
|
pub fn timing_check_event_control(s: Span) -> IResult<Span, TimingCheckEventControl> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("posedge"), |x| TimingCheckEventControl::Posedge(x)),
|
map(keyword("posedge"), |x| TimingCheckEventControl::Posedge(x)),
|
||||||
map(symbol("negedge"), |x| TimingCheckEventControl::Negedge(x)),
|
map(keyword("negedge"), |x| TimingCheckEventControl::Negedge(x)),
|
||||||
map(symbol("edge"), |x| TimingCheckEventControl::Edge(x)),
|
map(keyword("edge"), |x| TimingCheckEventControl::Edge(x)),
|
||||||
map(edge_control_specifier, |x| {
|
map(edge_control_specifier, |x| {
|
||||||
TimingCheckEventControl::EdgeControlSpecifier(x)
|
TimingCheckEventControl::EdgeControlSpecifier(x)
|
||||||
}),
|
}),
|
||||||
@ -129,7 +129,7 @@ pub fn specify_terminal_descriptor(s: Span) -> IResult<Span, SpecifyTerminalDesc
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn edge_control_specifier(s: Span) -> IResult<Span, EdgeControlSpecifier> {
|
pub fn edge_control_specifier(s: Span) -> IResult<Span, EdgeControlSpecifier> {
|
||||||
let (s, a) = symbol("edge")(s)?;
|
let (s, a) = keyword("edge")(s)?;
|
||||||
let (s, b) = bracket(list(symbol(","), edge_descriptor))(s)?;
|
let (s, b) = bracket(list(symbol(","), edge_descriptor))(s)?;
|
||||||
Ok((s, EdgeControlSpecifier { nodes: (a, b) }))
|
Ok((s, EdgeControlSpecifier { nodes: (a, b) }))
|
||||||
}
|
}
|
||||||
@ -137,24 +137,24 @@ pub fn edge_control_specifier(s: Span) -> IResult<Span, EdgeControlSpecifier> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn edge_descriptor(s: Span) -> IResult<Span, EdgeDescriptor> {
|
pub fn edge_descriptor(s: Span) -> IResult<Span, EdgeDescriptor> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("01"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("01"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("10"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("10"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("x0"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("x0"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("x1"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("x1"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("X0"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("X0"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("X1"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("X1"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("z0"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("z0"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("z1"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("z1"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("Z0"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("Z0"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("Z1"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("Z1"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("0x"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("0x"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("1x"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("1x"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("0X"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("0X"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("1X"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("1X"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("0z"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("0z"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("1z"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("1z"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("0Z"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("0Z"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
map(symbol("1Z"), |x| EdgeDescriptor { nodes: (x,) }),
|
map(keyword("1Z"), |x| EdgeDescriptor { nodes: (x,) }),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,15 +210,15 @@ pub fn scalar_timing_check_condition_binary(s: Span) -> IResult<Span, ScalarTimi
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn scalar_constant(s: Span) -> IResult<Span, ScalarConstant> {
|
pub fn scalar_constant(s: Span) -> IResult<Span, ScalarConstant> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("1'b0"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("1'b0"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
map(symbol("1'b1"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("1'b1"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
map(symbol("1'B0"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("1'B0"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
map(symbol("1'B1"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("1'B1"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
map(symbol("'b0"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("'b0"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
map(symbol("'b1"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("'b1"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
map(symbol("'B0"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("'B0"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
map(symbol("'B1"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("'B1"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
map(symbol("1"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("1"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
map(symbol("0"), |x| ScalarConstant { nodes: (x,) }),
|
map(keyword("0"), |x| ScalarConstant { nodes: (x,) }),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
@ -137,10 +137,10 @@ pub fn udp_body(s: Span) -> IResult<Span, UdpBody> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn combinational_body(s: Span) -> IResult<Span, CombinationalBody> {
|
pub fn combinational_body(s: Span) -> IResult<Span, CombinationalBody> {
|
||||||
let (s, a) = symbol("table")(s)?;
|
let (s, a) = keyword("table")(s)?;
|
||||||
let (s, b) = combinational_entry(s)?;
|
let (s, b) = combinational_entry(s)?;
|
||||||
let (s, c) = many0(combinational_entry)(s)?;
|
let (s, c) = many0(combinational_entry)(s)?;
|
||||||
let (s, d) = symbol("endtable")(s)?;
|
let (s, d) = keyword("endtable")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
CombinationalBody {
|
CombinationalBody {
|
||||||
@ -166,10 +166,10 @@ pub fn combinational_entry(s: Span) -> IResult<Span, CombinationalEntry> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn sequential_body(s: Span) -> IResult<Span, SequentialBody> {
|
pub fn sequential_body(s: Span) -> IResult<Span, SequentialBody> {
|
||||||
let (s, a) = opt(udp_initial_statement)(s)?;
|
let (s, a) = opt(udp_initial_statement)(s)?;
|
||||||
let (s, b) = symbol("table")(s)?;
|
let (s, b) = keyword("table")(s)?;
|
||||||
let (s, c) = sequential_entry(s)?;
|
let (s, c) = sequential_entry(s)?;
|
||||||
let (s, d) = many0(sequential_entry)(s)?;
|
let (s, d) = many0(sequential_entry)(s)?;
|
||||||
let (s, e) = symbol("endtable")(s)?;
|
let (s, e) = keyword("endtable")(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
SequentialBody {
|
SequentialBody {
|
||||||
@ -180,7 +180,7 @@ pub fn sequential_body(s: Span) -> IResult<Span, SequentialBody> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_initial_statement(s: Span) -> IResult<Span, UdpInitialStatement> {
|
pub fn udp_initial_statement(s: Span) -> IResult<Span, UdpInitialStatement> {
|
||||||
let (s, a) = symbol("initial")(s)?;
|
let (s, a) = keyword("initial")(s)?;
|
||||||
let (s, b) = output_port_identifier(s)?;
|
let (s, b) = output_port_identifier(s)?;
|
||||||
let (s, c) = symbol("=")(s)?;
|
let (s, c) = symbol("=")(s)?;
|
||||||
let (s, d) = init_val(s)?;
|
let (s, d) = init_val(s)?;
|
||||||
@ -196,16 +196,16 @@ pub fn udp_initial_statement(s: Span) -> IResult<Span, UdpInitialStatement> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn init_val(s: Span) -> IResult<Span, InitVal> {
|
pub fn init_val(s: Span) -> IResult<Span, InitVal> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("1'b0"), |x| InitVal { nodes: (x,) }),
|
map(keyword("1'b0"), |x| InitVal { nodes: (x,) }),
|
||||||
map(symbol("1'b1"), |x| InitVal { nodes: (x,) }),
|
map(keyword("1'b1"), |x| InitVal { nodes: (x,) }),
|
||||||
map(symbol("1'bx"), |x| InitVal { nodes: (x,) }),
|
map(keyword("1'bx"), |x| InitVal { nodes: (x,) }),
|
||||||
map(symbol("1'bX"), |x| InitVal { nodes: (x,) }),
|
map(keyword("1'bX"), |x| InitVal { nodes: (x,) }),
|
||||||
map(symbol("1'B0"), |x| InitVal { nodes: (x,) }),
|
map(keyword("1'B0"), |x| InitVal { nodes: (x,) }),
|
||||||
map(symbol("1'B1"), |x| InitVal { nodes: (x,) }),
|
map(keyword("1'B1"), |x| InitVal { nodes: (x,) }),
|
||||||
map(symbol("1'Bx"), |x| InitVal { nodes: (x,) }),
|
map(keyword("1'Bx"), |x| InitVal { nodes: (x,) }),
|
||||||
map(symbol("1'BX"), |x| InitVal { nodes: (x,) }),
|
map(keyword("1'BX"), |x| InitVal { nodes: (x,) }),
|
||||||
map(symbol("1"), |x| InitVal { nodes: (x,) }),
|
map(keyword("1"), |x| InitVal { nodes: (x,) }),
|
||||||
map(symbol("0"), |x| InitVal { nodes: (x,) }),
|
map(keyword("0"), |x| InitVal { nodes: (x,) }),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,37 +279,37 @@ pub fn next_state(s: Span) -> IResult<Span, NextState> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn output_symbol(s: Span) -> IResult<Span, OutputSymbol> {
|
pub fn output_symbol(s: Span) -> IResult<Span, OutputSymbol> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("0"), |x| OutputSymbol { nodes: (x,) }),
|
map(keyword("0"), |x| OutputSymbol { nodes: (x,) }),
|
||||||
map(symbol("1"), |x| OutputSymbol { nodes: (x,) }),
|
map(keyword("1"), |x| OutputSymbol { nodes: (x,) }),
|
||||||
map(symbol("x"), |x| OutputSymbol { nodes: (x,) }),
|
map(keyword("x"), |x| OutputSymbol { nodes: (x,) }),
|
||||||
map(symbol("X"), |x| OutputSymbol { nodes: (x,) }),
|
map(keyword("X"), |x| OutputSymbol { nodes: (x,) }),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn level_symbol(s: Span) -> IResult<Span, LevelSymbol> {
|
pub fn level_symbol(s: Span) -> IResult<Span, LevelSymbol> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("0"), |x| LevelSymbol { nodes: (x,) }),
|
map(keyword("0"), |x| LevelSymbol { nodes: (x,) }),
|
||||||
map(symbol("1"), |x| LevelSymbol { nodes: (x,) }),
|
map(keyword("1"), |x| LevelSymbol { nodes: (x,) }),
|
||||||
map(symbol("x"), |x| LevelSymbol { nodes: (x,) }),
|
map(keyword("x"), |x| LevelSymbol { nodes: (x,) }),
|
||||||
map(symbol("X"), |x| LevelSymbol { nodes: (x,) }),
|
map(keyword("X"), |x| LevelSymbol { nodes: (x,) }),
|
||||||
map(symbol("?"), |x| LevelSymbol { nodes: (x,) }),
|
map(keyword("?"), |x| LevelSymbol { nodes: (x,) }),
|
||||||
map(symbol("b"), |x| LevelSymbol { nodes: (x,) }),
|
map(keyword("b"), |x| LevelSymbol { nodes: (x,) }),
|
||||||
map(symbol("B"), |x| LevelSymbol { nodes: (x,) }),
|
map(keyword("B"), |x| LevelSymbol { nodes: (x,) }),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn edge_symbol(s: Span) -> IResult<Span, EdgeSymbol> {
|
pub fn edge_symbol(s: Span) -> IResult<Span, EdgeSymbol> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("r"), |x| EdgeSymbol { nodes: (x,) }),
|
map(keyword("r"), |x| EdgeSymbol { nodes: (x,) }),
|
||||||
map(symbol("R"), |x| EdgeSymbol { nodes: (x,) }),
|
map(keyword("R"), |x| EdgeSymbol { nodes: (x,) }),
|
||||||
map(symbol("f"), |x| EdgeSymbol { nodes: (x,) }),
|
map(keyword("f"), |x| EdgeSymbol { nodes: (x,) }),
|
||||||
map(symbol("F"), |x| EdgeSymbol { nodes: (x,) }),
|
map(keyword("F"), |x| EdgeSymbol { nodes: (x,) }),
|
||||||
map(symbol("p"), |x| EdgeSymbol { nodes: (x,) }),
|
map(keyword("p"), |x| EdgeSymbol { nodes: (x,) }),
|
||||||
map(symbol("P"), |x| EdgeSymbol { nodes: (x,) }),
|
map(keyword("P"), |x| EdgeSymbol { nodes: (x,) }),
|
||||||
map(symbol("n"), |x| EdgeSymbol { nodes: (x,) }),
|
map(keyword("n"), |x| EdgeSymbol { nodes: (x,) }),
|
||||||
map(symbol("N"), |x| EdgeSymbol { nodes: (x,) }),
|
map(keyword("N"), |x| EdgeSymbol { nodes: (x,) }),
|
||||||
map(symbol("*"), |x| EdgeSymbol { nodes: (x,) }),
|
map(keyword("*"), |x| EdgeSymbol { nodes: (x,) }),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ pub struct UdpDeclarationWildcard<'a> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_nonansi_declaration(s: Span) -> IResult<Span, UdpNonansiDeclaration> {
|
pub fn udp_nonansi_declaration(s: Span) -> IResult<Span, UdpNonansiDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("primitive")(s)?;
|
let (s, b) = keyword("primitive")(s)?;
|
||||||
let (s, c) = udp_identifier(s)?;
|
let (s, c) = udp_identifier(s)?;
|
||||||
let (s, d) = paren(udp_port_list)(s)?;
|
let (s, d) = paren(udp_port_list)(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
@ -106,7 +106,7 @@ pub fn udp_nonansi_declaration(s: Span) -> IResult<Span, UdpNonansiDeclaration>
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_ansi_declaration(s: Span) -> IResult<Span, UdpAnsiDeclaration> {
|
pub fn udp_ansi_declaration(s: Span) -> IResult<Span, UdpAnsiDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("primitive")(s)?;
|
let (s, b) = keyword("primitive")(s)?;
|
||||||
let (s, c) = udp_identifier(s)?;
|
let (s, c) = udp_identifier(s)?;
|
||||||
let (s, d) = paren(udp_declaration_port_list)(s)?;
|
let (s, d) = paren(udp_declaration_port_list)(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
@ -135,7 +135,7 @@ pub fn udp_declaration_nonansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
|||||||
let (s, b) = udp_port_declaration(s)?;
|
let (s, b) = udp_port_declaration(s)?;
|
||||||
let (s, c) = many0(udp_port_declaration)(s)?;
|
let (s, c) = many0(udp_port_declaration)(s)?;
|
||||||
let (s, d) = udp_body(s)?;
|
let (s, d) = udp_body(s)?;
|
||||||
let (s, e) = symbol("endprimitive")(s)?;
|
let (s, e) = keyword("endprimitive")(s)?;
|
||||||
let (s, f) = opt(pair(symbol(":"), udp_identifier))(s)?;
|
let (s, f) = opt(pair(symbol(":"), udp_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -149,7 +149,7 @@ pub fn udp_declaration_nonansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
|||||||
pub fn udp_declaration_ansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
pub fn udp_declaration_ansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
||||||
let (s, a) = udp_ansi_declaration(s)?;
|
let (s, a) = udp_ansi_declaration(s)?;
|
||||||
let (s, b) = udp_body(s)?;
|
let (s, b) = udp_body(s)?;
|
||||||
let (s, c) = symbol("endprimitive")(s)?;
|
let (s, c) = keyword("endprimitive")(s)?;
|
||||||
let (s, d) = opt(pair(symbol(":"), udp_identifier))(s)?;
|
let (s, d) = opt(pair(symbol(":"), udp_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -161,7 +161,7 @@ pub fn udp_declaration_ansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_declaration_extern_nonansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
pub fn udp_declaration_extern_nonansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = udp_nonansi_declaration(s)?;
|
let (s, b) = udp_nonansi_declaration(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -171,7 +171,7 @@ pub fn udp_declaration_extern_nonansi(s: Span) -> IResult<Span, UdpDeclaration>
|
|||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_declaration_extern_ansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
pub fn udp_declaration_extern_ansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
||||||
let (s, a) = symbol("extern")(s)?;
|
let (s, a) = keyword("extern")(s)?;
|
||||||
let (s, b) = udp_ansi_declaration(s)?;
|
let (s, b) = udp_ansi_declaration(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -182,13 +182,13 @@ pub fn udp_declaration_extern_ansi(s: Span) -> IResult<Span, UdpDeclaration> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_declaration_wildcard(s: Span) -> IResult<Span, UdpDeclaration> {
|
pub fn udp_declaration_wildcard(s: Span) -> IResult<Span, UdpDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("primitive")(s)?;
|
let (s, b) = keyword("primitive")(s)?;
|
||||||
let (s, c) = udp_identifier(s)?;
|
let (s, c) = udp_identifier(s)?;
|
||||||
let (s, d) = paren(symbol(".*"))(s)?;
|
let (s, d) = paren(symbol(".*"))(s)?;
|
||||||
let (s, e) = symbol(";")(s)?;
|
let (s, e) = symbol(";")(s)?;
|
||||||
let (s, f) = many0(udp_port_declaration)(s)?;
|
let (s, f) = many0(udp_port_declaration)(s)?;
|
||||||
let (s, g) = udp_body(s)?;
|
let (s, g) = udp_body(s)?;
|
||||||
let (s, h) = symbol("endprimitive")(s)?;
|
let (s, h) = keyword("endprimitive")(s)?;
|
||||||
let (s, i) = opt(pair(symbol(":"), udp_identifier))(s)?;
|
let (s, i) = opt(pair(symbol(":"), udp_identifier))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
|
@ -114,7 +114,7 @@ pub fn udp_output_declaration(s: Span) -> IResult<Span, UdpOutputDeclaration> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_output_declaration_nonreg(s: Span) -> IResult<Span, UdpOutputDeclaration> {
|
pub fn udp_output_declaration_nonreg(s: Span) -> IResult<Span, UdpOutputDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("output")(s)?;
|
let (s, b) = keyword("output")(s)?;
|
||||||
let (s, c) = port_identifier(s)?;
|
let (s, c) = port_identifier(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
@ -125,8 +125,8 @@ pub fn udp_output_declaration_nonreg(s: Span) -> IResult<Span, UdpOutputDeclarat
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_output_declaration_reg(s: Span) -> IResult<Span, UdpOutputDeclaration> {
|
pub fn udp_output_declaration_reg(s: Span) -> IResult<Span, UdpOutputDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("output")(s)?;
|
let (s, b) = keyword("output")(s)?;
|
||||||
let (s, c) = symbol("reg")(s)?;
|
let (s, c) = keyword("reg")(s)?;
|
||||||
let (s, d) = port_identifier(s)?;
|
let (s, d) = port_identifier(s)?;
|
||||||
let (s, e) = opt(pair(symbol("="), constant_expression))(s)?;
|
let (s, e) = opt(pair(symbol("="), constant_expression))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -140,7 +140,7 @@ pub fn udp_output_declaration_reg(s: Span) -> IResult<Span, UdpOutputDeclaration
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_input_declaration(s: Span) -> IResult<Span, UdpInputDeclaration> {
|
pub fn udp_input_declaration(s: Span) -> IResult<Span, UdpInputDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("input")(s)?;
|
let (s, b) = keyword("input")(s)?;
|
||||||
let (s, c) = list_of_udp_port_identifiers(s)?;
|
let (s, c) = list_of_udp_port_identifiers(s)?;
|
||||||
Ok((s, UdpInputDeclaration { nodes: (a, b, c) }))
|
Ok((s, UdpInputDeclaration { nodes: (a, b, c) }))
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ pub fn udp_input_declaration(s: Span) -> IResult<Span, UdpInputDeclaration> {
|
|||||||
#[parser]
|
#[parser]
|
||||||
pub fn udp_reg_declaration(s: Span) -> IResult<Span, UdpRegDeclaration> {
|
pub fn udp_reg_declaration(s: Span) -> IResult<Span, UdpRegDeclaration> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = symbol("reg")(s)?;
|
let (s, b) = keyword("reg")(s)?;
|
||||||
let (s, c) = variable_identifier(s)?;
|
let (s, c) = variable_identifier(s)?;
|
||||||
Ok((s, UdpRegDeclaration { nodes: (a, b, c) }))
|
Ok((s, UdpRegDeclaration { nodes: (a, b, c) }))
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,262 @@ use nom::bytes::complete::*;
|
|||||||
use nom::character::complete::*;
|
use nom::character::complete::*;
|
||||||
use nom::combinator::*;
|
use nom::combinator::*;
|
||||||
use nom::multi::*;
|
use nom::multi::*;
|
||||||
|
use nom::sequence::*;
|
||||||
use nom::IResult;
|
use nom::IResult;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const KEYWORDS: &[&str] = &[
|
||||||
|
"accept_on",
|
||||||
|
"alias",
|
||||||
|
"always",
|
||||||
|
"always_comb",
|
||||||
|
"always_ff",
|
||||||
|
"always_latch",
|
||||||
|
"and",
|
||||||
|
"assert",
|
||||||
|
"assign",
|
||||||
|
"assume",
|
||||||
|
"automatic",
|
||||||
|
"before",
|
||||||
|
"begin",
|
||||||
|
"bind",
|
||||||
|
"bins",
|
||||||
|
"binsof",
|
||||||
|
"bit",
|
||||||
|
"break",
|
||||||
|
"buf",
|
||||||
|
"bufif0",
|
||||||
|
"bufif1",
|
||||||
|
"byte",
|
||||||
|
"case",
|
||||||
|
"casex",
|
||||||
|
"casez",
|
||||||
|
"cell",
|
||||||
|
"chandle",
|
||||||
|
"checker",
|
||||||
|
"class",
|
||||||
|
"clocking",
|
||||||
|
"cmos",
|
||||||
|
"config",
|
||||||
|
"const",
|
||||||
|
"constraint",
|
||||||
|
"context",
|
||||||
|
"continue",
|
||||||
|
"cover",
|
||||||
|
"covergroup",
|
||||||
|
"coverpoint",
|
||||||
|
"cross",
|
||||||
|
"deassign",
|
||||||
|
"default",
|
||||||
|
"defparam",
|
||||||
|
"design",
|
||||||
|
"disable",
|
||||||
|
"dist",
|
||||||
|
"do",
|
||||||
|
"edge",
|
||||||
|
"else",
|
||||||
|
"end",
|
||||||
|
"endcase",
|
||||||
|
"endchecker",
|
||||||
|
"endclass",
|
||||||
|
"endclocking",
|
||||||
|
"endconfig",
|
||||||
|
"endfunction",
|
||||||
|
"endgenerate",
|
||||||
|
"endgroup",
|
||||||
|
"endinterface",
|
||||||
|
"endmodule",
|
||||||
|
"endpackage",
|
||||||
|
"endprimitive",
|
||||||
|
"endprogram",
|
||||||
|
"endproperty",
|
||||||
|
"endspecify",
|
||||||
|
"endsequence",
|
||||||
|
"endtable",
|
||||||
|
"endtask",
|
||||||
|
"enum",
|
||||||
|
"event",
|
||||||
|
"eventually",
|
||||||
|
"expect",
|
||||||
|
"export",
|
||||||
|
"extends",
|
||||||
|
"extern",
|
||||||
|
"final",
|
||||||
|
"first_match",
|
||||||
|
"for",
|
||||||
|
"force",
|
||||||
|
"foreach",
|
||||||
|
"forever",
|
||||||
|
"fork",
|
||||||
|
"forkjoin",
|
||||||
|
"function",
|
||||||
|
"generate",
|
||||||
|
"genvar",
|
||||||
|
"global",
|
||||||
|
"highz0",
|
||||||
|
"highz1",
|
||||||
|
"if",
|
||||||
|
"iff",
|
||||||
|
"ifnone",
|
||||||
|
"ignore_bins",
|
||||||
|
"illegal_bins",
|
||||||
|
"implements",
|
||||||
|
"implies",
|
||||||
|
"import",
|
||||||
|
"incdir",
|
||||||
|
"include",
|
||||||
|
"initial",
|
||||||
|
"inout",
|
||||||
|
"input",
|
||||||
|
"inside",
|
||||||
|
"instance",
|
||||||
|
"int",
|
||||||
|
"integer",
|
||||||
|
"interconnect",
|
||||||
|
"interface",
|
||||||
|
"intersect",
|
||||||
|
"join",
|
||||||
|
"join_any",
|
||||||
|
"join_none",
|
||||||
|
"large",
|
||||||
|
"let",
|
||||||
|
"liblist",
|
||||||
|
"library",
|
||||||
|
"local",
|
||||||
|
"localparam",
|
||||||
|
"logic",
|
||||||
|
"longint",
|
||||||
|
"macromodule",
|
||||||
|
"matches",
|
||||||
|
"medium",
|
||||||
|
"modport",
|
||||||
|
"module",
|
||||||
|
"nand",
|
||||||
|
"negedge",
|
||||||
|
"nettype",
|
||||||
|
"new",
|
||||||
|
"nexttime",
|
||||||
|
"nmos",
|
||||||
|
"nor",
|
||||||
|
"noshowcancelled",
|
||||||
|
"not",
|
||||||
|
"notif0",
|
||||||
|
"notif1",
|
||||||
|
"null",
|
||||||
|
"or",
|
||||||
|
"output",
|
||||||
|
"package",
|
||||||
|
"packed",
|
||||||
|
"parameter",
|
||||||
|
"pmos",
|
||||||
|
"posedge",
|
||||||
|
"primitive",
|
||||||
|
"priority",
|
||||||
|
"program",
|
||||||
|
"property",
|
||||||
|
"protected",
|
||||||
|
"pull0",
|
||||||
|
"pull1",
|
||||||
|
"pulldown",
|
||||||
|
"pullup",
|
||||||
|
"pulsestyle_ondetect",
|
||||||
|
"pulsestyle_onevent",
|
||||||
|
"pure",
|
||||||
|
"rand",
|
||||||
|
"randc",
|
||||||
|
"randcase",
|
||||||
|
"randsequence",
|
||||||
|
"rcmos",
|
||||||
|
"real",
|
||||||
|
"realtime",
|
||||||
|
"ref",
|
||||||
|
"reg",
|
||||||
|
"reject_on",
|
||||||
|
"release",
|
||||||
|
"repeat",
|
||||||
|
"restrict",
|
||||||
|
"return",
|
||||||
|
"rnmos",
|
||||||
|
"rpmos",
|
||||||
|
"rtran",
|
||||||
|
"rtranif0",
|
||||||
|
"rtranif1",
|
||||||
|
"s_always",
|
||||||
|
"s_eventually",
|
||||||
|
"s_nexttime",
|
||||||
|
"s_until",
|
||||||
|
"s_until_with",
|
||||||
|
"scalared",
|
||||||
|
"sequence",
|
||||||
|
"shortint",
|
||||||
|
"shortreal",
|
||||||
|
"showcancelled",
|
||||||
|
"signed",
|
||||||
|
"small",
|
||||||
|
"soft",
|
||||||
|
"solve",
|
||||||
|
"specify",
|
||||||
|
"specparam",
|
||||||
|
"static",
|
||||||
|
"string",
|
||||||
|
"strong",
|
||||||
|
"strong0",
|
||||||
|
"strong1",
|
||||||
|
"struct",
|
||||||
|
"super",
|
||||||
|
"supply0",
|
||||||
|
"supply1",
|
||||||
|
"sync_accept_on",
|
||||||
|
"sync_reject_on",
|
||||||
|
"table",
|
||||||
|
"tagged",
|
||||||
|
"task",
|
||||||
|
"this",
|
||||||
|
"throughout",
|
||||||
|
"time",
|
||||||
|
"timeprecision",
|
||||||
|
"timeunit",
|
||||||
|
"tran",
|
||||||
|
"tranif0",
|
||||||
|
"tranif1",
|
||||||
|
"tri",
|
||||||
|
"tri0",
|
||||||
|
"tri1",
|
||||||
|
"triand",
|
||||||
|
"trior",
|
||||||
|
"trireg",
|
||||||
|
"type",
|
||||||
|
"typedef",
|
||||||
|
"union",
|
||||||
|
"unique",
|
||||||
|
"unique0",
|
||||||
|
"unsigned",
|
||||||
|
"until",
|
||||||
|
"until_with",
|
||||||
|
"untyped",
|
||||||
|
"use",
|
||||||
|
"uwire",
|
||||||
|
"var",
|
||||||
|
"vectored",
|
||||||
|
"virtual",
|
||||||
|
"void",
|
||||||
|
"wait",
|
||||||
|
"wait_order",
|
||||||
|
"wand",
|
||||||
|
"weak",
|
||||||
|
"weak0",
|
||||||
|
"weak1",
|
||||||
|
"while",
|
||||||
|
"wildcard",
|
||||||
|
"wire",
|
||||||
|
"with",
|
||||||
|
"within",
|
||||||
|
"wor",
|
||||||
|
"xnor",
|
||||||
|
"xor",
|
||||||
|
];
|
||||||
|
|
||||||
#[derive(Debug, Node)]
|
#[derive(Debug, Node)]
|
||||||
pub struct Symbol<'a> {
|
pub struct Symbol<'a> {
|
||||||
pub nodes: (Span<'a>, Vec<WhiteSpace<'a>>),
|
pub nodes: (Span<'a>, Vec<WhiteSpace<'a>>),
|
||||||
@ -74,6 +326,24 @@ pub fn symbol<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Symbol<'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn keyword<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Symbol<'a>> {
|
||||||
|
move |s: Span<'a>| {
|
||||||
|
if cfg!(feature = "trace") {
|
||||||
|
println!(
|
||||||
|
"{:<64} : {:<4},{:>032x} : {}",
|
||||||
|
format!("keyword(\"{}\")", t),
|
||||||
|
s.offset,
|
||||||
|
s.extra[0],
|
||||||
|
s.fragment
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let (s, x) = map(ws(terminated(tag(t.clone()), peek(none_of(AZ09_)))), |x| {
|
||||||
|
Symbol { nodes: x }
|
||||||
|
})(s)?;
|
||||||
|
Ok((clear_recursive_flags(s), x))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn paren<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Paren<O>>
|
pub fn paren<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Paren<O>>
|
||||||
where
|
where
|
||||||
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
|
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
|
||||||
@ -195,6 +465,28 @@ where
|
|||||||
move |s: Span<'a>| Ok((s, None))
|
move |s: Span<'a>| Ok((s, None))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn alt_left<'a, O, F, G>(f: F, _g: G) -> impl Fn(Span<'a>) -> IResult<Span<'a>, O>
|
||||||
|
where
|
||||||
|
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
|
||||||
|
G: Fn(Span<'a>) -> IResult<Span<'a>, O>,
|
||||||
|
{
|
||||||
|
move |s: Span<'a>| {
|
||||||
|
let (s, x) = f(s)?;
|
||||||
|
Ok((s, x))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn alt_right<'a, O, F, G>(_f: F, g: G) -> impl Fn(Span<'a>) -> IResult<Span<'a>, O>
|
||||||
|
where
|
||||||
|
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
|
||||||
|
G: Fn(Span<'a>) -> IResult<Span<'a>, O>,
|
||||||
|
{
|
||||||
|
move |s: Span<'a>| {
|
||||||
|
let (s, x) = g(s)?;
|
||||||
|
Ok((s, x))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
#[parser]
|
#[parser]
|
||||||
@ -254,6 +546,15 @@ pub fn clear_recursive_flags(s: Span) -> Span {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_keyword(s: &Span) -> bool {
|
||||||
|
for k in KEYWORDS {
|
||||||
|
if &s.fragment == k {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -260,6 +260,10 @@ fn impl_parser_body_ambiguous(item: &ItemFn) -> TokenStream {
|
|||||||
let rest = rest.replacen("ambiguous_opt", &format!("amb_temporary{}", i), 1);
|
let rest = rest.replacen("ambiguous_opt", &format!("amb_temporary{}", i), 1);
|
||||||
token = format!("{}{}", head, rest);
|
token = format!("{}{}", head, rest);
|
||||||
replace_parsers.push(("opt", "none"));
|
replace_parsers.push(("opt", "none"));
|
||||||
|
} else if rest.starts_with("ambiguous_alt") {
|
||||||
|
let rest = rest.replacen("ambiguous_alt", &format!("amb_temporary{}", i), 1);
|
||||||
|
token = format!("{}{}", head, rest);
|
||||||
|
replace_parsers.push(("alt_left", "alt_right"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user