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
9259fef2
Commit
9259fef2
authored
Mar 22, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tolerate spaces in numeric literals in line with the spec
parent
90bd6b34
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
src/Language/SystemVerilog/Parser/Lex.x
+7
-9
src/Language/SystemVerilog/Parser/Preprocess.hs
+8
-1
No files found.
src/Language/SystemVerilog/Parser/Lex.x
View file @
9259fef2
...
...
@@ -27,20 +27,18 @@ $decimalDigit = [0-9]
@unsignedNumber = $decimalDigit ("_" | $decimalDigit)*
@size = @unsignedNumber
@size = @unsignedNumber
" "?
@decimalNumber
= @unsignedNumber
| @size? @decimalBase @unsignedNumber
@binaryNumber = @size? @binaryBase @binaryValue
@octalNumber = @size? @octalBase @octalValue
@hexNumber = @size? @hexBase @hexValue
@decimalNumber = @size? @decimalBase " "? @unsignedNumber
@binaryNumber = @size? @binaryBase " "? @binaryValue
@octalNumber = @size? @octalBase " "? @octalValue
@hexNumber = @size? @hexBase " "? @hexValue
@unbasedUnsizedLiteral = "'" ( 0 | 1 | x | X | z | Z )
@number
= @decimalNumber
= @unsignedNumber
| @decimalNumber
| @octalNumber
| @binaryNumber
| @hexNumber
...
...
src/Language/SystemVerilog/Parser/Preprocess.hs
View file @
9259fef2
...
...
@@ -24,7 +24,14 @@ unskippableDirectives :: [String]
unskippableDirectives
=
[
"else"
,
"elsif"
,
"endif"
]
preprocess
::
[
Token
]
->
(
StateT
PP
IO
)
[
Token
]
preprocess
tokens
=
pp
tokens
preprocess
tokens
=
pp
tokens
>>=
return
.
combineNumbers
-- a bit of a hack to allow things like: `WIDTH'b0
combineNumbers
::
[
Token
]
->
[
Token
]
combineNumbers
(
Token
Lit_number
size
pos
:
Token
Lit_number
(
'
\'
'
:
num
)
_
:
tokens
)
=
Token
Lit_number
(
size
++
"'"
++
num
)
pos
:
combineNumbers
tokens
combineNumbers
(
token
:
tokens
)
=
token
:
combineNumbers
tokens
combineNumbers
[]
=
[]
data
Cond
=
CurrentlyTrue
...
...
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