diff options
-rw-r--r-- | pygments/lexers/_mapping.py | 1 | ||||
-rw-r--r-- | pygments/lexers/agile.py | 2 | ||||
-rw-r--r-- | pygments/lexers/text.py | 11 | ||||
-rw-r--r-- | tests/test_basic_api.py | 4 |
4 files changed, 11 insertions, 7 deletions
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index fe5e28bf..0688ef11 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -62,7 +62,6 @@ LEXERS = { 'PythonLexer': ('pygments.lexers.agile', 'Python', ('python', 'py'), ('*.py', '*.pyw'), ('text/x-python', 'application/x-python')), 'RawTokenLexer': ('pygments.lexers.special', 'Raw token data', ('raw',), ('*.raw',), ('application/x-pygments-tokens',)), 'RhtmlLexer': ('pygments.lexers.templates', 'RHTML', ('rhtml', 'html+erb', 'html+ruby'), ('*.rhtml',), ()), - 'RstLexer': ('pygments.lexers.text', 'reStructuredText', ('rst', 'restructuredtext'), ('*.rst',), ()), 'RubyConsoleLexer': ('pygments.lexers.agile', 'Ruby irb session', ('rbcon', 'irb'), (), ()), 'RubyLexer': ('pygments.lexers.agile', 'Ruby', ('rb', 'ruby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx'), ('text/x-ruby', 'application/x-ruby')), 'SchemeLexer': ('pygments.lexers.agile', 'Scheme', ('scheme',), ('*.scm',), ('text/x-scheme', 'application/x-scheme')), diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 3c63cbda..ef448cdc 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -130,10 +130,12 @@ class PythonLexer(RegexLexer): ], 'dqs': [ (r'"', String, '#pop'), + (r'\\"', String.Escape), # included here again for raw strings include('strings') ], 'sqs': [ (r"'", String, '#pop'), + (r"\\'", String.Escape), # included here again for raw strings include('strings') ], 'tdqs': [ diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py index 64b47195..46ffe31f 100644 --- a/pygments/lexers/text.py +++ b/pygments/lexers/text.py @@ -23,8 +23,7 @@ from pygments.token import Punctuation, \ __all__ = ['IniLexer', 'MakefileLexer', 'DiffLexer', 'IrcLogsLexer', - 'TexLexer', 'GroffLexer', 'ApacheConfLexer', 'BBCodeLexer', - 'RstLexer'] + 'TexLexer', 'GroffLexer', 'ApacheConfLexer', 'BBCodeLexer'] class IniLexer(RegexLexer): @@ -313,7 +312,7 @@ class ApacheConfLexer(RegexLexer): } -class RstLexer(RegexLexer): - name = 'reStructuredText' - aliases = ['rst', 'restructuredtext'] - filenames = ['*.rst'] +#class RstLexer(RegexLexer): +# name = 'reStructuredText' +# aliases = ['rst', 'restructuredtext'] +# filenames = ['*.rst'] diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 05d1f490..05371130 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -13,6 +13,7 @@ import random from pygments import lexers, formatters, format from pygments.token import _TokenType +from pygments.lexer import RegexLexer test_content = [chr(i) for i in xrange(33, 128)] * 5 random.shuffle(test_content) @@ -35,6 +36,9 @@ class LexersTest(unittest.TestCase): result = lexer.analyse_text("abc") a(isinstance(result, float) and 0.0 <= result <= 1.0) + if issubclass(lexer, RegexLexer): + a('root' in lexer._tokens, '%s has no root state' % lexer) + inst = lexer(opt1="val1", opt2="val2") tokens = list(inst.get_tokens(test_content)) txt = "" |