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
89e4f2a2
Commit
89e4f2a2
authored
Aug 11, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow newlines before left paren of macro arguments
parent
81f5fb50
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
21 deletions
+28
-21
src/Language/SystemVerilog/Parser/Lex.x
+15
-21
test/lex/macro_whitespace.sv
+12
-0
test/lex/macro_whitespace.v
+1
-0
No files found.
src/Language/SystemVerilog/Parser/Lex.x
View file @
89e4f2a2
...
...
@@ -485,35 +485,29 @@ takeChar = do
-- drop spaces in the input until a non-space is reached or EOF
dropSpaces :: Alex ()
dropSpaces = do
(_, _, _, str) <- alexGetInput
if null str || head str /= ' '
then return ()
else dropSpace >> dropSpaces
where
dropSpace :: Alex ()
dropSpace = do
(pos, _, _, str) <- alexGetInput
case str of
' ' : rest -> do
alexSetInput (alexMove pos ' ', ' ', [], rest)
dropSpaces
[] -> return ()
' ' : rest -> alexSetInput (alexMove pos ' ', ' ', [], rest)
ch : _ -> lexicalError $ "expected ' ', but found: " ++ show ch
_ -> return ()
isWhitespaceChar :: Char -> Bool
isWhitespaceChar ch = elem ch [' ', '\t', '\n']
-- drop leading whitespace in the input
-- drop
all
leading whitespace in the input
dropWhitespace :: Alex ()
dropWhitespace = do
(_, _, _, str) <- alexGetInput
if null str || not (isWhitespaceChar $ head str)
then return ()
else dropChar >> dropWhitespace
where
dropChar :: Alex ()
dropChar = do
(pos, _, _, chs) <- alexGetInput
let ch : rest = chs
alexSetInput (alexMove pos ch, ch, [], rest)
(pos, _, _, str) <- alexGetInput
case str of
ch : chs ->
if isWhitespaceChar ch
then do
alexSetInput (alexMove pos ch, ch, [], chs)
dropWhitespace
else return()
[] -> return ()
-- removes and returns a quoted string such as <foo.bar> or "foo.bar"
takeQuotedString :: Alex String
...
...
@@ -572,7 +566,7 @@ takeMacroDefinition = do
-- "", except to delimit arguments or end the list of arguments; see 22.5.1
takeMacroArguments :: Alex [String]
takeMacroArguments = do
drop
Spaces
drop
Whitespace
leadCh <- takeChar
if leadCh == '('
then argLoop
...
...
test/lex/macro_whitespace.sv
0 → 100644
View file @
89e4f2a2
`define
FOO
(
a
,
b
)
((
a
)
+
(
b
))
module
top
;
initial
begin
$
display
(
`FOO
(
1
,
2
))
;
end
endmodule
test/lex/macro_whitespace.v
0 → 100644
View file @
89e4f2a2
`include
"macro_whitespace.sv"
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