summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2007-01-08 19:13:39 +0100
committergbrandl <devnull@localhost>2007-01-08 19:13:39 +0100
commit6342c41108da146a0bb14ecbf812a4ebcb27bec8 (patch)
tree1046355f9e20250b170363d585aacc8d7313111d
parent8c5979eab20c8927ff4d872f82c74d21d9ee6b15 (diff)
downloadpygments-6342c41108da146a0bb14ecbf812a4ebcb27bec8.tar.gz
[svn] Fix #178 and make test suite pass.
-rw-r--r--pygments/lexers/_mapping.py1
-rw-r--r--pygments/lexers/agile.py2
-rw-r--r--pygments/lexers/text.py11
-rw-r--r--tests/test_basic_api.py4
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 = ""