ThirdParty/Pygments/pygments/lexers/xorg.py

changeset 6651
e8f3b5568b21
equal deleted inserted replaced
6650:1dd52aa8897c 6651:e8f3b5568b21
1 # -*- coding: utf-8 -*-
2 """
3 pygments.lexers.xorg
4 ~~~~~~~~~~~~~~~~~~~~
5
6 Lexers for Xorg configs.
7
8 :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details.
10 """
11
12 from pygments.lexer import RegexLexer, bygroups
13 from pygments.token import Comment, String, Name, Text
14
15 __all__ = ['XorgLexer']
16
17
18 class XorgLexer(RegexLexer):
19 """Lexer for xorg.conf file."""
20 name = 'Xorg'
21 aliases = ['xorg.conf']
22 filenames = ['xorg.conf']
23 mimetypes = []
24
25 tokens = {
26 'root': [
27 (r'\s+', Text),
28 (r'#.*$', Comment),
29
30 (r'((?:Sub)?Section)(\s+)("\w+")',
31 bygroups(String.Escape, Text, String.Escape)),
32 (r'(End(|Sub)Section)', String.Escape),
33
34 (r'(\w+)(\s+)([^\n#]+)',
35 bygroups(Name.Builtin, Text, Name.Constant)),
36 ],
37 }

eric ide

mercurial