From 2b910cf6b576321b1261379ca2be2d2f19d88ae1 Mon Sep 17 00:00:00 2001 From: Nathan Whetsell Date: Fri, 13 Nov 2015 12:40:14 -0500 Subject: Add explanation for subclassing CsoundDocumentLexer from RegexLexer instead of XmlLexer --- pygments/lexers/csound.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pygments/lexers/csound.py b/pygments/lexers/csound.py index cc1ee644..51414073 100644 --- a/pygments/lexers/csound.py +++ b/pygments/lexers/csound.py @@ -322,7 +322,13 @@ class CsoundDocumentLexer(RegexLexer): aliases = ['csound-document', 'csound-csd'] filenames = ['*.csd'] - # These tokens are based on those in XmlLexer in pygments/lexers/html.py + # These tokens are based on those in XmlLexer in pygments/lexers/html.py. Making + # CsoundDocumentLexer a subclass of XmlLexer rather than RegexLexer may seem like a + # better idea, since Csound Document files look like XML files. However, Csound + # Documents can contain Csound comments (preceded by //, for example) before and + # after the root element, unescaped bitwise AND & and less than < operators, etc. In + # other words, while Csound Document files look like XML files, they may not actually + # be XML files. tokens = { 'root': [ newline, -- cgit v1.2.1