Skip to content

Commit 2a7e1fc

Browse files
committed
modify the yacc file in order for the parser to accept a mix of
declarations and assign statements
1 parent 0994698 commit 2a7e1fc

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

libs/libvqm/vqm_parser.y

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ modules: /* Empty */ {}
8484
| modules module {}
8585
;
8686

87-
module: header declarations statements footer
87+
module: header body footer
8888
{
8989
if(parse_info->pass_type == COUNT_PASS) {
9090
parse_info->number_of_modules++;
@@ -126,11 +126,17 @@ header: TOKEN_MODULE TOKEN_REGULARID '(' IdentifierList ')' ';'
126126
}
127127
;
128128

129+
body: /* Empty */ {}
130+
| body declaration_statement {}
131+
;
132+
129133

130-
declarations: /* Empty */ {}
131-
| declarations declaration {}
134+
declaration_statement: declaration
135+
|
136+
statement
132137
;
133138

139+
134140
declaration: PinType IdentifierList ';'
135141
{
136142
if(parse_info->pass_type == COUNT_PASS) {
@@ -158,9 +164,7 @@ declaration: PinType IdentifierList ';'
158164
footer: TOKEN_ENDMODULE {}
159165
;
160166

161-
statements: /* Empty */ {}
162-
| statements statement {}
163-
;
167+
164168

165169
statement: AssignStatement {}
166170
| TriStatement {}

0 commit comments

Comments
 (0)