Add a STRRES lexer as well for Pygments

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4814 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-04-27 01:46:59 +00:00
parent 7688f97ed3
commit cbda32117e
2 changed files with 24 additions and 0 deletions

View File

@ -12,5 +12,6 @@ setup(
entry_points = """ entry_points = """
[pygments.lexers] [pygments.lexers]
wrflexer = warzone:WRFLexer wrflexer = warzone:WRFLexer
strreslexer = warzone:STRRESLexer
""" """
) )

View File

@ -26,3 +26,26 @@ class WRFLexer(RegexLexer):
(r'\b.+?\b', Literal, '#pop'), (r'\b.+?\b', Literal, '#pop'),
] ]
} }
class STRRESLexer(RegexLexer):
name = 'STRRES'
aliases = ['strres']
filenames = ['*.txt']
mimetypes = ['text/x-strres']
tokens = {
'root': [
(r'/\*', Comment.Multiline, 'comment'),
(r'//.*?$', Comment.Singleline),
(r'"[^"]*"', String),
(r'[_a-zA-Z][-0-9_a-zA-Z]*', Literal),
(r'[ \t\n\x0d\x0a]+', Text),
(r'\(', Punctuation, '#push'),
(r'\)', Punctuation, '#pop'),
],
'comment': [
(r'[^*]+', Comment.Multiline),
(r'\*/', Comment.Multiline, '#pop'),
(r'\*[^/]', Comment.Multiline),
],
}