Skip to content

Commit

Permalink
vlindex: fix parsing for constraint_block
Browse files Browse the repository at this point in the history
  • Loading branch information
kroening committed Jan 6, 2025
1 parent bc38997 commit f83443d
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/vlindex/vlindex_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,14 +932,31 @@ void verilog_indexer_parsert::rConstraint()
next_token(); // static
}

next_token(); // constraint
auto constraint_token = next_token(); // constraint
PRECONDITION(constraint_token == TOK_CONSTRAINT);

next_token(); // identifier

if(next_token() != '{') // onstraint_block
return; // error
// constraint_block
auto first = next_token();
if(first != '{')
return; // error
std::size_t count = 1;

skip_until('}');
while(true)
{
auto token = next_token();
if(token.is_eof())
return;
else if(token == '{')
count++;
else if(token == '}')
{
if(count == 1)
return;
count--;
}
}
}

void verilog_indexer_parsert::rContinuousAssign()
Expand Down

0 comments on commit f83443d

Please sign in to comment.