Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pygments/lexers/roboconf.py: 100%
15 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:16 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:16 +0000
1"""
2 pygments.lexers.roboconf
3 ~~~~~~~~~~~~~~~~~~~~~~~~
5 Lexers for Roboconf DSL.
7 :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
8 :license: BSD, see LICENSE for details.
9"""
11from pygments.lexer import RegexLexer, words, re
12from pygments.token import Text, Operator, Keyword, Name, Comment
14__all__ = ['RoboconfGraphLexer', 'RoboconfInstancesLexer']
17class RoboconfGraphLexer(RegexLexer):
18 """
19 Lexer for Roboconf graph files.
21 .. versionadded:: 2.1
22 """
23 name = 'Roboconf Graph'
24 aliases = ['roboconf-graph']
25 filenames = ['*.graph']
27 flags = re.IGNORECASE | re.MULTILINE
28 tokens = {
29 'root': [
30 # Skip white spaces
31 (r'\s+', Text),
33 # There is one operator
34 (r'=', Operator),
36 # Keywords
37 (words(('facet', 'import'), suffix=r'\s*\b', prefix=r'\b'), Keyword),
38 (words((
39 'installer', 'extends', 'exports', 'imports', 'facets',
40 'children'), suffix=r'\s*:?', prefix=r'\b'), Name),
42 # Comments
43 (r'#.*\n', Comment),
45 # Default
46 (r'[^#]', Text),
47 (r'.*\n', Text)
48 ]
49 }
52class RoboconfInstancesLexer(RegexLexer):
53 """
54 Lexer for Roboconf instances files.
56 .. versionadded:: 2.1
57 """
58 name = 'Roboconf Instances'
59 aliases = ['roboconf-instances']
60 filenames = ['*.instances']
62 flags = re.IGNORECASE | re.MULTILINE
63 tokens = {
64 'root': [
66 # Skip white spaces
67 (r'\s+', Text),
69 # Keywords
70 (words(('instance of', 'import'), suffix=r'\s*\b', prefix=r'\b'), Keyword),
71 (words(('name', 'count'), suffix=r's*:?', prefix=r'\b'), Name),
72 (r'\s*[\w.-]+\s*:', Name),
74 # Comments
75 (r'#.*\n', Comment),
77 # Default
78 (r'[^#]', Text),
79 (r'.*\n', Text)
80 ]
81 }