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

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

13 statements  

1""" 

2 pygments.lexers.cplint 

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

4 

5 Lexer for the cplint language 

6 

7 :copyright: Copyright 2006-2025 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 name = 'cplint' 

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

25 aliases = ['cplint'] 

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

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

28 version_added = '2.12' 

29 

30 tokens = { 

31 'root': [ 

32 (r'map_query', Keyword), 

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

34 'poisson', 'binomial', 'geometric', 'exponential', 'pascal', 

35 'multinomial', 'user', 'val', 'uniform', 'discrete', 

36 'finite')), Name.Builtin), 

37 # annotations of atoms 

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

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

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

41 inherit, 

42 ], 

43 }