Merge pull request #1952 from boqwxp/add_edge_location

Verilog frontend: add source location in more parser rules
This commit is contained in:
whitequark 2020-04-17 18:57:00 +00:00 committed by GitHub
commit 67fbc00a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1924,11 +1924,13 @@ always_events:
always_event: always_event:
TOK_POSEDGE expr { TOK_POSEDGE expr {
AstNode *node = new AstNode(AST_POSEDGE); AstNode *node = new AstNode(AST_POSEDGE);
SET_AST_NODE_LOC(node, @1, @1);
ast_stack.back()->children.push_back(node); ast_stack.back()->children.push_back(node);
node->children.push_back($2); node->children.push_back($2);
} | } |
TOK_NEGEDGE expr { TOK_NEGEDGE expr {
AstNode *node = new AstNode(AST_NEGEDGE); AstNode *node = new AstNode(AST_NEGEDGE);
SET_AST_NODE_LOC(node, @1, @1);
ast_stack.back()->children.push_back(node); ast_stack.back()->children.push_back(node);
node->children.push_back($2); node->children.push_back($2);
} | } |
@ -2244,6 +2246,7 @@ behavioral_stmt:
exitTypeScope(); exitTypeScope();
if ($4 != NULL && $8 != NULL && *$4 != *$8) if ($4 != NULL && $8 != NULL && *$4 != *$8)
frontend_verilog_yyerror("Begin label (%s) and end label (%s) don't match.", $4->c_str()+1, $8->c_str()+1); frontend_verilog_yyerror("Begin label (%s) and end label (%s) don't match.", $4->c_str()+1, $8->c_str()+1);
SET_AST_NODE_LOC(ast_stack.back(), @2, @8);
delete $4; delete $4;
delete $8; delete $8;
ast_stack.pop_back(); ast_stack.pop_back();