Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
c0282862
Commit
c0282862
authored
May 29, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error if procedural block has a decl after a stmt
parent
7ffea36d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
src/Language/SystemVerilog/Parser/Parse.y
+10
-3
test/error/decl_after_stmt.sv
+10
-0
No files found.
src/Language/SystemVerilog/Parser/Parse.y
View file @
c0282862
...
...
@@ -1081,7 +1081,7 @@ IdxVar :: { Identifier }
|
Identifier
{
$
1
}
DeclsAndStmts
::
{
([
Decl
],
[
Stmt
])
}
:
StmtTrace
DeclOrStmt
DeclsAndStmts
{
combineDeclsAndStmts
$
2
$
3
}
:
StmtTrace
DeclOrStmt
DeclsAndStmts
{
%
combineDeclsAndStmts
$
2
$
3
}
|
StmtTrace
StmtNonAsgn
Stmts
{
(
[]
,
$
1
:
$
2
:
$
3
)
}
|
StmtTrace
{- empty -}
{
(
[]
,
[]
)
}
DeclOrStmt
::
{
([
Decl
],
[
Stmt
])
}
...
...
@@ -1446,8 +1446,15 @@ genItemsToGenItem :: [GenItem] -> GenItem
genItemsToGenItem
[
x
]
=
x
genItemsToGenItem
xs
=
GenBlock
""
xs
combineDeclsAndStmts
::
([
Decl
],
[
Stmt
])
->
([
Decl
],
[
Stmt
])
->
([
Decl
],
[
Stmt
])
combineDeclsAndStmts
(
a1
,
b1
)
(
a2
,
b2
)
=
(
a1
++
a2
,
b1
++
b2
)
combineDeclsAndStmts
::
([
Decl
],
[
Stmt
])
->
([
Decl
],
[
Stmt
])
->
ParseState
([
Decl
],
[
Stmt
])
combineDeclsAndStmts
(
a1
,
b1
)
(
a2
,
b2
)
=
if
not
(
null
b1
)
&&
not
(
null
a2
)
then
do
p
<-
gets
pPosition
throwError
$
show
p
++
": Parse error: procedural block contains a declaration after a statement"
else
return
(
a1
++
a2
,
b1
++
b2
)
makeInput
::
Decl
->
Decl
makeInput
(
Variable
Local
t
x
a
e
)
=
Variable
Input
t
x
a
e
...
...
test/error/decl_after_stmt.sv
0 → 100644
View file @
c0282862
// pattern: procedural block contains a declaration after a statement
module
top
;
task
t
;
$
display
(
"t()"
)
;
endtask
initial
begin
t
;
localparam
X
=
3
;
end
endmodule
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment