Skip to content

Commit

Permalink
Manually apply kevinpt#17
Browse files Browse the repository at this point in the history
  • Loading branch information
sd2k9 authored and sd2k9 committed Jun 7, 2023
1 parent 099f888 commit e50a2b1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions hdlparse/verilog_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@
'root': [
# patterns
# pattern, action, new_state
(r'\bmodule\s+(\w+)\s*', 'module', 'module'),
(r'\bmodule\s*(\w+)\s*', 'module', 'module'),
(r'/\*', 'block_comment', 'block_comment'),
(r'//#+(.*)\n', 'metacomment'),
(r'//.*\n', None),
],
'module': [
(r'parameter\s*(signed|integer|realtime|real|time)?\s*(\[[^]]+\])?', 'parameter_start', 'parameters'),
(r'parameter\s+(?:(signed|integer|realtime|real|time)\s+)?(\[[^]]+\])?', 'parameter_start', 'parameters'),
(
r'^[\(\s]*(input|inout|output)\s+(reg|supply0|supply1|tri|triand|trior|tri0|tri1|wire|wand|wor|logic)?'
r'\s*(signed)?\s*((\[[^]]+\])+)?',
r'^[\(\s]*(input|inout|output)\s+(?:(reg|supply0|supply1|tri|triand|trior|tri0|tri1|wire|wand|wor|logic)\s+)?'
r'(?:(signed)\s+)?((\[[^]]+\])+)?',
'module_port_start', 'module_port'),
(r'endmodule', 'end_module', '#pop'),
(r'/\*', 'block_comment', 'block_comment'),
(r'//#\s*{{(.*)}}\n', 'section_meta'),
(r'//.*\n', None),
],
'parameters': [
(r'\s*parameter\s*(signed|integer|realtime|real|time)?\s*(\[[^]]+\])?', 'parameter_start'),
(r'\s*(\w+)\s*=\s*((?:(?!\/\/|[,)]).)*)', 'param_item'),
(r'\s*parameter\s+(?:(signed|integer|realtime|real|time)\s+)?(\[[^]]+\])?', 'parameter_start'),
(r'\s*(\w+)\s*=\s*((?:(?!\/\/|[,)]).)+)', 'param_item'),
(r'//#+(.*)\n', 'metacomment'),
(r',', None),
(r'//.*\n', None),
(r'[);]', None, '#pop'),
],
'module_port': [
(
r'\s*(input|inout|output)\s+(reg|supply0|supply1|tri|triand|trior|tri0|tri1|wire|wand|wor|logic)?'
r'\s*(signed)?\s*((\[[^]]+\])+)?',
r'\s*(input|inout|output)\s+(?:(reg|supply0|supply1|tri|triand|trior|tri0|tri1|wire|wand|wor|logic)\s+)?'
r'(signed)?\s*((\[[^]]+\])+)?',
'module_port_start'),
(r'\s*(\w+)\s*,?', 'port_param'),
(r'/\*', 'block_comment', 'block_comment'),
Expand Down

0 comments on commit e50a2b1

Please sign in to comment.