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
e8ed885f
Commit
e8ed885f
authored
Mar 07, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for single-expr implicit dimensions
parent
d7b36a03
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
src/Language/SystemVerilog/Parser/Parse.y
+5
-2
src/Language/SystemVerilog/Parser/ParseDecl.hs
+9
-3
No files found.
src/Language/SystemVerilog/Parser/Parse.y
View file @
e8ed885f
...
...
@@ -355,8 +355,11 @@ Dimensions :: { [Range] }
: {- empty -} { [] }
| DimensionsNonEmpty { $1 }
DimensionsNonEmpty :: { [Range] }
: Range { [$1] }
| DimensionsNonEmpty Range { $1 ++ [$2] }
: Dimension { [$1] }
| DimensionsNonEmpty Dimension { $1 ++ [$2] }
Dimension :: { Range }
: Range { $1 }
| "[" Expr "]" { (simplify $ BinOp Sub $2 (Number "1"), Number "0") }
DeclAsgns :: { [(Identifier, Expr)] }
: DeclAsgn { [$1] }
...
...
src/Language/SystemVerilog/Parser/ParseDecl.hs
View file @
e8ed885f
...
...
@@ -239,9 +239,15 @@ takeType (DTIdent tn : rest) = (Alias tn, rest)
takeType
rest
=
(
Implicit
,
rest
)
takeRanges
::
[
DeclToken
]
->
([
Range
],
[
DeclToken
])
takeRanges
(
DTRange
r
:
rest
)
=
(
r
:
rs
,
rest'
)
where
(
rs
,
rest'
)
=
takeRanges
rest
takeRanges
rest
=
(
[]
,
rest
)
takeRanges
[]
=
(
[]
,
[]
)
takeRanges
(
token
:
tokens
)
=
case
token
of
DTRange
r
->
(
r
:
rs
,
rest
)
DTBit
s
->
(
asRange
s
:
rs
,
rest
)
_
->
(
[]
,
token
:
tokens
)
where
(
rs
,
rest
)
=
takeRanges
tokens
asRange
s
=
(
simplify
$
BinOp
Sub
s
(
Number
"1"
),
Number
"0"
)
-- TODO: entrypoints besides `parseDTsAsDeclOrAsgn` should disallow `DTAsgnNBlk`
-- Note: matching DTAsgnNBlk too is a bit of a hack to allow for tripLookahead
...
...
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