Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vlindex: fix parsing for constraint_block #924

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
vlindex: fix parsing for constraint_block
  • Loading branch information
kroening committed Jan 6, 2025
commit f83443d2e16f51851f0807aa6cd750992d82bfd4
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
Loading