ThirdParty/Pygments/pygments/lexers/functional.py

changeset 2426
da76c71624de
parent 1705
b0fbc9300f2b
child 2525
8b507a9a2d40
diff -r ace8a08028f3 -r da76c71624de ThirdParty/Pygments/pygments/lexers/functional.py
--- a/ThirdParty/Pygments/pygments/lexers/functional.py	Sun Feb 17 19:05:40 2013 +0100
+++ b/ThirdParty/Pygments/pygments/lexers/functional.py	Sun Feb 17 19:07:15 2013 +0100
@@ -5,7 +5,7 @@
 
     Lexers for functional languages.
 
-    :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 
@@ -15,10 +15,572 @@
 from pygments.token import Text, Comment, Operator, Keyword, Name, \
      String, Number, Punctuation, Literal, Generic, Error
 
-__all__ = ['SchemeLexer', 'CommonLispLexer', 'HaskellLexer',
+__all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'HaskellLexer',
            'LiterateHaskellLexer', 'SMLLexer', 'OcamlLexer', 'ErlangLexer',
            'ErlangShellLexer', 'OpaLexer', 'CoqLexer', 'NewLispLexer',
-           'ElixirLexer', 'ElixirConsoleLexer']
+           'ElixirLexer', 'ElixirConsoleLexer', 'KokaLexer']
+
+
+class RacketLexer(RegexLexer):
+    """
+    Lexer for `Racket <http://racket-lang.org/>`_ source code (formerly known as
+    PLT Scheme).
+
+    *New in Pygments 1.6.*
+    """
+
+    name = 'Racket'
+    aliases = ['racket', 'rkt']
+    filenames = ['*.rkt', '*.rktl']
+    mimetypes = ['text/x-racket', 'application/x-racket']
+
+    # From namespace-mapped-symbols
+    keywords = [
+        '#%app', '#%datum', '#%expression', '#%module-begin',
+        '#%plain-app', '#%plain-lambda', '#%plain-module-begin',
+        '#%provide', '#%require', '#%stratified-body', '#%top',
+        '#%top-interaction', '#%variable-reference', '...', 'and', 'begin',
+        'begin-for-syntax', 'begin0', 'case', 'case-lambda', 'cond',
+        'datum->syntax-object', 'define', 'define-for-syntax',
+        'define-struct', 'define-syntax', 'define-syntax-rule',
+        'define-syntaxes', 'define-values', 'define-values-for-syntax',
+        'delay', 'do', 'expand-path', 'fluid-let', 'hash-table-copy',
+        'hash-table-count', 'hash-table-for-each', 'hash-table-get',
+        'hash-table-iterate-first', 'hash-table-iterate-key',
+        'hash-table-iterate-next', 'hash-table-iterate-value',
+        'hash-table-map', 'hash-table-put!', 'hash-table-remove!',
+        'hash-table?', 'if', 'lambda', 'let', 'let*', 'let*-values',
+        'let-struct', 'let-syntax', 'let-syntaxes', 'let-values', 'let/cc',
+        'let/ec', 'letrec', 'letrec-syntax', 'letrec-syntaxes',
+        'letrec-syntaxes+values', 'letrec-values', 'list-immutable',
+        'make-hash-table', 'make-immutable-hash-table', 'make-namespace',
+        'module', 'module-identifier=?', 'module-label-identifier=?',
+        'module-template-identifier=?', 'module-transformer-identifier=?',
+        'namespace-transformer-require', 'or', 'parameterize',
+        'parameterize*', 'parameterize-break', 'provide',
+        'provide-for-label', 'provide-for-syntax', 'quasiquote',
+        'quasisyntax', 'quasisyntax/loc', 'quote', 'quote-syntax',
+        'quote-syntax/prune', 'require', 'require-for-label',
+        'require-for-syntax', 'require-for-template', 'set!',
+        'set!-values', 'syntax', 'syntax-case', 'syntax-case*',
+        'syntax-id-rules', 'syntax-object->datum', 'syntax-rules',
+        'syntax/loc', 'time', 'transcript-off', 'transcript-on', 'unless',
+        'unquote', 'unquote-splicing', 'unsyntax', 'unsyntax-splicing',
+        'when', 'with-continuation-mark', 'with-handlers',
+        'with-handlers*', 'with-syntax', 'λ'
+    ]
+
+    # From namespace-mapped-symbols
+    builtins = [
+        '*', '+', '-', '/', '<', '<=', '=', '>', '>=',
+        'abort-current-continuation', 'abs', 'absolute-path?', 'acos',
+        'add1', 'alarm-evt', 'always-evt', 'andmap', 'angle', 'append',
+        'apply', 'arithmetic-shift', 'arity-at-least',
+        'arity-at-least-value', 'arity-at-least?', 'asin', 'assoc', 'assq',
+        'assv', 'atan', 'banner', 'bitwise-and', 'bitwise-bit-field',
+        'bitwise-bit-set?', 'bitwise-ior', 'bitwise-not', 'bitwise-xor',
+        'boolean?', 'bound-identifier=?', 'box', 'box-immutable', 'box?',
+        'break-enabled', 'break-thread', 'build-path',
+        'build-path/convention-type', 'byte-pregexp', 'byte-pregexp?',
+        'byte-ready?', 'byte-regexp', 'byte-regexp?', 'byte?', 'bytes',
+        'bytes->immutable-bytes', 'bytes->list', 'bytes->path',
+        'bytes->path-element', 'bytes->string/latin-1',
+        'bytes->string/locale', 'bytes->string/utf-8', 'bytes-append',
+        'bytes-close-converter', 'bytes-convert', 'bytes-convert-end',
+        'bytes-converter?', 'bytes-copy', 'bytes-copy!', 'bytes-fill!',
+        'bytes-length', 'bytes-open-converter', 'bytes-ref', 'bytes-set!',
+        'bytes-utf-8-index', 'bytes-utf-8-length', 'bytes-utf-8-ref',
+        'bytes<?', 'bytes=?', 'bytes>?', 'bytes?', 'caaaar', 'caaadr',
+        'caaar', 'caadar', 'caaddr', 'caadr', 'caar', 'cadaar', 'cadadr',
+        'cadar', 'caddar', 'cadddr', 'caddr', 'cadr',
+        'call-in-nested-thread', 'call-with-break-parameterization',
+        'call-with-composable-continuation',
+        'call-with-continuation-barrier', 'call-with-continuation-prompt',
+        'call-with-current-continuation', 'call-with-escape-continuation',
+        'call-with-exception-handler',
+        'call-with-immediate-continuation-mark', 'call-with-input-file',
+        'call-with-output-file', 'call-with-parameterization',
+        'call-with-semaphore', 'call-with-semaphore/enable-break',
+        'call-with-values', 'call/cc', 'call/ec', 'car', 'cdaaar',
+        'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar', 'cddaar',
+        'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', 'cddr', 'cdr',
+        'ceiling', 'channel-get', 'channel-put', 'channel-put-evt',
+        'channel-try-get', 'channel?', 'chaperone-box', 'chaperone-evt',
+        'chaperone-hash', 'chaperone-of?', 'chaperone-procedure',
+        'chaperone-struct', 'chaperone-struct-type', 'chaperone-vector',
+        'chaperone?', 'char->integer', 'char-alphabetic?', 'char-blank?',
+        'char-ci<=?', 'char-ci<?', 'char-ci=?', 'char-ci>=?', 'char-ci>?',
+        'char-downcase', 'char-foldcase', 'char-general-category',
+        'char-graphic?', 'char-iso-control?', 'char-lower-case?',
+        'char-numeric?', 'char-punctuation?', 'char-ready?',
+        'char-symbolic?', 'char-title-case?', 'char-titlecase',
+        'char-upcase', 'char-upper-case?', 'char-utf-8-length',
+        'char-whitespace?', 'char<=?', 'char<?', 'char=?', 'char>=?',
+        'char>?', 'char?', 'check-duplicate-identifier',
+        'checked-procedure-check-and-extract', 'choice-evt',
+        'cleanse-path', 'close-input-port', 'close-output-port',
+        'collect-garbage', 'collection-file-path', 'collection-path',
+        'compile', 'compile-allow-set!-undefined',
+        'compile-context-preservation-enabled',
+        'compile-enforce-module-constants', 'compile-syntax',
+        'compiled-expression?', 'compiled-module-expression?',
+        'complete-path?', 'complex?', 'cons',
+        'continuation-mark-set->context', 'continuation-mark-set->list',
+        'continuation-mark-set->list*', 'continuation-mark-set-first',
+        'continuation-mark-set?', 'continuation-marks',
+        'continuation-prompt-available?', 'continuation-prompt-tag?',
+        'continuation?', 'copy-file', 'cos',
+        'current-break-parameterization', 'current-code-inspector',
+        'current-command-line-arguments', 'current-compile',
+        'current-continuation-marks', 'current-custodian',
+        'current-directory', 'current-drive', 'current-error-port',
+        'current-eval', 'current-evt-pseudo-random-generator',
+        'current-gc-milliseconds', 'current-get-interaction-input-port',
+        'current-inexact-milliseconds', 'current-input-port',
+        'current-inspector', 'current-library-collection-paths',
+        'current-load', 'current-load-extension',
+        'current-load-relative-directory', 'current-load/use-compiled',
+        'current-locale', 'current-memory-use', 'current-milliseconds',
+        'current-module-declare-name', 'current-module-declare-source',
+        'current-module-name-resolver', 'current-namespace',
+        'current-output-port', 'current-parameterization',
+        'current-preserved-thread-cell-values', 'current-print',
+        'current-process-milliseconds', 'current-prompt-read',
+        'current-pseudo-random-generator', 'current-read-interaction',
+        'current-reader-guard', 'current-readtable', 'current-seconds',
+        'current-security-guard', 'current-subprocess-custodian-mode',
+        'current-thread', 'current-thread-group',
+        'current-thread-initial-stack-size',
+        'current-write-relative-directory', 'custodian-box-value',
+        'custodian-box?', 'custodian-limit-memory',
+        'custodian-managed-list', 'custodian-memory-accounting-available?',
+        'custodian-require-memory', 'custodian-shutdown-all', 'custodian?',
+        'custom-print-quotable-accessor', 'custom-print-quotable?',
+        'custom-write-accessor', 'custom-write?', 'date', 'date*',
+        'date*-nanosecond', 'date*-time-zone-name', 'date*?', 'date-day',
+        'date-dst?', 'date-hour', 'date-minute', 'date-month',
+        'date-second', 'date-time-zone-offset', 'date-week-day',
+        'date-year', 'date-year-day', 'date?', 'datum-intern-literal',
+        'default-continuation-prompt-tag', 'delete-directory',
+        'delete-file', 'denominator', 'directory-exists?',
+        'directory-list', 'display', 'displayln', 'dump-memory-stats',
+        'dynamic-require', 'dynamic-require-for-syntax', 'dynamic-wind',
+        'eof', 'eof-object?', 'ephemeron-value', 'ephemeron?', 'eprintf',
+        'eq-hash-code', 'eq?', 'equal-hash-code',
+        'equal-secondary-hash-code', 'equal?', 'equal?/recur',
+        'eqv-hash-code', 'eqv?', 'error', 'error-display-handler',
+        'error-escape-handler', 'error-print-context-length',
+        'error-print-source-location', 'error-print-width',
+        'error-value->string-handler', 'eval', 'eval-jit-enabled',
+        'eval-syntax', 'even?', 'evt?', 'exact->inexact', 'exact-integer?',
+        'exact-nonnegative-integer?', 'exact-positive-integer?', 'exact?',
+        'executable-yield-handler', 'exit', 'exit-handler', 'exn',
+        'exn-continuation-marks', 'exn-message', 'exn:break',
+        'exn:break-continuation', 'exn:break?', 'exn:fail',
+        'exn:fail:contract', 'exn:fail:contract:arity',
+        'exn:fail:contract:arity?', 'exn:fail:contract:continuation',
+        'exn:fail:contract:continuation?',
+        'exn:fail:contract:divide-by-zero',
+        'exn:fail:contract:divide-by-zero?',
+        'exn:fail:contract:non-fixnum-result',
+        'exn:fail:contract:non-fixnum-result?',
+        'exn:fail:contract:variable', 'exn:fail:contract:variable-id',
+        'exn:fail:contract:variable?', 'exn:fail:contract?',
+        'exn:fail:filesystem', 'exn:fail:filesystem:exists',
+        'exn:fail:filesystem:exists?', 'exn:fail:filesystem:version',
+        'exn:fail:filesystem:version?', 'exn:fail:filesystem?',
+        'exn:fail:network', 'exn:fail:network?', 'exn:fail:out-of-memory',
+        'exn:fail:out-of-memory?', 'exn:fail:read',
+        'exn:fail:read-srclocs', 'exn:fail:read:eof', 'exn:fail:read:eof?',
+        'exn:fail:read:non-char', 'exn:fail:read:non-char?',
+        'exn:fail:read?', 'exn:fail:syntax', 'exn:fail:syntax-exprs',
+        'exn:fail:syntax:unbound', 'exn:fail:syntax:unbound?',
+        'exn:fail:syntax?', 'exn:fail:unsupported',
+        'exn:fail:unsupported?', 'exn:fail:user', 'exn:fail:user?',
+        'exn:fail?', 'exn:srclocs-accessor', 'exn:srclocs?', 'exn?', 'exp',
+        'expand', 'expand-once', 'expand-syntax', 'expand-syntax-once',
+        'expand-syntax-to-top-form', 'expand-to-top-form',
+        'expand-user-path', 'expt', 'file-exists?',
+        'file-or-directory-identity', 'file-or-directory-modify-seconds',
+        'file-or-directory-permissions', 'file-position', 'file-size',
+        'file-stream-buffer-mode', 'file-stream-port?',
+        'filesystem-root-list', 'find-executable-path',
+        'find-library-collection-paths', 'find-system-path', 'fixnum?',
+        'floating-point-bytes->real', 'flonum?', 'floor', 'flush-output',
+        'for-each', 'force', 'format', 'fprintf', 'free-identifier=?',
+        'gcd', 'generate-temporaries', 'gensym', 'get-output-bytes',
+        'get-output-string', 'getenv', 'global-port-print-handler',
+        'guard-evt', 'handle-evt', 'handle-evt?', 'hash', 'hash-equal?',
+        'hash-eqv?', 'hash-has-key?', 'hash-placeholder?', 'hash-ref!',
+        'hasheq', 'hasheqv', 'identifier-binding',
+        'identifier-label-binding', 'identifier-prune-lexical-context',
+        'identifier-prune-to-source-module',
+        'identifier-remove-from-definition-context',
+        'identifier-template-binding', 'identifier-transformer-binding',
+        'identifier?', 'imag-part', 'immutable?', 'impersonate-box',
+        'impersonate-hash', 'impersonate-procedure', 'impersonate-struct',
+        'impersonate-vector', 'impersonator-of?',
+        'impersonator-prop:application-mark',
+        'impersonator-property-accessor-procedure?',
+        'impersonator-property?', 'impersonator?', 'inexact->exact',
+        'inexact-real?', 'inexact?', 'input-port?', 'inspector?',
+        'integer->char', 'integer->integer-bytes',
+        'integer-bytes->integer', 'integer-length', 'integer-sqrt',
+        'integer-sqrt/remainder', 'integer?',
+        'internal-definition-context-seal', 'internal-definition-context?',
+        'keyword->string', 'keyword<?', 'keyword?', 'kill-thread', 'lcm',
+        'length', 'liberal-define-context?', 'link-exists?', 'list',
+        'list*', 'list->bytes', 'list->string', 'list->vector', 'list-ref',
+        'list-tail', 'list?', 'load', 'load-extension',
+        'load-on-demand-enabled', 'load-relative',
+        'load-relative-extension', 'load/cd', 'load/use-compiled',
+        'local-expand', 'local-expand/capture-lifts',
+        'local-transformer-expand',
+        'local-transformer-expand/capture-lifts', 'locale-string-encoding',
+        'log', 'magnitude', 'make-arity-at-least', 'make-bytes',
+        'make-channel', 'make-continuation-prompt-tag', 'make-custodian',
+        'make-custodian-box', 'make-date', 'make-date*',
+        'make-derived-parameter', 'make-directory', 'make-ephemeron',
+        'make-exn', 'make-exn:break', 'make-exn:fail',
+        'make-exn:fail:contract', 'make-exn:fail:contract:arity',
+        'make-exn:fail:contract:continuation',
+        'make-exn:fail:contract:divide-by-zero',
+        'make-exn:fail:contract:non-fixnum-result',
+        'make-exn:fail:contract:variable', 'make-exn:fail:filesystem',
+        'make-exn:fail:filesystem:exists',
+        'make-exn:fail:filesystem:version', 'make-exn:fail:network',
+        'make-exn:fail:out-of-memory', 'make-exn:fail:read',
+        'make-exn:fail:read:eof', 'make-exn:fail:read:non-char',
+        'make-exn:fail:syntax', 'make-exn:fail:syntax:unbound',
+        'make-exn:fail:unsupported', 'make-exn:fail:user',
+        'make-file-or-directory-link', 'make-hash-placeholder',
+        'make-hasheq-placeholder', 'make-hasheqv',
+        'make-hasheqv-placeholder', 'make-immutable-hasheqv',
+        'make-impersonator-property', 'make-input-port', 'make-inspector',
+        'make-known-char-range-list', 'make-output-port', 'make-parameter',
+        'make-pipe', 'make-placeholder', 'make-polar',
+        'make-prefab-struct', 'make-pseudo-random-generator',
+        'make-reader-graph', 'make-readtable', 'make-rectangular',
+        'make-rename-transformer', 'make-resolved-module-path',
+        'make-security-guard', 'make-semaphore', 'make-set!-transformer',
+        'make-shared-bytes', 'make-sibling-inspector',
+        'make-special-comment', 'make-srcloc', 'make-string',
+        'make-struct-field-accessor', 'make-struct-field-mutator',
+        'make-struct-type', 'make-struct-type-property',
+        'make-syntax-delta-introducer', 'make-syntax-introducer',
+        'make-thread-cell', 'make-thread-group', 'make-vector',
+        'make-weak-box', 'make-weak-hasheqv', 'make-will-executor', 'map',
+        'max', 'mcar', 'mcdr', 'mcons', 'member', 'memq', 'memv', 'min',
+        'module->exports', 'module->imports', 'module->language-info',
+        'module->namespace', 'module-compiled-exports',
+        'module-compiled-imports', 'module-compiled-language-info',
+        'module-compiled-name', 'module-path-index-join',
+        'module-path-index-resolve', 'module-path-index-split',
+        'module-path-index?', 'module-path?', 'module-predefined?',
+        'module-provide-protected?', 'modulo', 'mpair?', 'nack-guard-evt',
+        'namespace-attach-module', 'namespace-attach-module-declaration',
+        'namespace-base-phase', 'namespace-mapped-symbols',
+        'namespace-module-identifier', 'namespace-module-registry',
+        'namespace-require', 'namespace-require/constant',
+        'namespace-require/copy', 'namespace-require/expansion-time',
+        'namespace-set-variable-value!', 'namespace-symbol->identifier',
+        'namespace-syntax-introduce', 'namespace-undefine-variable!',
+        'namespace-unprotect-module', 'namespace-variable-value',
+        'namespace?', 'negative?', 'never-evt', 'newline',
+        'normal-case-path', 'not', 'null', 'null?', 'number->string',
+        'number?', 'numerator', 'object-name', 'odd?', 'open-input-bytes',
+        'open-input-file', 'open-input-output-file', 'open-input-string',
+        'open-output-bytes', 'open-output-file', 'open-output-string',
+        'ormap', 'output-port?', 'pair?', 'parameter-procedure=?',
+        'parameter?', 'parameterization?', 'path->bytes',
+        'path->complete-path', 'path->directory-path', 'path->string',
+        'path-add-suffix', 'path-convention-type', 'path-element->bytes',
+        'path-element->string', 'path-for-some-system?',
+        'path-list-string->path-list', 'path-replace-suffix',
+        'path-string?', 'path?', 'peek-byte', 'peek-byte-or-special',
+        'peek-bytes', 'peek-bytes!', 'peek-bytes-avail!',
+        'peek-bytes-avail!*', 'peek-bytes-avail!/enable-break',
+        'peek-char', 'peek-char-or-special', 'peek-string', 'peek-string!',
+        'pipe-content-length', 'placeholder-get', 'placeholder-set!',
+        'placeholder?', 'poll-guard-evt', 'port-closed-evt',
+        'port-closed?', 'port-commit-peeked', 'port-count-lines!',
+        'port-count-lines-enabled', 'port-display-handler',
+        'port-file-identity', 'port-file-unlock', 'port-next-location',
+        'port-print-handler', 'port-progress-evt',
+        'port-provides-progress-evts?', 'port-read-handler',
+        'port-try-file-lock?', 'port-write-handler', 'port-writes-atomic?',
+        'port-writes-special?', 'port?', 'positive?',
+        'prefab-key->struct-type', 'prefab-struct-key', 'pregexp',
+        'pregexp?', 'primitive-closure?', 'primitive-result-arity',
+        'primitive?', 'print', 'print-as-expression',
+        'print-boolean-long-form', 'print-box', 'print-graph',
+        'print-hash-table', 'print-mpair-curly-braces',
+        'print-pair-curly-braces', 'print-reader-abbreviations',
+        'print-struct', 'print-syntax-width', 'print-unreadable',
+        'print-vector-length', 'printf', 'procedure->method',
+        'procedure-arity', 'procedure-arity-includes?', 'procedure-arity?',
+        'procedure-closure-contents-eq?', 'procedure-extract-target',
+        'procedure-reduce-arity', 'procedure-rename',
+        'procedure-struct-type?', 'procedure?', 'promise?',
+        'prop:arity-string', 'prop:checked-procedure',
+        'prop:custom-print-quotable', 'prop:custom-write',
+        'prop:equal+hash', 'prop:evt', 'prop:exn:srclocs',
+        'prop:impersonator-of', 'prop:input-port',
+        'prop:liberal-define-context', 'prop:output-port',
+        'prop:procedure', 'prop:rename-transformer',
+        'prop:set!-transformer', 'pseudo-random-generator->vector',
+        'pseudo-random-generator-vector?', 'pseudo-random-generator?',
+        'putenv', 'quotient', 'quotient/remainder', 'raise',
+        'raise-arity-error', 'raise-mismatch-error', 'raise-syntax-error',
+        'raise-type-error', 'raise-user-error', 'random', 'random-seed',
+        'rational?', 'rationalize', 'read', 'read-accept-bar-quote',
+        'read-accept-box', 'read-accept-compiled', 'read-accept-dot',
+        'read-accept-graph', 'read-accept-infix-dot', 'read-accept-lang',
+        'read-accept-quasiquote', 'read-accept-reader', 'read-byte',
+        'read-byte-or-special', 'read-bytes', 'read-bytes!',
+        'read-bytes-avail!', 'read-bytes-avail!*',
+        'read-bytes-avail!/enable-break', 'read-bytes-line',
+        'read-case-sensitive', 'read-char', 'read-char-or-special',
+        'read-curly-brace-as-paren', 'read-decimal-as-inexact',
+        'read-eval-print-loop', 'read-language', 'read-line',
+        'read-on-demand-source', 'read-square-bracket-as-paren',
+        'read-string', 'read-string!', 'read-syntax',
+        'read-syntax/recursive', 'read/recursive', 'readtable-mapping',
+        'readtable?', 'real->double-flonum', 'real->floating-point-bytes',
+        'real->single-flonum', 'real-part', 'real?', 'regexp',
+        'regexp-match', 'regexp-match-peek', 'regexp-match-peek-immediate',
+        'regexp-match-peek-positions',
+        'regexp-match-peek-positions-immediate',
+        'regexp-match-peek-positions-immediate/end',
+        'regexp-match-peek-positions/end', 'regexp-match-positions',
+        'regexp-match-positions/end', 'regexp-match/end', 'regexp-match?',
+        'regexp-max-lookbehind', 'regexp-replace', 'regexp-replace*',
+        'regexp?', 'relative-path?', 'remainder',
+        'rename-file-or-directory', 'rename-transformer-target',
+        'rename-transformer?', 'resolve-path', 'resolved-module-path-name',
+        'resolved-module-path?', 'reverse', 'round', 'seconds->date',
+        'security-guard?', 'semaphore-peek-evt', 'semaphore-post',
+        'semaphore-try-wait?', 'semaphore-wait',
+        'semaphore-wait/enable-break', 'semaphore?',
+        'set!-transformer-procedure', 'set!-transformer?', 'set-box!',
+        'set-mcar!', 'set-mcdr!', 'set-port-next-location!',
+        'shared-bytes', 'shell-execute', 'simplify-path', 'sin',
+        'single-flonum?', 'sleep', 'special-comment-value',
+        'special-comment?', 'split-path', 'sqrt', 'srcloc',
+        'srcloc-column', 'srcloc-line', 'srcloc-position', 'srcloc-source',
+        'srcloc-span', 'srcloc?', 'string', 'string->bytes/latin-1',
+        'string->bytes/locale', 'string->bytes/utf-8',
+        'string->immutable-string', 'string->keyword', 'string->list',
+        'string->number', 'string->path', 'string->path-element',
+        'string->symbol', 'string->uninterned-symbol',
+        'string->unreadable-symbol', 'string-append', 'string-ci<=?',
+        'string-ci<?', 'string-ci=?', 'string-ci>=?', 'string-ci>?',
+        'string-copy', 'string-copy!', 'string-downcase', 'string-fill!',
+        'string-foldcase', 'string-length', 'string-locale-ci<?',
+        'string-locale-ci=?', 'string-locale-ci>?',
+        'string-locale-downcase', 'string-locale-upcase',
+        'string-locale<?', 'string-locale=?', 'string-locale>?',
+        'string-normalize-nfc', 'string-normalize-nfd',
+        'string-normalize-nfkc', 'string-normalize-nfkd', 'string-ref',
+        'string-set!', 'string-titlecase', 'string-upcase',
+        'string-utf-8-length', 'string<=?', 'string<?', 'string=?',
+        'string>=?', 'string>?', 'string?', 'struct->vector',
+        'struct-accessor-procedure?', 'struct-constructor-procedure?',
+        'struct-info', 'struct-mutator-procedure?',
+        'struct-predicate-procedure?', 'struct-type-info',
+        'struct-type-make-constructor', 'struct-type-make-predicate',
+        'struct-type-property-accessor-procedure?',
+        'struct-type-property?', 'struct-type?', 'struct:arity-at-least',
+        'struct:date', 'struct:date*', 'struct:exn', 'struct:exn:break',
+        'struct:exn:fail', 'struct:exn:fail:contract',
+        'struct:exn:fail:contract:arity',
+        'struct:exn:fail:contract:continuation',
+        'struct:exn:fail:contract:divide-by-zero',
+        'struct:exn:fail:contract:non-fixnum-result',
+        'struct:exn:fail:contract:variable', 'struct:exn:fail:filesystem',
+        'struct:exn:fail:filesystem:exists',
+        'struct:exn:fail:filesystem:version', 'struct:exn:fail:network',
+        'struct:exn:fail:out-of-memory', 'struct:exn:fail:read',
+        'struct:exn:fail:read:eof', 'struct:exn:fail:read:non-char',
+        'struct:exn:fail:syntax', 'struct:exn:fail:syntax:unbound',
+        'struct:exn:fail:unsupported', 'struct:exn:fail:user',
+        'struct:srcloc', 'struct?', 'sub1', 'subbytes', 'subprocess',
+        'subprocess-group-enabled', 'subprocess-kill', 'subprocess-pid',
+        'subprocess-status', 'subprocess-wait', 'subprocess?', 'substring',
+        'symbol->string', 'symbol-interned?', 'symbol-unreadable?',
+        'symbol?', 'sync', 'sync/enable-break', 'sync/timeout',
+        'sync/timeout/enable-break', 'syntax->list', 'syntax-arm',
+        'syntax-column', 'syntax-disarm', 'syntax-e', 'syntax-line',
+        'syntax-local-bind-syntaxes', 'syntax-local-certifier',
+        'syntax-local-context', 'syntax-local-expand-expression',
+        'syntax-local-get-shadower', 'syntax-local-introduce',
+        'syntax-local-lift-context', 'syntax-local-lift-expression',
+        'syntax-local-lift-module-end-declaration',
+        'syntax-local-lift-provide', 'syntax-local-lift-require',
+        'syntax-local-lift-values-expression',
+        'syntax-local-make-definition-context',
+        'syntax-local-make-delta-introducer',
+        'syntax-local-module-defined-identifiers',
+        'syntax-local-module-exports',
+        'syntax-local-module-required-identifiers', 'syntax-local-name',
+        'syntax-local-phase-level',
+        'syntax-local-transforming-module-provides?', 'syntax-local-value',
+        'syntax-local-value/immediate', 'syntax-original?',
+        'syntax-position', 'syntax-property',
+        'syntax-property-symbol-keys', 'syntax-protect', 'syntax-rearm',
+        'syntax-recertify', 'syntax-shift-phase-level', 'syntax-source',
+        'syntax-source-module', 'syntax-span', 'syntax-taint',
+        'syntax-tainted?', 'syntax-track-origin',
+        'syntax-transforming-module-expression?', 'syntax-transforming?',
+        'syntax?', 'system-big-endian?', 'system-idle-evt',
+        'system-language+country', 'system-library-subpath',
+        'system-path-convention-type', 'system-type', 'tan',
+        'tcp-abandon-port', 'tcp-accept', 'tcp-accept-evt',
+        'tcp-accept-ready?', 'tcp-accept/enable-break', 'tcp-addresses',
+        'tcp-close', 'tcp-connect', 'tcp-connect/enable-break',
+        'tcp-listen', 'tcp-listener?', 'tcp-port?', 'terminal-port?',
+        'thread', 'thread-cell-ref', 'thread-cell-set!', 'thread-cell?',
+        'thread-dead-evt', 'thread-dead?', 'thread-group?',
+        'thread-resume', 'thread-resume-evt', 'thread-rewind-receive',
+        'thread-running?', 'thread-suspend', 'thread-suspend-evt',
+        'thread-wait', 'thread/suspend-to-kill', 'thread?', 'time-apply',
+        'truncate', 'udp-addresses', 'udp-bind!', 'udp-bound?',
+        'udp-close', 'udp-connect!', 'udp-connected?', 'udp-open-socket',
+        'udp-receive!', 'udp-receive!*', 'udp-receive!-evt',
+        'udp-receive!/enable-break', 'udp-receive-ready-evt', 'udp-send',
+        'udp-send*', 'udp-send-evt', 'udp-send-ready-evt', 'udp-send-to',
+        'udp-send-to*', 'udp-send-to-evt', 'udp-send-to/enable-break',
+        'udp-send/enable-break', 'udp?', 'unbox',
+        'uncaught-exception-handler', 'use-collection-link-paths',
+        'use-compiled-file-paths', 'use-user-specific-search-paths',
+        'values', 'variable-reference->empty-namespace',
+        'variable-reference->module-base-phase',
+        'variable-reference->module-declaration-inspector',
+        'variable-reference->module-source',
+        'variable-reference->namespace', 'variable-reference->phase',
+        'variable-reference->resolved-module-path',
+        'variable-reference-constant?', 'variable-reference?', 'vector',
+        'vector->immutable-vector', 'vector->list',
+        'vector->pseudo-random-generator',
+        'vector->pseudo-random-generator!', 'vector->values',
+        'vector-fill!', 'vector-immutable', 'vector-length', 'vector-ref',
+        'vector-set!', 'vector-set-performance-stats!', 'vector?',
+        'version', 'void', 'void?', 'weak-box-value', 'weak-box?',
+        'will-execute', 'will-executor?', 'will-register',
+        'will-try-execute', 'with-input-from-file', 'with-output-to-file',
+        'wrap-evt', 'write', 'write-byte', 'write-bytes',
+        'write-bytes-avail', 'write-bytes-avail*', 'write-bytes-avail-evt',
+        'write-bytes-avail/enable-break', 'write-char', 'write-special',
+        'write-special-avail*', 'write-special-evt', 'write-string', 'zero?'
+    ]
+
+    # From SchemeLexer
+    valid_name = r'[a-zA-Z0-9!$%&*+,/:<=>?@^_~|-]+'
+
+    tokens = {
+        'root' : [
+            (r';.*$', Comment.Single),
+            (r'#\|[^|]+\|#', Comment.Multiline),
+
+            # whitespaces - usually not relevant
+            (r'\s+', Text),
+
+            ## numbers: Keep in mind Racket reader hash prefixes,
+            ## which can denote the base or the type. These don't map
+            ## neatly onto pygments token types; some judgment calls
+            ## here.  Note that none of these regexps attempt to
+            ## exclude identifiers that start with a number, such as a
+            ## variable named "100-Continue".
+
+            # #b
+            (r'#b[-+]?[01]+\.[01]+', Number.Float),
+            (r'#b[01]+e[-+]?[01]+', Number.Float),
+            (r'#b[-+]?[01]/[01]+', Number),
+            (r'#b[-+]?[01]+', Number.Integer),
+            (r'#b\S*', Error),
+
+            # #d OR no hash prefix
+            (r'(#d)?[-+]?\d+\.\d+', Number.Float),
+            (r'(#d)?\d+e[-+]?\d+', Number.Float),
+            (r'(#d)?[-+]?\d+/\d+', Number),
+            (r'(#d)?[-+]?\d+', Number.Integer),
+            (r'#d\S*', Error),
+
+            # #e
+            (r'#e[-+]?\d+\.\d+', Number.Float),
+            (r'#e\d+e[-+]?\d+', Number.Float),
+            (r'#e[-+]?\d+/\d+', Number),
+            (r'#e[-+]?\d+', Number),
+            (r'#e\S*', Error),
+
+            # #i is always inexact-real, i.e. float
+            (r'#i[-+]?\d+\.\d+', Number.Float),
+            (r'#i\d+e[-+]?\d+', Number.Float),
+            (r'#i[-+]?\d+/\d+', Number.Float),
+            (r'#i[-+]?\d+', Number.Float),
+            (r'#i\S*', Error),
+
+            # #o
+            (r'#o[-+]?[0-7]+\.[0-7]+', Number.Oct),
+            (r'#o[0-7]+e[-+]?[0-7]+', Number.Oct),
+            (r'#o[-+]?[0-7]+/[0-7]+', Number.Oct),
+            (r'#o[-+]?[0-7]+', Number.Oct),
+            (r'#o\S*', Error),
+
+            # #x
+            (r'#x[-+]?[0-9a-fA-F]+\.[0-9a-fA-F]+', Number.Hex),
+            # the exponent variation (e.g. #x1e1) is N/A
+            (r'#x[-+]?[0-9a-fA-F]+/[0-9a-fA-F]+', Number.Hex),
+            (r'#x[-+]?[0-9a-fA-F]+', Number.Hex),
+            (r'#x\S*', Error),
+
+
+            # strings, symbols and characters
+            (r'"(\\\\|\\"|[^"])*"', String),
+            (r"'" + valid_name, String.Symbol),
+            (r"#\\([()/'\"._!§$%& ?=+-]{1}|[a-zA-Z0-9]+)", String.Char),
+            (r'#rx".+"', String.Regex),
+            (r'#px".+"', String.Regex),
+
+            # constants
+            (r'(#t|#f)', Name.Constant),
+
+            # keyword argument names (e.g. #:keyword)
+            (r'#:\S+', Keyword.Declaration),
+
+            # #lang
+            (r'#lang \S+', Keyword.Namespace),
+
+            # special operators
+            (r"('|#|`|,@|,|\.)", Operator),
+
+            # highlight the keywords
+            ('(%s)' % '|'.join([
+                re.escape(entry) + ' ' for entry in keywords]),
+                Keyword
+            ),
+
+            # first variable in a quoted string like
+            # '(this is syntactic sugar)
+            (r"(?<='\()" + valid_name, Name.Variable),
+            (r"(?<=#\()" + valid_name, Name.Variable),
+
+            # highlight the builtins
+            ("(?<=\()(%s)" % '|'.join([
+                re.escape(entry) + ' ' for entry in builtins]),
+                Name.Builtin
+            ),
+
+            # the remaining functions; handle both ( and [
+            (r'(?<=(\(|\[|\{))' + valid_name, Name.Function),
+
+            # find the remaining variables
+            (valid_name, Name.Variable),
+
+            # the famous parentheses!
+            (r'(\(|\)|\[|\]|\{|\})', Punctuation),
+        ],
+    }
 
 
 class SchemeLexer(RegexLexer):
