Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pygments/lexers/xorg.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

12 statements  

1""" 

2 pygments.lexers.xorg 

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

4 

5 Lexers for Xorg configs. 

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 RegexLexer, bygroups 

12from pygments.token import Comment, String, Name, Text 

13 

14__all__ = ['XorgLexer'] 

15 

16 

17class XorgLexer(RegexLexer): 

18 """Lexer for xorg.conf files.""" 

19 name = 'Xorg' 

20 url = 'https://www.x.org/wiki/' 

21 aliases = ['xorg.conf'] 

22 filenames = ['xorg.conf'] 

23 mimetypes = [] 

24 version_added = '' 

25 

26 tokens = { 

27 'root': [ 

28 (r'\s+', Text), 

29 (r'#.*$', Comment), 

30 

31 (r'((?:Sub)?Section)(\s+)("\w+")', 

32 bygroups(String.Escape, Text, String.Escape)), 

33 (r'(End(?:Sub)?Section)', String.Escape), 

34 

35 (r'(\w+)(\s+)([^\n#]+)', 

36 bygroups(Name.Builtin, Text, Name.Constant)), 

37 ], 

38 }