diff options
author | Tim Hatch <tim@timhatch.com> | 2014-04-24 15:34:25 -0400 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-04-24 15:34:25 -0400 |
commit | 9ca27c93bd28d0f76f9cd30f7a9a6b2c822bf473 (patch) | |
tree | fbbd524a4506e2914cb3eac84d423cccc8a36cf3 /pygments/lexers/other.py | |
parent | a952583945eb294dde2e993dadc8fb31b3ebc3f0 (diff) | |
parent | 6f1bb16a745f6c9d18ef10001813aceb4a1a8e80 (diff) | |
download | pygments-9ca27c93bd28d0f76f9cd30f7a9a6b2c822bf473.tar.gz |
Merged in jrha/pygments-main (pull request #179)
Conflicts:
pygments/lexers/_mapping.py
pygments/lexers/other.py
Diffstat (limited to 'pygments/lexers/other.py')
-rw-r--r-- | pygments/lexers/other.py | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py index 7dc8c8a6..91b3dd5d 100644 --- a/pygments/lexers/other.py +++ b/pygments/lexers/other.py @@ -38,7 +38,7 @@ __all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'MOOCodeLexer', 'RobotFrameworkLexer', 'PuppetLexer', 'NSISLexer', 'RPMSpecLexer', 'CbmBasicV2Lexer', 'AutoItLexer', 'RexxLexer', 'APLLexer', 'LSLLexer', 'AmbientTalkLexer', 'PawnLexer', 'VCTreeStatusLexer', - 'RslLexer'] + 'RslLexer', 'PanLexer'] class LSLLexer(RegexLexer): @@ -4176,3 +4176,63 @@ class RslLexer(RegexLexer): return 1.0 else: return 0.01 + + +class PanLexer(RegexLexer): + """ + Lexer for `pan <http://github.com/quattor/pan/>`_ source files. + + Based on tcsh lexer. + """ + + name = 'Pan' + aliases = ['pan'] + filenames = ['*.pan'] + + tokens = { + 'root': [ + include('basic'), + (r'\(', Keyword, 'paren'), + (r'{', Keyword, 'curly'), + include('data'), + ], + 'basic': [ + (r'\b(if|for|with|else|type|bind|while|valid|final|prefix|unique|' + r'object|foreach|include|template|function|variable|structure|' + r'extensible|declaration)\s*\b', + Keyword), + (r'\b(file_contents|format|index|length|match|matches|replace|' + r'splice|split|substr|to_lowercase|to_uppercase|debug|error|' + r'traceback|deprecated|base64_decode|base64_encode|digest|escape|' + r'unescape|append|create|first|nlist|key|length|list|merge|next|' + r'prepend|splice|is_boolean|is_defined|is_double|is_list|is_long|' + r'is_nlist|is_null|is_number|is_property|is_resource|is_string|' + r'to_boolean|to_double|to_long|to_string|clone|delete|exists|' + r'path_exists|if_exists|return|value)\s*\b', + Name.Builtin), + (r'#.*\n', Comment), + (r'\\[\w\W]', String.Escape), + (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Text, Operator)), + (r'[\[\]{}()=]+', Operator), + (r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String), + ], + 'data': [ + (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double), + (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), + (r'\s+', Text), + (r'[^=\s\[\]{}()$"\'`\\]+', Text), + (r'\d+(?= |\Z)', Number), + ], + 'curly': [ + (r'}', Keyword, '#pop'), + (r':-', Keyword), + (r'[a-zA-Z0-9_]+', Name.Variable), + (r'[^}:"\'`$]+', Punctuation), + (r':', Punctuation), + include('root'), + ], + 'paren': [ + (r'\)', Keyword, '#pop'), + include('root'), + ], + } |