|
14 | 14 | 'root': [ |
15 | 15 | # patterns |
16 | 16 | # pattern, action, new_state |
17 | | - (r'\bmodule\s+(\w+)\s*', 'module', 'module'), |
| 17 | + (r'\bmodule\s*(\w+)\s*', 'module', 'module'), |
18 | 18 | (r'/\*', 'block_comment', 'block_comment'), |
19 | 19 | (r'//#+(.*)\n', 'metacomment'), |
20 | 20 | (r'//.*\n', None), |
21 | 21 | ], |
22 | 22 | 'module': [ |
23 | | - (r'parameter\s*(signed|integer|realtime|real|time)?\s*(\[[^]]+\])?', 'parameter_start', 'parameters'), |
| 23 | + (r'parameter\s+(?:(signed|integer|realtime|real|time)\s+)?(\[[^]]+\])?', 'parameter_start', 'parameters'), |
24 | 24 | ( |
25 | | - r'^[\(\s]*(input|inout|output)\s+(reg|supply0|supply1|tri|triand|trior|tri0|tri1|wire|wand|wor|logic)?' |
26 | | - r'\s*(signed)?\s*((\[[^]]+\])+)?', |
| 25 | + r'^[\(\s]*(input|inout|output)\s+(?:(reg|supply0|supply1|tri|triand|trior|tri0|tri1|wire|wand|wor|logic)\s+)?' |
| 26 | + r'(?:(signed)\s+)?((\[[^]]+\])+)?', |
27 | 27 | 'module_port_start', 'module_port'), |
28 | 28 | (r'endmodule', 'end_module', '#pop'), |
29 | 29 | (r'/\*', 'block_comment', 'block_comment'), |
30 | 30 | (r'//#\s*{{(.*)}}\n', 'section_meta'), |
31 | 31 | (r'//.*\n', None), |
32 | 32 | ], |
33 | 33 | 'parameters': [ |
34 | | - (r'\s*parameter\s*(signed|integer|realtime|real|time)?\s*(\[[^]]+\])?', 'parameter_start'), |
35 | | - (r'\s*(\w+)\s*=\s*((?:(?!\/\/|[,)]).)*)', 'param_item'), |
| 34 | + (r'\s*parameter\s+(?:(signed|integer|realtime|real|time)\s+)?(\[[^]]+\])?', 'parameter_start'), |
| 35 | + (r'\s*(\w+)\s*=\s*((?:(?!\/\/|[,)]).)+)', 'param_item'), |
36 | 36 | (r'//#+(.*)\n', 'metacomment'), |
37 | 37 | (r',', None), |
38 | 38 | (r'//.*\n', None), |
39 | 39 | (r'[);]', None, '#pop'), |
40 | 40 | ], |
41 | 41 | 'module_port': [ |
42 | 42 | ( |
43 | | - r'\s*(input|inout|output)\s+(reg|supply0|supply1|tri|triand|trior|tri0|tri1|wire|wand|wor|logic)?' |
44 | | - r'\s*(signed)?\s*((\[[^]]+\])+)?', |
| 43 | + r'\s*(input|inout|output)\s+(?:(reg|supply0|supply1|tri|triand|trior|tri0|tri1|wire|wand|wor|logic)\s+)?' |
| 44 | + r'(signed)?\s*((\[[^]]+\])+)?', |
45 | 45 | 'module_port_start'), |
46 | 46 | (r'\s*(\w+)\s*,?', 'port_param'), |
47 | 47 | (r'/\*', 'block_comment', 'block_comment'), |
|
0 commit comments