Sha256: ad72953508a29e236868ce154e42c58f5d3a34b75d081a35055e39053c53d471

Contents?: true

Size: 902 Bytes

Versions: 2

Compression:

Stored size: 902 Bytes

Contents

"""
    pygments.lexers.xorg
    ~~~~~~~~~~~~~~~~~~~~

    Lexers for Xorg configs.

    :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

from pygments.lexer import RegexLexer, bygroups
from pygments.token import Comment, String, Name, Text

__all__ = ['XorgLexer']


class XorgLexer(RegexLexer):
    """Lexer for xorg.conf files."""
    name = 'Xorg'
    url = 'https://www.x.org/wiki/'
    aliases = ['xorg.conf']
    filenames = ['xorg.conf']
    mimetypes = []

    tokens = {
        'root': [
            (r'\s+', Text),
            (r'#.*$', Comment),

            (r'((?:Sub)?Section)(\s+)("\w+")',
             bygroups(String.Escape, Text, String.Escape)),
            (r'(End(?:Sub)?Section)', String.Escape),

            (r'(\w+)(\s+)([^\n#]+)',
             bygroups(Name.Builtin, Text, Name.Constant)),
        ],
    }

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pygments.rb-2.4.1 vendor/pygments-main/pygments/lexers/xorg.py
pygments.rb-2.4.0 vendor/pygments-main/pygments/lexers/xorg.py