Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pygments/lexers/smv.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:16 +0000

1""" 

2 pygments.lexers.smv 

3 ~~~~~~~~~~~~~~~~~~~ 

4 

5 Lexers for the SMV languages. 

6 

7 :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. 

8 :license: BSD, see LICENSE for details. 

9""" 

10 

11from pygments.lexer import RegexLexer, words 

12from pygments.token import Comment, Keyword, Name, Number, Operator, \ 

13 Punctuation, Text 

14 

15__all__ = ['NuSMVLexer'] 

16 

17 

18class NuSMVLexer(RegexLexer): 

19 """ 

20 Lexer for the NuSMV language. 

21 

22 .. versionadded:: 2.2 

23 """ 

24 

25 name = 'NuSMV' 

26 aliases = ['nusmv'] 

27 filenames = ['*.smv'] 

28 mimetypes = [] 

29 

30 tokens = { 

31 'root': [ 

32 # Comments 

33 (r'(?s)\/\-\-.*?\-\-/', Comment), 

34 (r'--.*\n', Comment), 

35 

36 # Reserved 

37 (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 # Names 

61 (r'[a-zA-Z_][\w$#-]*', Name.Variable), 

62 

63 # Operators 

64 (r':=', Operator), 

65 (r'[-&|+*/<>!=]', Operator), 

66 

67 # Literals 

68 (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 rest 

75 (r'\s+', Text.Whitespace), 

76 (r'[()\[\]{};?:.,]', Punctuation), 

77 ], 

78 }