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
638adb35
Commit
638adb35
authored
Sep 01, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed ParseDecl mischaracterizing block decl as stmt
parent
704e867c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
src/Language/SystemVerilog/Parser/ParseDecl.hs
+16
-9
No files found.
src/Language/SystemVerilog/Parser/ParseDecl.hs
View file @
638adb35
...
...
@@ -183,8 +183,8 @@ parseDTsAsDeclOrAsgn :: [DeclToken] -> ([Decl], [Stmt])
parseDTsAsDeclOrAsgn
[
DTIdent
f
]
=
(
[]
,
[
Subroutine
(
Nothing
)
f
(
Args
[]
[]
)])
parseDTsAsDeclOrAsgn
[
DTPSIdent
p
f
]
=
(
[]
,
[
Subroutine
(
Just
p
)
f
(
Args
[]
[]
)])
parseDTsAsDeclOrAsgn
tokens
=
if
any
isAsgnToken
tokens
||
tripLookahead
tokens
then
(
[]
,
[
constructor
lhs
expr
])
if
(
any
isAsgnToken
tokens
||
tripLookahead
tokens
)
&&
lhs
/=
Nothing
then
(
[]
,
[
constructor
(
fromJust
lhs
)
expr
])
else
(
parseDTsAsDecl
tokens
,
[]
)
where
(
constructor
,
expr
)
=
case
last
tokens
of
...
...
@@ -201,7 +201,10 @@ parseDTsAsDeclsAndAsgns tokens =
if
hasLeadingAsgn
||
tripLookahead
tokens
then
let
(
lhsToks
,
l0
)
=
break
isDTAsgn
tokens
lhs
=
takeLHS
lhsToks
lhs
=
case
takeLHS
lhsToks
of
Nothing
->
error
$
"could not parse as LHS: "
++
show
lhsToks
Just
l
->
l
DTAsgn
AsgnOpEq
expr
:
l1
=
l0
asgn
=
Right
(
lhs
,
expr
)
in
case
l1
of
...
...
@@ -231,17 +234,21 @@ isAsgnToken (DTAsgnNBlk _ _) = True
isAsgnToken
(
DTAsgn
(
AsgnOp
_
)
_
)
=
True
isAsgnToken
_
=
False
takeLHS
::
[
DeclToken
]
->
LHS
takeLHS
tokens
=
fromJust
$
foldl
takeLHSStep
Nothing
tokens
takeLHS
::
[
DeclToken
]
->
Maybe
LHS
takeLHS
[]
=
Nothing
takeLHS
(
t
:
ts
)
=
foldl
takeLHSStep
(
takeLHSStart
t
)
ts
takeLHSStart
::
DeclToken
->
Maybe
LHS
takeLHSStart
(
DTConcat
lhss
)
=
Just
$
LHSConcat
lhss
takeLHSStart
(
DTIdent
x
)
=
Just
$
LHSIdent
x
takeLHSStart
_
=
Nothing
takeLHSStep
::
Maybe
LHS
->
DeclToken
->
Maybe
LHS
takeLHSStep
(
Nothing
)
(
DTConcat
lhss
)
=
Just
$
LHSConcat
lhss
takeLHSStep
(
Nothing
)
(
DTIdent
x
)
=
Just
$
LHSIdent
x
takeLHSStep
(
Just
curr
)
(
DTBit
e
)
=
Just
$
LHSBit
curr
e
takeLHSStep
(
Just
curr
)
(
DTRange
(
m
,
r
))
=
Just
$
LHSRange
curr
m
r
takeLHSStep
(
Just
curr
)
(
DTDot
x
)
=
Just
$
LHSDot
curr
x
takeLHSStep
(
maybeCurr
)
token
=
error
$
"unexpected token in LHS: "
++
show
(
maybeCurr
,
token
)
takeLHSStep
_
_
=
Nothing
-- batches together seperate declaration lists
...
...
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