diff options
author | Georg Brandl <georg@python.org> | 2014-09-20 00:12:54 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-09-20 00:12:54 +0200 |
commit | f7219e7b8b5236db12e077ba36f54182cd665941 (patch) | |
tree | 7a65d7f54e5f9b36a1b3342c79a1eb06a8198878 /pygments/lexers/misc/iolang.py | |
parent | ac4a2c47e625fdc12d83a07d360d678abd39af62 (diff) | |
parent | 33cb0a84a19b4e96d694eb99b490346f20e315d7 (diff) | |
download | pygments-f7219e7b8b5236db12e077ba36f54182cd665941.tar.gz |
Merged in pchaigno/pygments-main/prolog-ecl (pull request #374)
Diffstat (limited to 'pygments/lexers/misc/iolang.py')
-rw-r--r-- | pygments/lexers/misc/iolang.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/pygments/lexers/misc/iolang.py b/pygments/lexers/misc/iolang.py new file mode 100644 index 00000000..f6d6bb47 --- /dev/null +++ b/pygments/lexers/misc/iolang.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.misc.iolang + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Io language. + + :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number + +__all__ = ['IoLexer'] + + +class IoLexer(RegexLexer): + """ + For `Io <http://iolanguage.com/>`_ (a small, prototype-based + programming language) source. + + .. versionadded:: 0.10 + """ + name = 'Io' + filenames = ['*.io'] + aliases = ['io'] + mimetypes = ['text/x-iosrc'] + tokens = { + 'root': [ + (r'\n', Text), + (r'\s+', Text), + # Comments + (r'//(.*?)\n', Comment.Single), + (r'#(.*?)\n', Comment.Single), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + (r'/\+', Comment.Multiline, 'nestedcomment'), + # DoubleQuotedString + (r'"(\\\\|\\"|[^"])*"', String), + # Operators + (r'::=|:=|=|\(|\)|;|,|\*|-|\+|>|<|@|!|/|\||\^|\.|%|&|\[|\]|\{|\}', + Operator), + # keywords + (r'(clone|do|doFile|doString|method|for|if|else|elseif|then)\b', + Keyword), + # constants + (r'(nil|false|true)\b', Name.Constant), + # names + (r'(Object|list|List|Map|args|Sequence|Coroutine|File)\b', + Name.Builtin), + ('[a-zA-Z_]\w*', Name), + # numbers + (r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float), + (r'\d+', Number.Integer) + ], + 'nestedcomment': [ + (r'[^+/]+', Comment.Multiline), + (r'/\+', Comment.Multiline, '#push'), + (r'\+/', Comment.Multiline, '#pop'), + (r'[+/]', Comment.Multiline), + ] + } |