diff --git a/tools/pygments-lexers/setup.py b/tools/pygments-lexers/setup.py index aca9faeca..6651e5c54 100644 --- a/tools/pygments-lexers/setup.py +++ b/tools/pygments-lexers/setup.py @@ -12,5 +12,6 @@ setup( entry_points = """ [pygments.lexers] wrflexer = warzone:WRFLexer + strreslexer = warzone:STRRESLexer """ ) diff --git a/tools/pygments-lexers/warzone/__init__.py b/tools/pygments-lexers/warzone/__init__.py index c26a64e09..d95b0cd2c 100644 --- a/tools/pygments-lexers/warzone/__init__.py +++ b/tools/pygments-lexers/warzone/__init__.py @@ -26,3 +26,26 @@ class WRFLexer(RegexLexer): (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), + ], + }