summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2017-01-29 08:30:26 +0100
committerGeorg Brandl <georg@python.org>2017-01-29 08:30:26 +0100
commit68cfbd6fb823f77b741be33109deab4936ac9fe5 (patch)
treeb4b50dc837e99d5212e60d5dc426e1a84c7173e7
parentf66fdea608294411a8074ea004e0cc7255e2b742 (diff)
downloadpygments-68cfbd6fb823f77b741be33109deab4936ac9fe5.tar.gz
Xorg: fixup style, add test file, regenerate mapping.
-rw-r--r--pygments/lexers/_mapping.py4
-rw-r--r--pygments/lexers/xorg.py39
-rw-r--r--tests/examplefiles/xorg.conf48
3 files changed, 70 insertions, 21 deletions
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index d090fad4..b48ee1d1 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -417,7 +417,7 @@ LEXERS = {
'TurtleLexer': ('pygments.lexers.rdf', 'Turtle', ('turtle',), ('*.ttl',), ('text/turtle', 'application/x-turtle')),
'TwigHtmlLexer': ('pygments.lexers.templates', 'HTML+Twig', ('html+twig',), ('*.twig',), ('text/html+twig',)),
'TwigLexer': ('pygments.lexers.templates', 'Twig', ('twig',), (), ('application/x-twig',)),
- 'TypeScriptLexer': ('pygments.lexers.javascript', 'TypeScript', ('ts', 'typescript'), ('*.ts',), ('text/x-typescript',)),
+ 'TypeScriptLexer': ('pygments.lexers.javascript', 'TypeScript', ('ts', 'typescript'), ('*.ts', '*.tsx'), ('text/x-typescript',)),
'TypoScriptCssDataLexer': ('pygments.lexers.typoscript', 'TypoScriptCssData', ('typoscriptcssdata',), (), ()),
'TypoScriptHtmlDataLexer': ('pygments.lexers.typoscript', 'TypoScriptHtmlData', ('typoscripthtmldata',), (), ()),
'TypoScriptLexer': ('pygments.lexers.typoscript', 'TypoScript', ('typoscript',), ('*.ts', '*.txt'), ('text/x-typoscript',)),
@@ -444,7 +444,7 @@ LEXERS = {
'XmlLexer': ('pygments.lexers.html', 'XML', ('xml',), ('*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd', '*.wsdl', '*.wsf'), ('text/xml', 'application/xml', 'image/svg+xml', 'application/rss+xml', 'application/atom+xml')),
'XmlPhpLexer': ('pygments.lexers.templates', 'XML+PHP', ('xml+php',), (), ('application/xml+php',)),
'XmlSmartyLexer': ('pygments.lexers.templates', 'XML+Smarty', ('xml+smarty',), (), ('application/xml+smarty',)),
- 'XorgLexer': ('pygments.lexers.xorg', 'Xorg', ('xorg.conf',), (), ()),
+ 'XorgLexer': ('pygments.lexers.xorg', 'Xorg', ('xorg.conf',), ('xorg.conf',), ()),
'XsltLexer': ('pygments.lexers.html', 'XSLT', ('xslt',), ('*.xsl', '*.xslt', '*.xpl'), ('application/xsl+xml', 'application/xslt+xml')),
'XtendLexer': ('pygments.lexers.jvm', 'Xtend', ('xtend',), ('*.xtend',), ('text/x-xtend',)),
'XtlangLexer': ('pygments.lexers.lisp', 'xtlang', ('extempore',), ('*.xtm',), ()),
diff --git a/pygments/lexers/xorg.py b/pygments/lexers/xorg.py
index 07df57f5..1344f6e5 100644
--- a/pygments/lexers/xorg.py
+++ b/pygments/lexers/xorg.py
@@ -1,33 +1,34 @@
# -*- coding: utf-8 -*-
"""
pygments.lexers.xorg
- ~~~~~~~~~~~~~~~~~~~~~
+ ~~~~~~~~~~~~~~~~~~~~
Lexers for Xorg configs.
- :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
-import re
-
from pygments.lexer import RegexLexer, bygroups
-from pygments.token import *
+from pygments.token import Comment, String, Name, Text
__all__ = ['XorgLexer']
+
class XorgLexer(RegexLexer):
- name = 'Xorg'
- aliases = ['xorg.conf']
- filenames = []
- mimetypes = []
-
- tokens = {
- 'root': [
- (r'#.*$', Comment),
- (r'((|Sub)Section)(\s+)("\w+")', bygroups (String.Escape, String.Escape, Whitespace, String.Escape)),
- (r'(End(|Sub)Section)', String.Escape),
-
- (r'(^(?!S|E|#)(|\s+)(?!Sec|End|Sub)\w+)(\s+)([^\n#]+)', bygroups (Name.Builtin, Whitespace, Whitespace, Name.Constant)),
- ]
- }
+ name = 'Xorg'
+ aliases = ['xorg.conf']
+ filenames = ['xorg.conf']
+ mimetypes = []
+
+ tokens = {
+ 'root': [
+ (r'#.*$', Comment),
+ (r'((|Sub)Section)(\s+)("\w+")',
+ bygroups(String.Escape, String.Escape, Text, String.Escape)),
+ (r'(End(|Sub)Section)', String.Escape),
+
+ (r'(^(?!S|E|#)(|\s+)(?!Sec|End|Sub)\w+)(\s+)([^\n#]+)',
+ bygroups(Name.Builtin, Text, Text, Name.Constant)),
+ ],
+ }
diff --git a/tests/examplefiles/xorg.conf b/tests/examplefiles/xorg.conf
new file mode 100644
index 00000000..a189be9f
--- /dev/null
+++ b/tests/examplefiles/xorg.conf
@@ -0,0 +1,48 @@
+Section "Files"
+ ModulePath "/usr/lib64/opengl/nvidia/extensions"
+ ModulePath "/usr/lib64/xorg/modules"
+EndSection
+
+Section "ServerLayout"
+ Identifier "XFree86 Configured"
+ Screen "Screen"
+EndSection
+
+Section "ServerFlags"
+ Option "AutoAddDevices" "false"
+EndSection
+
+Section "Screen"
+ Identifier "Screen"
+ Device "Card0"
+ DefaultDepth 24
+ SubSection "Display"
+ Depth 24
+ EndSubSection
+ Option "UseEDIDDpi" "False"
+ Option "DPI" "96 x 96"
+EndSection
+
+Section "Device"
+ Identifier "Card0"
+ Driver "nvidia"
+ VendorName "NVIDIA Corporation"
+ #Option "RenderAccel" "true"
+
+ #Option "NvAgp" "3"
+ #Option "AllowGLXWithComposite" "true"
+ #Option "AddARGBGLXVisuals" "true"
+ #Option "XAANoOffscreenPixmaps" "true"
+ #Option "DRI" "true"
+
+ #Option "UseEvents" "false"
+ #Option "TripleBuffer" "1"
+ #Option "DamageEvents" "1"
+ ##Option "BackingStore" "1"
+ #Option "PixmapCacheSize" "70000"
+ #Option "OnDemandVBlankInterrupts" "true"
+EndSection
+
+Section "Extensions"
+# Option "Composite" "Disabled"
+EndSection