ThirdParty/Pygments/pygments/lexers/configs.py

changeset 5713
6762afd9f963
parent 4697
c2e9bf425554
child 6651
e8f3b5568b21
diff -r f0d08bdeacf4 -r 6762afd9f963 ThirdParty/Pygments/pygments/lexers/configs.py
--- a/ThirdParty/Pygments/pygments/lexers/configs.py	Sun Apr 23 16:40:31 2017 +0200
+++ b/ThirdParty/Pygments/pygments/lexers/configs.py	Tue Apr 25 18:36:38 2017 +0200
@@ -5,7 +5,7 @@
 
     Lexers for configuration file formats.
 
-    :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 
@@ -39,8 +39,10 @@
             (r'[;#].*', Comment.Single),
             (r'\[.*?\]$', Keyword),
             (r'(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)',
-             bygroups(Name.Attribute, Text, Operator, Text, String))
-        ]
+             bygroups(Name.Attribute, Text, Operator, Text, String)),
+            # standalone option, supported by some INI parsers
+            (r'(.+?)$', Name.Attribute),
+        ],
     }
 
     def analyse_text(text):
@@ -98,6 +100,8 @@
     """
     Lexer for configuration files in Java's properties format.
 
+    Note: trailing whitespace counts as part of the value as per spec
+
     .. versionadded:: 1.4
     """
 
@@ -108,10 +112,14 @@
 
     tokens = {
         'root': [
-            (r'\s+', Text),
-            (r'(?:[;#]|//).*$', Comment),
+            (r'^(\w+)([ \t])(\w+\s*)$', bygroups(Name.Attribute, Text, String)),
+            (r'^\w+(\\[ \t]\w*)*$', Name.Attribute),
+            (r'(^ *)([#!].*)', bygroups(Text, Comment)),
+            # More controversial comments
+            (r'(^ *)((?:;|//).*)', bygroups(Text, Comment)),
             (r'(.*?)([ \t]*)([=:])([ \t]*)(.*(?:(?<=\\)\n.*)*)',
              bygroups(Name.Attribute, Text, Operator, Text, String)),
+            (r'\s', Text),
         ],
     }
 
@@ -454,7 +462,7 @@
     """
     name = 'Nginx configuration file'
     aliases = ['nginx']
-    filenames = []
+    filenames = ['nginx.conf']
     mimetypes = ['text/x-nginx-conf']
 
     tokens = {
@@ -598,7 +606,7 @@
             (r'(".*")', bygroups(String.Double)),
         ],
         'punctuation': [
-            (r'[\[\]\(\),.]', Punctuation),
+            (r'[\[\](),.]', Punctuation),
         ],
         # Keep this seperate from punctuation - we sometimes want to use different
         # Tokens for { }
@@ -629,9 +637,8 @@
     .. versionadded:: 2.1
     """
     name = 'Termcap'
-    aliases = ['termcap',]
-
-    filenames = ['termcap', 'termcap.src',]
+    aliases = ['termcap']
+    filenames = ['termcap', 'termcap.src']
     mimetypes = []
 
     # NOTE:
@@ -642,13 +649,13 @@
     tokens = {
         'root': [
             (r'^#.*$', Comment),
-            (r'^[^\s#:\|]+', Name.Tag, 'names'),
+            (r'^[^\s#:|]+', Name.Tag, 'names'),
         ],
         'names': [
             (r'\n', Text, '#pop'),
             (r':', Punctuation, 'defs'),
             (r'\|', Punctuation),
-            (r'[^:\|]+', Name.Attribute),
+            (r'[^:|]+', Name.Attribute),
         ],
         'defs': [
             (r'\\\n[ \t]*', Text),
@@ -676,9 +683,8 @@
     .. versionadded:: 2.1
     """
     name = 'Terminfo'
-    aliases = ['terminfo',]
-
-    filenames = ['terminfo', 'terminfo.src',]
+    aliases = ['terminfo']
+    filenames = ['terminfo', 'terminfo.src']
     mimetypes = []
 
     # NOTE:
@@ -689,13 +695,13 @@
     tokens = {
         'root': [
             (r'^#.*$', Comment),
-            (r'^[^\s#,\|]+', Name.Tag, 'names'),
+            (r'^[^\s#,|]+', Name.Tag, 'names'),
         ],
         'names': [
             (r'\n', Text, '#pop'),
             (r'(,)([ \t]*)', bygroups(Punctuation, Text), 'defs'),
             (r'\|', Punctuation),
-            (r'[^,\|]+', Name.Attribute),
+            (r'[^,|]+', Name.Attribute),
         ],
         'defs': [
             (r'\n[ \t]+', Text),
@@ -724,8 +730,8 @@
     """
 
     name = 'PkgConfig'
-    aliases = ['pkgconfig',]
-    filenames = ['*.pc',]
+    aliases = ['pkgconfig']
+    filenames = ['*.pc']
     mimetypes = []
 
     tokens = {
@@ -791,8 +797,8 @@
     """
 
     name = 'PacmanConf'
-    aliases = ['pacmanconf',]
-    filenames = ['pacman.conf',]
+    aliases = ['pacmanconf']
+    filenames = ['pacman.conf']
     mimetypes = []
 
     tokens = {
@@ -820,7 +826,7 @@
                 '%u',     # url
                 ), suffix=r'\b'),
              Name.Variable),
-            
+
             # fallback
             (r'.', Text),
         ],

eric ide

mercurial