@@ -37,7 +599,7 @@
     """
     name = 'Scheme'
     aliases = ['scheme', 'scm']
-    filenames = ['*.scm', '*.ss', '*.rkt']
+    filenames = ['*.scm', '*.ss']
     mimetypes = ['text/x-scheme', 'application/x-scheme']
 
     # list of known keywords and builtins taken form vim 6.4 scheme.vim
@@ -145,6 +707,7 @@
 
             # the famous parentheses!
             (r'(\(|\))', Punctuation),
+            (r'(\[|\])', Punctuation),
         ],
     }
 
@@ -242,7 +805,7 @@
             (r'#\d*Y.*$', Comment.Special),
 
             # strings and characters
-            (r'"(\\.|[^"\\])*"', String),
+            (r'"(\\.|\\\n|[^"\\])*"', String),
             # quoting
             (r":" + symbol, String.Symbol),
             (r"'" + symbol, String.Symbol),
@@ -349,7 +912,7 @@
             # Whitespace:
             (r'\s+', Text),
             #(r'--\s*|.*$', Comment.Doc),
-            (r'--(?![!#$%&*+./<=>?@\^|_~]).*?$', Comment.Single),
+            (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
             (r'{-', Comment.Multiline, 'comment'),
             # Lexemes:
             #  Identifiers
@@ -358,8 +921,8 @@
             (r'\berror\b', Name.Exception),
             (r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
             (r'^[_a-z][\w\']*', Name.Function),
-            (r'[_a-z][\w\']*', Name),
-            (r'[A-Z][\w\']*', Keyword.Type),
+            (r"'?[_a-z][\w']*", Name),
+            (r"('')?[A-Z][\w\']*", Keyword.Type),
             #  Operators
             (r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
             (r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
@@ -861,7 +1424,7 @@
       'inherit', 'initializer', 'lazy', 'let', 'match', 'method',
       'module', 'mutable', 'new', 'object', 'of', 'open', 'private',
       'raise', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try',
-      'type', 'val', 'virtual', 'when', 'while', 'with'
+      'type', 'value', 'val', 'virtual', 'when', 'while', 'with',
     ]
     keyopts = [
       '!=','#','&','&&','\(','\)','\*','\+',',','-',
@@ -1011,8 +1574,9 @@
             (r'"', String, 'string'),
             (r'<<', Name.Label),
             (r'>>', Name.Label),
-            (r'('+atom_re+')(:)', bygroups(Name.Namespace, Punctuation)),
-            (r'^('+atom_re+r')(\s*)(\()', bygroups(Name.Function, Text, Punctuation)),
+            ('(' + atom_re + ')(:)', bygroups(Name.Namespace, Punctuation)),
+            ('(?:^|(?<=:))(' + atom_re + r')(\s*)(\()',
+             bygroups(Name.Function, Text, Punctuation)),
             (r'[+-]?'+base_re+r'#[0-9a-zA-Z]+', Number.Integer),
             (r'[+-]?\d+', Number.Integer),
             (r'[+-]?\d+.\d+', Number.Float),
@@ -1101,7 +1665,7 @@
     keywords = [
         'and', 'as', 'begin', 'css', 'database', 'db', 'do', 'else', 'end',
         'external', 'forall', 'if', 'import', 'match', 'package', 'parser',
-        'rec', 'server', 'then', 'type', 'val', 'with', 'xml_parser'
+        'rec', 'server', 'then', 'type', 'val', 'with', 'xml_parser',
     ]
 
     # matches both stuff and `stuff`
@@ -1338,7 +1902,7 @@
             (r'[/*]', Comment),
         ],
 
-        # the coy pasting between string and single-string
+        # the copy pasting between string and single-string
         # is kinda sad. Is there a way to avoid that??
         'string': [
             (r'[^\\"{]+', String.Double),
@@ -1385,6 +1949,7 @@
             (r'"', String.Single, ('#pop', 'string')),
             (r'#'+ident_re, String.Single, '#pop'),
             (r'#(?={)', String.Single, ('#pop', 'root')),
+            (r'[^"\'{`=<>]+', String.Single, '#pop'),
             (r'{', Operator, ('#pop', 'root')), # this is a tail call!
         ],
 
@@ -1394,7 +1959,7 @@
             (r'</', String.Single, ('#pop', 'html-end-tag')),
             (r'<', String.Single, 'html-open-tag'),
             (r'{', Operator, 'root'),
-            (r'.|\s+', String.Single),
+            (r'[^<{]+', String.Single),
         ],
 
         'html-comment': [
@@ -1688,15 +2253,48 @@
     filenames = ['*.ex', '*.exs']
     mimetypes = ['text/x-elixir']
 
+    def gen_elixir_sigil_rules():
+        states = {}
+
+        states['strings'] = [
+            (r'(%[A-Ba-z])?"""(?:.|\n)*?"""', String.Doc),
+            (r"'''(?:.|\n)*?'''", String.Doc),
+            (r'"', String.Double, 'dqs'),
+            (r"'.*'", String.Single),
+            (r'(?<!\w)\?(\\(x\d{1,2}|\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|'
+             r'[^x0MC])|(\\[MC]-)+\w|[^\s\\])', String.Other)
+        ]
+
+        for lbrace, rbrace, name, in ('\\{', '\\}', 'cb'), \
+                                     ('\\[', '\\]', 'sb'), \
+                                     ('\\(', '\\)', 'pa'), \
+                                     ('\\<', '\\>', 'lt'):
+
+            states['strings'] += [
+                (r'%[a-z]' + lbrace, String.Double, name + 'intp'),
+                (r'%[A-Z]' + lbrace, String.Double, name + 'no-intp')
+            ]
+
+            states[name +'intp'] = [
+                (r'' + rbrace + '[a-z]*', String.Double, "#pop"),
+                include('enddoublestr')
+            ]
+
+            states[name +'no-intp'] = [
+                (r'.*' + rbrace + '[a-z]*', String.Double , "#pop")
+            ]
+
+        return states
+
     tokens = {
         'root': [
             (r'\s+', Text),
             (r'#.*$', Comment.Single),
-            (r'\b(case|end|bc|lc|if|unless|try|loop|receive|fn|defmodule|'
-             r'defp|def|defprotocol|defimpl|defrecord|defmacro|defdelegate|'
-             r'defexception|exit|raise|throw)\b(?![?!])|'
+            (r'\b(case|cond|end|bc|lc|if|unless|try|loop|receive|fn|defmodule|'
+             r'defp?|defprotocol|defimpl|defrecord|defmacrop?|defdelegate|'
+             r'defexception|exit|raise|throw|unless|after|rescue|catch|else)\b(?![?!])|'
              r'(?<!\.)\b(do|\-\>)\b\s*', Keyword),
-            (r'\b(import|require|use|recur|quote|unquote|super)\b(?![?!])',
+            (r'\b(import|require|use|recur|quote|unquote|super|refer)\b(?![?!])',
                 Keyword.Namespace),
             (r'(?<!\.)\b(and|not|or|when|xor|in)\b', Operator.Word),
             (r'%=|\*=|\*\*=|\+=|\-=|\^=|\|\|=|'
@@ -1707,29 +2305,19 @@
              r'<=>|&&?|%\(\)|%\[\]|%\{\}|\+\+?|\-\-?|\|\|?|\!|//|[%&`/\|]|'
              r'\*\*?|=?~|<\-)|([a-zA-Z_]\w*([?!])?)(:)(?!:)', String.Symbol),
             (r':"', String.Symbol, 'interpoling_symbol'),
-            (r'\b(nil|true|false)\b(?![?!])', Name.Constant),
-            (r'\b[A-Z]\w*\b', Name.Constant),
-            (r'\b(__(FILE|LINE|MODULE|STOP_ITERATOR|EXCEPTION|OP|REF|FUNCTION|'
-             r'BLOCK|KVBLOCK)__)\b(?![?!])', Name.Builtin.Pseudo),
-            (r'[a-zA-Z_!]\w*[!\?]?', Name),
+            (r'\b(nil|true|false)\b(?![?!])|\b[A-Z]\w*\b', Name.Constant),
+            (r'\b(__(FILE|LINE|MODULE|MAIN|FUNCTION)__)\b(?![?!])', Name.Builtin.Pseudo),
+            (r'[a-zA-Z_!][\w_]*[!\?]?', Name),
             (r'[(){};,/\|:\\\[\]]', Punctuation),
             (r'@[a-zA-Z_]\w*|&\d', Name.Variable),
             (r'\b(0[xX][0-9A-Fa-f]+|\d(_?\d)*(\.(?![^\d\s])'
              r'(_?\d)*)?([eE][-+]?\d(_?\d)*)?|0[bB][01]+)\b', Number),
+            (r'%r\/.*\/', String.Regex),
             include('strings'),
         ],
-        'strings': [
-            (r'"""(?:.|\n)*?"""', String.Doc),
-            (r"'''(?:.|\n)*?'''", String.Doc),
-            (r'"', String.Double, 'dqs'),
-            (r"'.*'", String.Single),
-            (r'(?<!\w)\?(\\(x\d{1,2}|\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|'
-             r'[^x0MC])|(\\[MC]-)+\w|[^\s\\])', String.Other)
-        ],
         'dqs': [
             (r'"', String.Double, "#pop"),
-            include('interpoling'),
-            (r'[^#"]+', String.Double),
+            include('enddoublestr')
         ],
         'interpoling': [
             (r'#{', String.Interpol, 'interpoling_string'),
@@ -1743,7 +2331,12 @@
             include('interpoling'),
             (r'[^#"]+', String.Symbol),
         ],
+        'enddoublestr' : [
+            include('interpoling'),
+            (r'[^#"]+', String.Double),
+        ]
     }
+    tokens.update(gen_elixir_sigil_rules())
 
 
 class ElixirConsoleLexer(Lexer):
@@ -1802,3 +2395,204 @@
             for item in do_insertions(insertions,
                                       exlexer.get_tokens_unprocessed(curcode)):
                 yield item
+
+
+class KokaLexer(RegexLexer):
+    """
+    Lexer for the `Koka <http://research.microsoft.com/en-us/projects/koka/>`_
+    language.
+
+    *New in Pygments 1.6.*
+    """
+
+    name = 'Koka'
+    aliases = ['koka']
+    filenames = ['*.kk', '*.kki']
+    mimetypes = ['text/x-koka']
+
+    keywords = [
+        'infix', 'infixr', 'infixl', 'prefix', 'postfix',
+        'type', 'cotype', 'rectype', 'alias',
+        'struct', 'con',
+        'fun', 'function', 'val', 'var',
+        'external',
+        'if', 'then', 'else', 'elif', 'return', 'match',
+        'private', 'public', 'private',
+        'module', 'import', 'as',
+        'include', 'inline',
+        'rec',
+        'try', 'yield', 'enum',
+        'interface', 'instance',
+    ]
+
+    # keywords that are followed by a type
+    typeStartKeywords = [
+        'type', 'cotype', 'rectype', 'alias', 'struct', 'enum',
+    ]
+
+    # keywords valid in a type
+    typekeywords = [
+        'forall', 'exists', 'some', 'with',
+    ]
+
+    # builtin names and special names
+    builtin = [
+        'for', 'while', 'repeat',
+        'foreach', 'foreach-indexed',
+        'error', 'catch', 'finally',
+        'cs', 'js', 'file', 'ref', 'assigned',
+    ]
+
+    # symbols that can be in an operator
+    symbols = '[\$%&\*\+@!/\\\^~=\.:\-\?\|<>]+'
+
+    # symbol boundary: an operator keyword should not be followed by any of these
+    sboundary = '(?!'+symbols+')'
+
+    # name boundary: a keyword should not be followed by any of these
+    boundary = '(?![a-zA-Z0-9_\\-])'
+
+    # main lexer
+    tokens = {
+        'root': [
+            include('whitespace'),
+
+            # go into type mode
+            (r'::?' + sboundary, Keyword.Type, 'type'),
+            (r'alias' + boundary, Keyword, 'alias-type'),
+            (r'struct' + boundary, Keyword, 'struct-type'),
+            (r'(%s)' % '|'.join(typeStartKeywords) + boundary, Keyword, 'type'),
+
+            # special sequences of tokens (we use ?: for non-capturing group as
+            # required by 'bygroups')
+            (r'(module)(\s*)((?:interface)?)(\s*)'
+             r'((?:[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*\.)*'
+             r'[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)',
+             bygroups(Keyword, Text, Keyword, Text, Name.Namespace)),
+            (r'(import)(\s+)((?:[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*\.)*[a-z]'
+             r'(?:[a-zA-Z0-9_]|\-[a-zA-Z])*)(\s*)((?:as)?)'
+             r'((?:[A-Z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)?)',
+             bygroups(Keyword, Text, Name.Namespace, Text, Keyword,
+                      Name.Namespace)),
+
+            # keywords
+            (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type),
+            (r'(%s)' % '|'.join(keywords) + boundary, Keyword),
+            (r'(%s)' % '|'.join(builtin) + boundary, Keyword.Pseudo),
+            (r'::|:=|\->|[=\.:]' + sboundary, Keyword),
+            (r'\-' + sboundary, Generic.Strong),
+
+            # names
+            (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?=\.)', Name.Namespace),
+            (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?!\.)', Name.Class),
+            (r'[a-z]([a-zA-Z0-9_]|\-[a-zA-Z])*', Name),
+            (r'_([a-zA-Z0-9_]|\-[a-zA-Z])*', Name.Variable),
+
+            # literal string
+            (r'@"', String.Double, 'litstring'),
+
+            # operators
+            (symbols, Operator),
+            (r'`', Operator),
+            (r'[\{\}\(\)\[\];,]', Punctuation),
+
+            # literals. No check for literal characters with len > 1
+            (r'[0-9]+\.[0-9]+([eE][\-\+]?[0-9]+)?', Number.Float),
+            (r'0[xX][0-9a-fA-F]+', Number.Hex),
+            (r'[0-9]+', Number.Integer),
+
+            (r"'", String.Char, 'char'),
+            (r'"', String.Double, 'string'),
+        ],
+
+        # type started by alias
+        'alias-type': [
+            (r'=',Keyword),
+            include('type')
+        ],
+
+        # type started by struct
+        'struct-type': [
+            (r'(?=\((?!,*\)))',Punctuation, '#pop'),
+            include('type')
+        ],
+
+        # type started by colon
+        'type': [
+            (r'[\(\[<]', Keyword.Type, 'type-nested'),
+            include('type-content')
+        ],
+
+        # type nested in brackets: can contain parameters, comma etc.
+        'type-nested': [
+            (r'[\)\]>]', Keyword.Type, '#pop'),
+            (r'[\(\[<]', Keyword.Type, 'type-nested'),
+            (r',', Keyword.Type),
+            (r'([a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)(\s*)(:)(?!:)',
+             bygroups(Name.Variable,Text,Keyword.Type)),  # parameter name
+            include('type-content')
+        ],
+
+        # shared contents of a type
+        'type-content': [
+            include('whitespace'),
+
+            # keywords
+            (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type),
+            (r'(?=((%s)' % '|'.join(keywords) + boundary + '))',
+             Keyword, '#pop'),  # need to match because names overlap...
+
+            # kinds
+            (r'[EPH]' + boundary, Keyword.Type),
+            (r'[*!]', Keyword.Type),
+
+            # type names
+            (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?=\.)', Name.Namespace),
+            (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?!\.)', Name.Class),
+            (r'[a-z][0-9]*(?![a-zA-Z_\-])', Keyword.Type),   # Generic.Emph
+            (r'_([a-zA-Z0-9_]|\-[a-zA-Z])*', Keyword.Type),  # Generic.Emph
+            (r'[a-z]([a-zA-Z0-9_]|\-[a-zA-Z])*', Keyword.Type),
+
+            # type keyword operators
+            (r'::|\->|[\.:|]', Keyword.Type),
+
+            #catchall
+            (r'', Text, '#pop')
+        ],
+
+        # comments and literals
+        'whitespace': [
+            (r'\s+', Text),
+            (r'/\*', Comment.Multiline, 'comment'),
+            (r'//.*$', Comment.Single)
+        ],
+        'comment': [
+            (r'[^/\*]+', Comment.Multiline),
+            (r'/\*', Comment.Multiline, '#push'),
+            (r'\*/', Comment.Multiline, '#pop'),
+            (r'[\*/]', Comment.Multiline),
+        ],
+        'litstring': [
+            (r'[^"]+', String.Double),
+            (r'""', String.Escape),
+            (r'"', String.Double, '#pop'),
+        ],
+        'string': [
+            (r'[^\\"\n]+', String.Double),
+            include('escape-sequence'),
+            (r'["\n]', String.Double, '#pop'),
+        ],
+        'char': [
+            (r'[^\\\'\n]+', String.Char),
+            include('escape-sequence'),
+            (r'[\'\n]', String.Char, '#pop'),
+        ],
+        'escape-sequence': [
+            (r'\\[abfnrtv0\\\"\'\?]', String.Escape),
+            (r'\\x[0-9a-fA-F]{2}', String.Escape),
+            (r'\\u[0-9a-fA-F]{4}', String.Escape),
+            # Yes, \U literals are 6 hex digits.
+            (r'\\U[0-9a-fA-F]{6}', String.Escape)
+        ]
+    }
+

eric ide

mercurial