summaryrefslogtreecommitdiff
path: root/pygments/lexers
diff options
context:
space:
mode:
authorDani?l W. Crompton <daniel.crompton@gmail.com>2013-09-06 00:59:15 +0200
committerDani?l W. Crompton <daniel.crompton@gmail.com>2013-09-06 00:59:15 +0200
commit09c2be2600e5e2fe2f8143b3a75adba9aa3e790f (patch)
treebc0a6e0ddf7a1889734f096d1ad606552c06d497 /pygments/lexers
parent1ea0fa53d253eae501f0a48611dd01493240b34d (diff)
downloadpygments-09c2be2600e5e2fe2f8143b3a75adba9aa3e790f.tar.gz
Added Pike Programming Language
Diffstat (limited to 'pygments/lexers')
-rw-r--r--pygments/lexers/_mapping.py1
-rw-r--r--pygments/lexers/compiled.py39
2 files changed, 39 insertions, 1 deletions
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index 969bdba5..2337f4b5 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -218,6 +218,7 @@ LEXERS = {
'Perl6Lexer': ('pygments.lexers.agile', 'Perl6', ('perl6', 'pl6'), ('*.pl', '*.pm', '*.nqp', '*.p6', '*.6pl', '*.p6l', '*.pl6', '*.6pm', '*.p6m', '*.pm6'), ('text/x-perl6', 'application/x-perl6')),
'PerlLexer': ('pygments.lexers.agile', 'Perl', ('perl', 'pl'), ('*.pl', '*.pm'), ('text/x-perl', 'application/x-perl')),
'PhpLexer': ('pygments.lexers.web', 'PHP', ('php', 'php3', 'php4', 'php5'), ('*.php', '*.php[345]', '*.inc'), ('text/x-php',)),
+ 'PikeLexer': ('pygments.lexers.compiled', 'Pike', ('pike',), ('*.pike', '*.pmod'), ('text/x-pike',)),
'PlPgsqlLexer': ('pygments.lexers.sql', 'PL/pgSQL', ('plpgsql',), (), ('text/x-plpgsql',)),
'PostScriptLexer': ('pygments.lexers.other', 'PostScript', ('postscript', 'postscr'), ('*.ps', '*.eps'), ('application/postscript',)),
'PostgresConsoleLexer': ('pygments.lexers.sql', 'PostgreSQL console (psql)', ('psql', 'postgresql-console', 'postgres-console'), (), ('text/x-postgresql-psql',)),
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py
index 75ace35e..a5f8c151 100644
--- a/pygments/lexers/compiled.py
+++ b/pygments/lexers/compiled.py
@@ -30,7 +30,7 @@ __all__ = ['CLexer', 'CppLexer', 'DLexer', 'DelphiLexer', 'ECLexer',
'Modula2Lexer', 'BlitzMaxLexer', 'BlitzBasicLexer', 'NimrodLexer',
'FantomLexer', 'RustLexer', 'CudaLexer', 'MonkeyLexer', 'SwigLexer',
'DylanLidLexer', 'DylanConsoleLexer', 'CobolLexer',
- 'CobolFreeformatLexer', 'LogosLexer', 'ClayLexer']
+ 'CobolFreeformatLexer', 'LogosLexer', 'ClayLexer', 'PikeLexer']
class CFamilyLexer(RegexLexer):
@@ -231,6 +231,43 @@ class CppLexer(CFamilyLexer):
def analyse_text(text):
return 0.1
+class PikeLexer(CppLexer):
+ """
+ For `Pike <http://pike.lysator.liu.se/>`_ source code.
+
+ *New in Pygments 1.7.*
+ """
+ name = 'Pike'
+ aliases = ['pike']
+ filenames = ['*.pike', '*.pmod']
+ mimetypes = ['text/x-pike']
+
+ tokens = {
+ 'statements': [
+ (r'(catch|new|private|protected|public|gauge|'
+ r'throw|throws|class|interface|implement|abstract|extends|from|'
+ r'this|super|new|constant|final|static|import|use|extern|'
+ r'inline|proto|break|continue|if|else|for|'
+ r'while|do|switch|case|as|in|version|return|true|false|null|'
+ r'__VERSION__|__MAJOR__|__MINOR__|__BUILD__|__REAL_VERSION__|'
+ r'__REAL_MAJOR__|__REAL_MINOR__|__REAL_BUILD__|__DATE__|__TIME__|'
+ r'__FILE__|__DIR__|__LINE__|__AUTO_BIGNUM__|__NT__|__PIKE__|'
+ r'__amigaos__|_Pragma|static_assert|defined|sscanf)\b',
+ Keyword),
+ (r'(bool|int|long|float|short|double|char|string|object|void|mapping|'
+ r'array|multiset|program|function|lambda|mixed|'
+ r'[a-z_][a-z0-9_]*_t)\b',
+ Keyword.Type),
+ (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
+ (r'[~!%^&*+=|?:<>/-@]', Operator),
+ inherit,
+ ],
+ 'classname': [
+ (r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop'),
+ # template specification
+ (r'\s*(?=>)', Text, '#pop'),
+ ],
+ }
class SwigLexer(CppLexer):
"""