ThirdParty/Pygments/pygments/lexers/text.py

changeset 808
8f85926125ef
parent 684
2f29a0b6e1c7
child 1705
b0fbc9300f2b
--- a/ThirdParty/Pygments/pygments/lexers/text.py	Tue Jan 04 17:37:48 2011 +0100
+++ b/ThirdParty/Pygments/pygments/lexers/text.py	Wed Jan 05 15:46:19 2011 +0100
@@ -19,7 +19,7 @@
 from pygments.util import get_bool_opt
 from pygments.lexers.other import BashLexer
 
-__all__ = ['IniLexer', 'SourcesListLexer', 'BaseMakefileLexer',
+__all__ = ['IniLexer', 'PropertiesLexer', 'SourcesListLexer', 'BaseMakefileLexer',
            'MakefileLexer', 'DiffLexer', 'IrcLogsLexer', 'TexLexer',
            'GroffLexer', 'ApacheConfLexer', 'BBCodeLexer', 'MoinWikiLexer',
            'RstLexer', 'VimLexer', 'GettextLexer', 'SquidConfLexer',
@@ -34,7 +34,7 @@
 
     name = 'INI'
     aliases = ['ini', 'cfg']
-    filenames = ['*.ini', '*.cfg', '*.properties']
+    filenames = ['*.ini', '*.cfg']
     mimetypes = ['text/x-ini']
 
     tokens = {
@@ -42,7 +42,7 @@
             (r'\s+', Text),
             (r'[;#].*?$', Comment),
             (r'\[.*?\]$', Keyword),
-            (r'(.*?)([ \t]*)(=)([ \t]*)(.*?)$',
+            (r'(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)',
              bygroups(Name.Attribute, Text, Operator, Text, String))
         ]
     }
@@ -54,6 +54,28 @@
         return text[0] == '[' and text[npos-1] == ']'
 
 
+class PropertiesLexer(RegexLexer):
+    """
+    Lexer for configuration files in Java's properties format.
+
+    *New in Pygments 1.4.*
+    """
+
+    name = 'Properties'
+    aliases = ['properties']
+    filenames = ['*.properties']
+    mimetypes = ['text/x-java-properties']
+
+    tokens = {
+        'root': [
+            (r'\s+', Text),
+            (r'(?:[;#]|//).*$', Comment),
+            (r'(.*?)([ \t]*)([=:])([ \t]*)(.*(?:(?<=\\)\n.*)*)',
+             bygroups(Name.Attribute, Text, Operator, Text, String)),
+        ],
+    }
+
+
 class SourcesListLexer(RegexLexer):
     """
     Lexer that highlights debian sources.list files.
@@ -830,7 +852,7 @@
             (r'^#:\s.*?$', Keyword.Declaration),
             #(r'^#$', Comment),
             (r'^(#|#\.\s|#\|\s|#~\s|#\s).*$', Comment.Single),
-            (r'^(")([\w-]*:)(.*")$',
+            (r'^(")([A-Za-z-]+:)(.*")$',
              bygroups(String, Name.Property, String)),
             (r'^".*"$', String),
             (r'^(msgid|msgid_plural|msgstr)(\s+)(".*")$',
@@ -1524,7 +1546,7 @@
     """
     name = 'CMake'
     aliases = ['cmake']
-    filenames = ['*.cmake']
+    filenames = ['*.cmake', 'CMakeLists.txt']
     mimetypes = ['text/x-cmake']
 
     tokens = {

eric ide

mercurial