Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
roboconf.py82 linesDownload Raw Back to lexers
1"""2    pygments.lexers.roboconf3    ~~~~~~~~~~~~~~~~~~~~~~~~4 5    Lexers for Roboconf DSL.6 7    :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.8    :license: BSD, see LICENSE for details.9"""10 11from pygments.lexer import RegexLexer, words, re12from pygments.token import Text, Operator, Keyword, Name, Comment13 14__all__ = ['RoboconfGraphLexer', 'RoboconfInstancesLexer']15 16 17class RoboconfGraphLexer(RegexLexer):18    """19    Lexer for Roboconf graph files.20    """21    name = 'Roboconf Graph'22    aliases = ['roboconf-graph']23    filenames = ['*.graph']24    url = 'https://roboconf.github.io/en/user-guide/graph-definition.html'25    version_added = '2.1'26 27    flags = re.IGNORECASE | re.MULTILINE28    tokens = {29        'root': [30            # Skip white spaces31            (r'\s+', Text),32 33            # There is one operator34            (r'=', Operator),35 36            # Keywords37            (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),41 42            # Comments43            (r'#.*\n', Comment),44 45            # Default46            (r'[^#]', Text),47            (r'.*\n', Text)48        ]49    }50 51 52class RoboconfInstancesLexer(RegexLexer):53    """54    Lexer for Roboconf instances files.55    """56    name = 'Roboconf Instances'57    aliases = ['roboconf-instances']58    filenames = ['*.instances']59    url = 'https://roboconf.github.io'60    version_added = '2.1'61 62    flags = re.IGNORECASE | re.MULTILINE63    tokens = {64        'root': [65 66            # Skip white spaces67            (r'\s+', Text),68 69            # Keywords70            (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),73 74            # Comments75            (r'#.*\n', Comment),76 77            # Default78            (r'[^#]', Text),79            (r'.*\n', Text)80        ]81    }82 
codekingpro/portable-devtools · Team Ai