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
ad98c145
Commit
ad98c145
authored
Jan 27, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix handling of macros at EOF (resolves #62)
parent
bbd072d4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
1 deletions
+24
-1
src/Language/SystemVerilog/Parser/Lex.x
+10
-1
test/lex/no_newline.sv
+6
-0
test/lex/no_newline.v
+6
-0
test/lex/no_newline.vh
+2
-0
No files found.
src/Language/SystemVerilog/Parser/Lex.x
View file @
ad98c145
...
@@ -787,6 +787,11 @@ peekChar = do
...
@@ -787,6 +787,11 @@ peekChar = do
then lexicalError "unexpected end of input"
then lexicalError "unexpected end of input"
else return $head str
else return $head str
atEOF :: Alex Bool
atEOF = do
(_, _, _, str) <- alexGetInput
return $ null str
takeMacroDefinition :: Alex (String, [(String, Maybe String)])
takeMacroDefinition :: Alex (String, [(String, Maybe String)])
takeMacroDefinition = do
takeMacroDefinition = do
leadCh <- peekChar
leadCh <- peekChar
...
@@ -1068,7 +1073,11 @@ handleDirective (posOrig, _, _, strOrig) len = do
...
@@ -1068,7 +1073,11 @@ handleDirective (posOrig, _, _, strOrig) len = do
"define" -> do
"define" -> do
dropSpaces
dropSpaces
name <- takeString
name <- takeString
defn <- takeMacroDefinition
defn <- do
eof <- atEOF
if eof
then return ("", [])
else takeMacroDefinition
modify $ \s -> s { lsEnv = Map.insert name defn env }
modify $ \s -> s { lsEnv = Map.insert name defn env }
alexMonadScan
alexMonadScan
"undef" -> do
"undef" -> do
...
...
test/lex/no_newline.sv
0 → 100644
View file @
ad98c145
`include
"no_newline.vh"
module
top
;
`ifdef
A
initial
$
display
(
"A is defined!"
)
;
`endif
endmodule
test/lex/no_newline.v
0 → 100644
View file @
ad98c145
`include
"no_newline.vh"
module
top
;
`ifdef
A
initial
$
display
(
"A is defined!"
)
;
`endif
endmodule
test/lex/no_newline.vh
0 → 100644
View file @
ad98c145
`define A
\ No newline at end of file
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