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

11 statements  

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

1""" 

2 pygments.lexers.cplint 

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

4 

5 Lexer for the cplint language 

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 bygroups, inherit, words 

12from pygments.lexers import PrologLexer 

13from pygments.token import Operator, Keyword, Name, String, Punctuation 

14 

15__all__ = ['CplintLexer'] 

16 

17 

18class CplintLexer(PrologLexer): 

19 """ 

20 Lexer for cplint files, including CP-logic, Logic Programs with Annotated 

21 Disjunctions, Distributional Clauses syntax, ProbLog, DTProbLog. 

22 

23 .. versionadded:: 2.12 

24 """ 

25 name = 'cplint' 

26 url = 'https://cplint.eu' 

27 aliases = ['cplint'] 

28 filenames = ['*.ecl', '*.prolog', '*.pro', '*.pl', '*.P', '*.lpad', '*.cpl'] 

29 mimetypes = ['text/x-cplint'] 

30 

31 tokens = { 

32 'root': [ 

33 (r'map_query', Keyword), 

34 (words(('gaussian', 'uniform_dens', 'dirichlet', 'gamma', 'beta', 

35 'poisson', 'binomial', 'geometric', 'exponential', 'pascal', 

36 'multinomial', 'user', 'val', 'uniform', 'discrete', 

37 'finite')), Name.Builtin), 

38 # annotations of atoms 

39 (r'([a-z]+)(:)', bygroups(String.Atom, Punctuation)), 

40 (r':(-|=)|::?|~=?|=>', Operator), 

41 (r'\?', Name.Builtin), 

42 inherit, 

43 ], 

44 }