codekingpro/portable-devtools
114k
1"""2 pygments.lexers.smv3 ~~~~~~~~~~~~~~~~~~~4 5 Lexers for the SMV languages.6 7 :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.8 :license: BSD, see LICENSE for details.9"""10 11from pygments.lexer import RegexLexer, words12from pygments.token import Comment, Keyword, Name, Number, Operator, \13 Punctuation, Text14 15__all__ = ['NuSMVLexer']16 17 18class NuSMVLexer(RegexLexer):19 """20 Lexer for the NuSMV language.21 """22 23 name = 'NuSMV'24 aliases = ['nusmv']25 filenames = ['*.smv']26 mimetypes = []27 url = 'https://nusmv.fbk.eu'28 version_added = '2.2'29 30 tokens = {31 'root': [32 # Comments33 (r'(?s)\/\-\-.*?\-\-/', Comment),34 (r'--.*\n', Comment),35 36 # Reserved37 (words(('MODULE', 'DEFINE', 'MDEFINE', 'CONSTANTS', 'VAR', 'IVAR',38 'FROZENVAR', 'INIT', 'TRANS', 'INVAR', 'SPEC', 'CTLSPEC',39 'LTLSPEC', 'PSLSPEC', 'COMPUTE', 'NAME', 'INVARSPEC',40 'FAIRNESS', 'JUSTICE', 'COMPASSION', 'ISA', 'ASSIGN',41 'CONSTRAINT', 'SIMPWFF', 'CTLWFF', 'LTLWFF', 'PSLWFF',42 'COMPWFF', 'IN', 'MIN', 'MAX', 'MIRROR', 'PRED',43 'PREDICATES'), suffix=r'(?![\w$#-])'),44 Keyword.Declaration),45 (r'process(?![\w$#-])', Keyword),46 (words(('array', 'of', 'boolean', 'integer', 'real', 'word'),47 suffix=r'(?![\w$#-])'), Keyword.Type),48 (words(('case', 'esac'), suffix=r'(?![\w$#-])'), Keyword),49 (words(('word1', 'bool', 'signed', 'unsigned', 'extend', 'resize',50 'sizeof', 'uwconst', 'swconst', 'init', 'self', 'count',51 'abs', 'max', 'min'), suffix=r'(?![\w$#-])'),52 Name.Builtin),53 (words(('EX', 'AX', 'EF', 'AF', 'EG', 'AG', 'E', 'F', 'O', 'G',54 'H', 'X', 'Y', 'Z', 'A', 'U', 'S', 'V', 'T', 'BU', 'EBF',55 'ABF', 'EBG', 'ABG', 'next', 'mod', 'union', 'in', 'xor',56 'xnor'), suffix=r'(?![\w$#-])'),57 Operator.Word),58 (words(('TRUE', 'FALSE'), suffix=r'(?![\w$#-])'), Keyword.Constant),59 60 # Names61 (r'[a-zA-Z_][\w$#-]*', Name.Variable),62 63 # Operators64 (r':=', Operator),65 (r'[-&|+*/<>!=]', Operator),66 67 # Literals68 (r'\-?\d+\b', Number.Integer),69 (r'0[su][bB]\d*_[01_]+', Number.Bin),70 (r'0[su][oO]\d*_[0-7_]+', Number.Oct),71 (r'0[su][dD]\d*_[\d_]+', Number.Decimal),72 (r'0[su][hH]\d*_[\da-fA-F_]+', Number.Hex),73 74 # Whitespace, punctuation and the rest75 (r'\s+', Text.Whitespace),76 (r'[()\[\]{};?:.,]', Punctuation),77 ],78 }79 