Skip to content

Commit

Permalink
Verilog: Do not include newline in whitespace tokens. #587
Browse files Browse the repository at this point in the history
  • Loading branch information
kraigher committed Nov 19, 2019
1 parent b92057c commit 39a2bfe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/unit/test_verilog_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ def test_tokenizes_define(self):
],
)

def test_newline_is_not_whitespace(self):
self.check(
" \n \n\n",
[
WHITESPACE(value=" "),
NEWLINE(),
WHITESPACE(value=" "),
NEWLINE(),
NEWLINE(),
],
)

def test_tokenizes_string_literal(self):
self.check('"hello"', [STRING(value="hello")])

Expand Down
2 changes: 1 addition & 1 deletion vunit/parsing/verilog/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def replace_keywords(token): # pylint: disable=missing-docstring

add(NEWLINE, r"\n", remove_value)

add(WHITESPACE, r"\s +")
add(WHITESPACE, r"[ \t]+")

add(
MULTI_COMMENT,
Expand Down

0 comments on commit 39a2bfe

Please sign in to comment.