mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-07 06:33:24 +00:00
Support array ranges for identifiers in the Liberty parser.
This change only handles the case `id : id[range] ;`.
This commit is contained in:
parent
ac1033ecd5
commit
23f59e0196
2 changed files with 5 additions and 3 deletions
|
@ -436,7 +436,9 @@ LibertyAst *LibertyParser::parse()
|
||||||
if (tok == ':' && ast->value.empty()) {
|
if (tok == ':' && ast->value.empty()) {
|
||||||
tok = lexer(ast->value);
|
tok = lexer(ast->value);
|
||||||
if (tok == 'v') {
|
if (tok == 'v') {
|
||||||
tok = lexer(str);
|
tok = lexer(str);
|
||||||
|
if (tok == '[')
|
||||||
|
tok = parse_vector_range(tok);
|
||||||
}
|
}
|
||||||
while (tok == '+' || tok == '-' || tok == '*' || tok == '/' || tok == '!') {
|
while (tok == '+' || tok == '-' || tok == '*' || tok == '/' || tok == '!') {
|
||||||
ast->value += tok;
|
ast->value += tok;
|
||||||
|
|
|
@ -105,8 +105,8 @@ namespace Yosys
|
||||||
*/
|
*/
|
||||||
int lexer(std::string &str);
|
int lexer(std::string &str);
|
||||||
|
|
||||||
void report_unexpected_token(int tok);
|
void report_unexpected_token(int tok);
|
||||||
int parse_vector_range(int tok);
|
int parse_vector_range(int tok);
|
||||||
LibertyAst *parse();
|
LibertyAst *parse();
|
||||||
void error() const;
|
void error() const;
|
||||||
void error(const std::string &str) const;
|
void error(const std::string &str) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue