summaryrefslogtreecommitdiffstats
path: root/contrib/python/Pygments/py3/pygments/lexers/hdl.py
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/python/Pygments/py3/pygments/lexers/hdl.py
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/hdl.py')
-rw-r--r--contrib/python/Pygments/py3/pygments/lexers/hdl.py348
1 files changed, 174 insertions, 174 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/hdl.py b/contrib/python/Pygments/py3/pygments/lexers/hdl.py
index e96f79a475c..32e87bd8280 100644
--- a/contrib/python/Pygments/py3/pygments/lexers/hdl.py
+++ b/contrib/python/Pygments/py3/pygments/lexers/hdl.py
@@ -4,7 +4,7 @@
Lexers for hardware descriptor languages.
- :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -102,12 +102,12 @@ class VerilogLexer(RegexLexer):
(words((
'byte', 'shortint', 'int', 'longint', 'integer', 'time',
'bit', 'logic', 'reg', 'supply0', 'supply1', 'tri', 'triand',
- 'trior', 'tri0', 'tri1', 'trireg', 'uwire', 'wire', 'wand', 'wor'
+ 'trior', 'tri0', 'tri1', 'trireg', 'uwire', 'wire', 'wand', 'wor'
'shortreal', 'real', 'realtime'), suffix=r'\b'),
Keyword.Type),
(r'[a-zA-Z_]\w*:(?!:)', Name.Label),
(r'\$?[a-zA-Z_]\w*', Name),
- (r'\\(\S+)', Name),
+ (r'\\(\S+)', Name),
],
'string': [
(r'"', String, '#pop'),
@@ -129,20 +129,20 @@ class VerilogLexer(RegexLexer):
]
}
- def analyse_text(text):
- """Verilog code will use one of reg/wire/assign for sure, and that
- is not common elsewhere."""
- result = 0
- if 'reg' in text:
- result += 0.1
- if 'wire' in text:
- result += 0.1
- if 'assign' in text:
- result += 0.1
-
- return result
-
-
+ def analyse_text(text):
+ """Verilog code will use one of reg/wire/assign for sure, and that
+ is not common elsewhere."""
+ result = 0
+ if 'reg' in text:
+ result += 0.1
+ if 'wire' in text:
+ result += 0.1
+ if 'assign' in text:
+ result += 0.1
+
+ return result
+
+
class SystemVerilogLexer(RegexLexer):
"""
Extends verilog lexer to recognise all SystemVerilog keywords from IEEE
@@ -171,183 +171,183 @@ class SystemVerilogLexer(RegexLexer):
(r'[{}#@]', Punctuation),
(r'L?"', String, 'string'),
(r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
-
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
-
- (r'([1-9][_0-9]*)?\s*\'[sS]?[bB]\s*[xXzZ?01][_xXzZ?01]*',
- Number.Bin),
- (r'([1-9][_0-9]*)?\s*\'[sS]?[oO]\s*[xXzZ?0-7][_xXzZ?0-7]*',
- Number.Oct),
- (r'([1-9][_0-9]*)?\s*\'[sS]?[dD]\s*[xXzZ?0-9][_xXzZ?0-9]*',
- Number.Integer),
- (r'([1-9][_0-9]*)?\s*\'[sS]?[hH]\s*[xXzZ?0-9a-fA-F][_xXzZ?0-9a-fA-F]*',
- Number.Hex),
-
- (r'\'[01xXzZ]', Number),
- (r'[0-9][_0-9]*', Number.Integer),
-
+
+ (r'([1-9][_0-9]*)?\s*\'[sS]?[bB]\s*[xXzZ?01][_xXzZ?01]*',
+ Number.Bin),
+ (r'([1-9][_0-9]*)?\s*\'[sS]?[oO]\s*[xXzZ?0-7][_xXzZ?0-7]*',
+ Number.Oct),
+ (r'([1-9][_0-9]*)?\s*\'[sS]?[dD]\s*[xXzZ?0-9][_xXzZ?0-9]*',
+ Number.Integer),
+ (r'([1-9][_0-9]*)?\s*\'[sS]?[hH]\s*[xXzZ?0-9a-fA-F][_xXzZ?0-9a-fA-F]*',
+ Number.Hex),
+
+ (r'\'[01xXzZ]', Number),
+ (r'[0-9][_0-9]*', Number.Integer),
+
(r'[~!%^&*+=|?:<>/-]', Operator),
- (words(('inside', 'dist'), suffix=r'\b'), Operator.Word),
-
- (r'[()\[\],.;\'$]', Punctuation),
+ (words(('inside', 'dist'), suffix=r'\b'), Operator.Word),
+
+ (r'[()\[\],.;\'$]', Punctuation),
(r'`[a-zA-Z_]\w*', Name.Constant),
(words((
- 'accept_on', 'alias', 'always', 'always_comb', 'always_ff',
- 'always_latch', 'and', 'assert', 'assign', 'assume', 'automatic',
- 'before', 'begin', 'bind', 'bins', 'binsof', 'break', 'buf',
- 'bufif0', 'bufif1', 'case', 'casex', 'casez', 'cell',
- 'checker', 'clocking', 'cmos', 'config',
- 'constraint', 'context', 'continue', 'cover', 'covergroup',
- 'coverpoint', 'cross', 'deassign', 'default', 'defparam', 'design',
- 'disable', 'do', 'edge', 'else', 'end', 'endcase',
- 'endchecker', 'endclocking', 'endconfig', 'endfunction',
- 'endgenerate', 'endgroup', 'endinterface', 'endmodule', 'endpackage',
- 'endprimitive', 'endprogram', 'endproperty', 'endsequence',
- 'endspecify', 'endtable', 'endtask', 'enum', 'eventually',
- 'expect', 'export', 'extern', 'final', 'first_match',
- 'for', 'force', 'foreach', 'forever', 'fork', 'forkjoin', 'function',
- 'generate', 'genvar', 'global', 'highz0', 'highz1', 'if', 'iff',
- 'ifnone', 'ignore_bins', 'illegal_bins', 'implies', 'implements', 'import',
- 'incdir', 'include', 'initial', 'inout', 'input',
- 'instance', 'interconnect', 'interface', 'intersect', 'join',
- 'join_any', 'join_none', 'large', 'let', 'liblist', 'library',
- 'local', 'localparam', 'macromodule', 'matches',
- 'medium', 'modport', 'module', 'nand', 'negedge', 'nettype', 'new', 'nexttime',
- 'nmos', 'nor', 'noshowcancelled', 'not', 'notif0', 'notif1', 'null',
- 'or', 'output', 'package', 'packed', 'parameter', 'pmos', 'posedge',
- 'primitive', 'priority', 'program', 'property', 'protected', 'pull0',
- 'pull1', 'pulldown', 'pullup', 'pulsestyle_ondetect',
- 'pulsestyle_onevent', 'pure', 'rand', 'randc', 'randcase',
- 'randsequence', 'rcmos', 'ref',
- 'reject_on', 'release', 'repeat', 'restrict', 'return', 'rnmos',
- 'rpmos', 'rtran', 'rtranif0', 'rtranif1', 's_always', 's_eventually',
- 's_nexttime', 's_until', 's_until_with', 'scalared', 'sequence',
- 'showcancelled', 'small', 'soft', 'solve',
- 'specify', 'specparam', 'static', 'strong', 'strong0',
- 'strong1', 'struct', 'super', 'sync_accept_on',
- 'sync_reject_on', 'table', 'tagged', 'task', 'this', 'throughout',
- 'timeprecision', 'timeunit', 'tran', 'tranif0', 'tranif1',
- 'typedef', 'union', 'unique', 'unique0', 'until',
- 'until_with', 'untyped', 'use', 'vectored',
- 'virtual', 'wait', 'wait_order', 'weak', 'weak0',
- 'weak1', 'while', 'wildcard', 'with', 'within',
- 'xnor', 'xor'),
- suffix=r'\b'),
+ 'accept_on', 'alias', 'always', 'always_comb', 'always_ff',
+ 'always_latch', 'and', 'assert', 'assign', 'assume', 'automatic',
+ 'before', 'begin', 'bind', 'bins', 'binsof', 'break', 'buf',
+ 'bufif0', 'bufif1', 'case', 'casex', 'casez', 'cell',
+ 'checker', 'clocking', 'cmos', 'config',
+ 'constraint', 'context', 'continue', 'cover', 'covergroup',
+ 'coverpoint', 'cross', 'deassign', 'default', 'defparam', 'design',
+ 'disable', 'do', 'edge', 'else', 'end', 'endcase',
+ 'endchecker', 'endclocking', 'endconfig', 'endfunction',
+ 'endgenerate', 'endgroup', 'endinterface', 'endmodule', 'endpackage',
+ 'endprimitive', 'endprogram', 'endproperty', 'endsequence',
+ 'endspecify', 'endtable', 'endtask', 'enum', 'eventually',
+ 'expect', 'export', 'extern', 'final', 'first_match',
+ 'for', 'force', 'foreach', 'forever', 'fork', 'forkjoin', 'function',
+ 'generate', 'genvar', 'global', 'highz0', 'highz1', 'if', 'iff',
+ 'ifnone', 'ignore_bins', 'illegal_bins', 'implies', 'implements', 'import',
+ 'incdir', 'include', 'initial', 'inout', 'input',
+ 'instance', 'interconnect', 'interface', 'intersect', 'join',
+ 'join_any', 'join_none', 'large', 'let', 'liblist', 'library',
+ 'local', 'localparam', 'macromodule', 'matches',
+ 'medium', 'modport', 'module', 'nand', 'negedge', 'nettype', 'new', 'nexttime',
+ 'nmos', 'nor', 'noshowcancelled', 'not', 'notif0', 'notif1', 'null',
+ 'or', 'output', 'package', 'packed', 'parameter', 'pmos', 'posedge',
+ 'primitive', 'priority', 'program', 'property', 'protected', 'pull0',
+ 'pull1', 'pulldown', 'pullup', 'pulsestyle_ondetect',
+ 'pulsestyle_onevent', 'pure', 'rand', 'randc', 'randcase',
+ 'randsequence', 'rcmos', 'ref',
+ 'reject_on', 'release', 'repeat', 'restrict', 'return', 'rnmos',
+ 'rpmos', 'rtran', 'rtranif0', 'rtranif1', 's_always', 's_eventually',
+ 's_nexttime', 's_until', 's_until_with', 'scalared', 'sequence',
+ 'showcancelled', 'small', 'soft', 'solve',
+ 'specify', 'specparam', 'static', 'strong', 'strong0',
+ 'strong1', 'struct', 'super', 'sync_accept_on',
+ 'sync_reject_on', 'table', 'tagged', 'task', 'this', 'throughout',
+ 'timeprecision', 'timeunit', 'tran', 'tranif0', 'tranif1',
+ 'typedef', 'union', 'unique', 'unique0', 'until',
+ 'until_with', 'untyped', 'use', 'vectored',
+ 'virtual', 'wait', 'wait_order', 'weak', 'weak0',
+ 'weak1', 'while', 'wildcard', 'with', 'within',
+ 'xnor', 'xor'),
+ suffix=r'\b'),
Keyword),
- (r'(class)(\s+)([a-zA-Z_]\w*)',
+ (r'(class)(\s+)([a-zA-Z_]\w*)',
bygroups(Keyword.Declaration, Whitespace, Name.Class)),
- (r'(extends)(\s+)([a-zA-Z_]\w*)',
+ (r'(extends)(\s+)([a-zA-Z_]\w*)',
bygroups(Keyword.Declaration, Whitespace, Name.Class)),
- (r'(endclass\b)(?:(\s*)(:)(\s*)([a-zA-Z_]\w*))?',
+ (r'(endclass\b)(?:(\s*)(:)(\s*)([a-zA-Z_]\w*))?',
bygroups(Keyword.Declaration, Whitespace, Punctuation, Whitespace, Name.Class)),
-
- (words((
- # Variable types
- 'bit', 'byte', 'chandle', 'const', 'event', 'int', 'integer',
- 'logic', 'longint', 'real', 'realtime', 'reg', 'shortint',
- 'shortreal', 'signed', 'string', 'time', 'type', 'unsigned',
- 'var', 'void',
- # Net types
- 'supply0', 'supply1', 'tri', 'triand', 'trior', 'trireg',
- 'tri0', 'tri1', 'uwire', 'wand', 'wire', 'wor'),
- suffix=r'\b'),
- Keyword.Type),
-
+
(words((
- '`__FILE__', '`__LINE__', '`begin_keywords', '`celldefine',
- '`default_nettype', '`define', '`else', '`elsif', '`end_keywords',
- '`endcelldefine', '`endif', '`ifdef', '`ifndef', '`include',
- '`line', '`nounconnected_drive', '`pragma', '`resetall',
- '`timescale', '`unconnected_drive', '`undef', '`undefineall'),
+ # Variable types
+ 'bit', 'byte', 'chandle', 'const', 'event', 'int', 'integer',
+ 'logic', 'longint', 'real', 'realtime', 'reg', 'shortint',
+ 'shortreal', 'signed', 'string', 'time', 'type', 'unsigned',
+ 'var', 'void',
+ # Net types
+ 'supply0', 'supply1', 'tri', 'triand', 'trior', 'trireg',
+ 'tri0', 'tri1', 'uwire', 'wand', 'wire', 'wor'),
+ suffix=r'\b'),
+ Keyword.Type),
+
+ (words((
+ '`__FILE__', '`__LINE__', '`begin_keywords', '`celldefine',
+ '`default_nettype', '`define', '`else', '`elsif', '`end_keywords',
+ '`endcelldefine', '`endif', '`ifdef', '`ifndef', '`include',
+ '`line', '`nounconnected_drive', '`pragma', '`resetall',
+ '`timescale', '`unconnected_drive', '`undef', '`undefineall'),
suffix=r'\b'),
Comment.Preproc),
(words((
- # Simulation control tasks (20.2)
- '$exit', '$finish', '$stop',
- # Simulation time functions (20.3)
- '$realtime', '$stime', '$time',
- # Timescale tasks (20.4)
- '$printtimescale', '$timeformat',
- # Conversion functions
- '$bitstoreal', '$bitstoshortreal', '$cast', '$itor',
- '$realtobits', '$rtoi', '$shortrealtobits', '$signed',
- '$unsigned',
- # Data query functions (20.6)
- '$bits', '$isunbounded', '$typename',
- # Array query functions (20.7)
- '$dimensions', '$high', '$increment', '$left', '$low', '$right',
- '$size', '$unpacked_dimensions',
- # Math functions (20.8)
- '$acos', '$acosh', '$asin', '$asinh', '$atan', '$atan2',
- '$atanh', '$ceil', '$clog2', '$cos', '$cosh', '$exp', '$floor',
- '$hypot', '$ln', '$log10', '$pow', '$sin', '$sinh', '$sqrt',
- '$tan', '$tanh',
- # Bit vector system functions (20.9)
- '$countbits', '$countones', '$isunknown', '$onehot', '$onehot0',
- # Severity tasks (20.10)
- '$info', '$error', '$fatal', '$warning',
- # Assertion control tasks (20.12)
- '$assertcontrol', '$assertfailoff', '$assertfailon',
- '$assertkill', '$assertnonvacuouson', '$assertoff', '$asserton',
- '$assertpassoff', '$assertpasson', '$assertvacuousoff',
- # Sampled value system functions (20.13)
- '$changed', '$changed_gclk', '$changing_gclk', '$falling_gclk',
- '$fell', '$fell_gclk', '$future_gclk', '$past', '$past_gclk',
- '$rising_gclk', '$rose', '$rose_gclk', '$sampled', '$stable',
- '$stable_gclk', '$steady_gclk',
- # Coverage control functions (20.14)
- '$coverage_control', '$coverage_get', '$coverage_get_max',
- '$coverage_merge', '$coverage_save', '$get_coverage',
- '$load_coverage_db', '$set_coverage_db_name',
- # Probabilistic distribution functions (20.15)
- '$dist_chi_square', '$dist_erlang', '$dist_exponential',
- '$dist_normal', '$dist_poisson', '$dist_t', '$dist_uniform',
- '$random',
- # Stochastic analysis tasks and functions (20.16)
- '$q_add', '$q_exam', '$q_full', '$q_initialize', '$q_remove',
- # PLA modeling tasks (20.17)
- '$async$and$array', '$async$and$plane', '$async$nand$array',
- '$async$nand$plane', '$async$nor$array', '$async$nor$plane',
- '$async$or$array', '$async$or$plane', '$sync$and$array',
- '$sync$and$plane', '$sync$nand$array', '$sync$nand$plane',
- '$sync$nor$array', '$sync$nor$plane', '$sync$or$array',
- '$sync$or$plane',
- # Miscellaneous tasks and functions (20.18)
- '$system',
- # Display tasks (21.2)
- '$display', '$displayb', '$displayh', '$displayo', '$monitor',
- '$monitorb', '$monitorh', '$monitoro', '$monitoroff',
- '$monitoron', '$strobe', '$strobeb', '$strobeh', '$strobeo',
- '$write', '$writeb', '$writeh', '$writeo',
- # File I/O tasks and functions (21.3)
- '$fclose', '$fdisplay', '$fdisplayb', '$fdisplayh',
- '$fdisplayo', '$feof', '$ferror', '$fflush', '$fgetc', '$fgets',
- '$fmonitor', '$fmonitorb', '$fmonitorh', '$fmonitoro', '$fopen',
- '$fread', '$fscanf', '$fseek', '$fstrobe', '$fstrobeb',
- '$fstrobeh', '$fstrobeo', '$ftell', '$fwrite', '$fwriteb',
- '$fwriteh', '$fwriteo', '$rewind', '$sformat', '$sformatf',
- '$sscanf', '$swrite', '$swriteb', '$swriteh', '$swriteo',
- '$ungetc',
- # Memory load tasks (21.4)
- '$readmemb', '$readmemh',
- # Memory dump tasks (21.5)
- '$writememb', '$writememh',
- # Command line input (21.6)
- '$test$plusargs', '$value$plusargs',
- # VCD tasks (21.7)
- '$dumpall', '$dumpfile', '$dumpflush', '$dumplimit', '$dumpoff',
- '$dumpon', '$dumpports', '$dumpportsall', '$dumpportsflush',
- '$dumpportslimit', '$dumpportsoff', '$dumpportson', '$dumpvars',
- ), suffix=r'\b'),
+ # Simulation control tasks (20.2)
+ '$exit', '$finish', '$stop',
+ # Simulation time functions (20.3)
+ '$realtime', '$stime', '$time',
+ # Timescale tasks (20.4)
+ '$printtimescale', '$timeformat',
+ # Conversion functions
+ '$bitstoreal', '$bitstoshortreal', '$cast', '$itor',
+ '$realtobits', '$rtoi', '$shortrealtobits', '$signed',
+ '$unsigned',
+ # Data query functions (20.6)
+ '$bits', '$isunbounded', '$typename',
+ # Array query functions (20.7)
+ '$dimensions', '$high', '$increment', '$left', '$low', '$right',
+ '$size', '$unpacked_dimensions',
+ # Math functions (20.8)
+ '$acos', '$acosh', '$asin', '$asinh', '$atan', '$atan2',
+ '$atanh', '$ceil', '$clog2', '$cos', '$cosh', '$exp', '$floor',
+ '$hypot', '$ln', '$log10', '$pow', '$sin', '$sinh', '$sqrt',
+ '$tan', '$tanh',
+ # Bit vector system functions (20.9)
+ '$countbits', '$countones', '$isunknown', '$onehot', '$onehot0',
+ # Severity tasks (20.10)
+ '$info', '$error', '$fatal', '$warning',
+ # Assertion control tasks (20.12)
+ '$assertcontrol', '$assertfailoff', '$assertfailon',
+ '$assertkill', '$assertnonvacuouson', '$assertoff', '$asserton',
+ '$assertpassoff', '$assertpasson', '$assertvacuousoff',
+ # Sampled value system functions (20.13)
+ '$changed', '$changed_gclk', '$changing_gclk', '$falling_gclk',
+ '$fell', '$fell_gclk', '$future_gclk', '$past', '$past_gclk',
+ '$rising_gclk', '$rose', '$rose_gclk', '$sampled', '$stable',
+ '$stable_gclk', '$steady_gclk',
+ # Coverage control functions (20.14)
+ '$coverage_control', '$coverage_get', '$coverage_get_max',
+ '$coverage_merge', '$coverage_save', '$get_coverage',
+ '$load_coverage_db', '$set_coverage_db_name',
+ # Probabilistic distribution functions (20.15)
+ '$dist_chi_square', '$dist_erlang', '$dist_exponential',
+ '$dist_normal', '$dist_poisson', '$dist_t', '$dist_uniform',
+ '$random',
+ # Stochastic analysis tasks and functions (20.16)
+ '$q_add', '$q_exam', '$q_full', '$q_initialize', '$q_remove',
+ # PLA modeling tasks (20.17)
+ '$async$and$array', '$async$and$plane', '$async$nand$array',
+ '$async$nand$plane', '$async$nor$array', '$async$nor$plane',
+ '$async$or$array', '$async$or$plane', '$sync$and$array',
+ '$sync$and$plane', '$sync$nand$array', '$sync$nand$plane',
+ '$sync$nor$array', '$sync$nor$plane', '$sync$or$array',
+ '$sync$or$plane',
+ # Miscellaneous tasks and functions (20.18)
+ '$system',
+ # Display tasks (21.2)
+ '$display', '$displayb', '$displayh', '$displayo', '$monitor',
+ '$monitorb', '$monitorh', '$monitoro', '$monitoroff',
+ '$monitoron', '$strobe', '$strobeb', '$strobeh', '$strobeo',
+ '$write', '$writeb', '$writeh', '$writeo',
+ # File I/O tasks and functions (21.3)
+ '$fclose', '$fdisplay', '$fdisplayb', '$fdisplayh',
+ '$fdisplayo', '$feof', '$ferror', '$fflush', '$fgetc', '$fgets',
+ '$fmonitor', '$fmonitorb', '$fmonitorh', '$fmonitoro', '$fopen',
+ '$fread', '$fscanf', '$fseek', '$fstrobe', '$fstrobeb',
+ '$fstrobeh', '$fstrobeo', '$ftell', '$fwrite', '$fwriteb',
+ '$fwriteh', '$fwriteo', '$rewind', '$sformat', '$sformatf',
+ '$sscanf', '$swrite', '$swriteb', '$swriteh', '$swriteo',
+ '$ungetc',
+ # Memory load tasks (21.4)
+ '$readmemb', '$readmemh',
+ # Memory dump tasks (21.5)
+ '$writememb', '$writememh',
+ # Command line input (21.6)
+ '$test$plusargs', '$value$plusargs',
+ # VCD tasks (21.7)
+ '$dumpall', '$dumpfile', '$dumpflush', '$dumplimit', '$dumpoff',
+ '$dumpon', '$dumpports', '$dumpportsall', '$dumpportsflush',
+ '$dumpportslimit', '$dumpportsoff', '$dumpportson', '$dumpvars',
+ ), suffix=r'\b'),
Name.Builtin),
(r'[a-zA-Z_]\w*:(?!:)', Name.Label),
(r'\$?[a-zA-Z_]\w*', Name),
- (r'\\(\S+)', Name),
+ (r'\\(\S+)', Name),
],
'string': [
(r'"', String, '#pop'),