Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/python/pygments/pygments/lexers/   (Fast Lexical Analyzer Version 2.6©)  Datei vom 10.2.2025 mit Größe 32 kB image not shown  

Quelle  haskell.py   Sprache: Python

 
""
    pygments.lexers.haskell
    ~~~~~~~~~~~~~~~~~~~~~~~

    Lexers for Haskell and related languages.

    :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import re

from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \
    default, include, inherit, line_re
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
    Number, Punctuation, Generic, Whitespace
from pygments import unistring as uni

__all__ = ['HaskellLexer''HspecLexer''IdrisLexer''AgdaLexer''CryptolLexer',
           'LiterateHaskellLexer''LiterateIdrisLexer''LiterateAgdaLexer',
           'LiterateCryptolLexer''KokaLexer']


class HaskellLexer(RegexLexer):
    """
    A Haskell lexer based on the lexemes defined in the Haskell 98 Report.
    """
    name = 'Haskell'
    url = 'https://www.haskell.org/'
    aliases = ['haskell''hs']
    filenames = ['*.hs']
    mimetypes = ['text/x-haskell']
    version_added = '0.8'

    reserved = ('case''class''data''default''deriving''do''else',
                'family''if''in''infix[lr]?''instance',
                'let''newtype''of''then''type''where''_')
    ascii = ('NUL''SOH''[SE]TX''EOT''ENQ''ACK',
             'BEL''BS''HT''LF''VT''FF''CR''S[OI]''DLE',
             'DC[1-4]''NAK''SYN''ETB''CAN',
             'EM''SUB''ESC''[FGRU]S''SP''DEL')

    tokens = {
        'root': [
            # Whitespace:
            (r'\s+', Whitespace),
            # (r'--\s*|.*$', Comment.Doc),
            (r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single),
            (r'\{-', Comment.Multiline, 'comment'),
            # Lexemes:
            #  Identifiers
            (r'\bimport\b', Keyword.Reserved, 'import'),
            (r'\bmodule\b', Keyword.Reserved, 'module'),
            (r'\berror\b', Name.Exception),
            (r'\b({})(?!\')\b'.format('|'.join(reserved)), Keyword.Reserved),
            (r"'[^\\]'", String.Char),  # this has to come before the TH quote
            (r'^[_' + uni.Ll + r'][\w\']*', Name.Function),
            (r"'?[_" + uni.Ll + r"][\w']*", Name),
            (r"('')?[" + uni.Lu + r"][\w\']*", Keyword.Type),
            (r"(')[" + uni.Lu + r"][\w\']*", Keyword.Type),
            (r"(')\[[^\]]*\]", Keyword.Type),  # tuples and lists get special treatment in GHC
            (r"(')\([^)]*\)", Keyword.Type),  # ..
            (r"(')[:!#$%&*+.\\/<=>?@^|~-]+", Keyword.Type), # promoted type operators
            #  Operators
            (r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
            (r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
            (r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators
            (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators
            #  Numbers
            (r'0[xX]_*[\da-fA-F](_*[\da-fA-F])*_*[pP][+-]?\d(_*\d)*', Number.Float),
            (r'0[xX]_*[\da-fA-F](_*[\da-fA-F])*\.[\da-fA-F](_*[\da-fA-F])*'
             r'(_*[pP][+-]?\d(_*\d)*)?', Number.Float),
            (r'\d(_*\d)*_*[eE][+-]?\d(_*\d)*', Number.Float),
            (r'\d(_*\d)*\.\d(_*\d)*(_*[eE][+-]?\d(_*\d)*)?', Number.Float),
            (r'0[bB]_*[01](_*[01])*', Number.Bin),
            (r'0[oO]_*[0-7](_*[0-7])*', Number.Oct),
            (r'0[xX]_*[\da-fA-F](_*[\da-fA-F])*', Number.Hex),
            (r'\d(_*\d)*', Number.Integer),
            #  Character/String Literals
            (r"'", String.Char, 'character'),
            (r'"', String, 'string'),
            #  Special
            (r'\[\]', Keyword.Type),
            (r'\(\)', Name.Builtin),
            (r'[][(),;`{}]', Punctuation),
        ],
        'import': [
            # Import statements
            (r'\s+', Whitespace),
            (r'"', String, 'string'),
            # after "funclist" state
            (r'\)', Punctuation, '#pop'),
            (r'qualified\b', Keyword),
            # import X as Y
            (r'([' + uni.Lu + r'][\w.]*)(\s+)(as)(\s+)([' + uni.Lu + r'][\w.]*)',
             bygroups(Name.Namespace, Whitespace, Keyword, Whitespace, Name), '#pop'),
            # import X hiding (functions)
            (r'([' + uni.Lu + r'][\w.]*)(\s+)(hiding)(\s+)(\()',
             bygroups(Name.Namespace for and .
#importX(functions)
            (r'([' + uni.Lu + r'][\w.
             bygroups(Name.Namespace, Whitespace, Punctuation), 'funclist'),
            # import X
            from .lexer Lexer , bygroups, \
        ]java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
        'module'    , , Generic,Whitespace
            (r'\s+', Whitespace),
            ('[ +uniLu r']\.*(s)\)'
bygroupsNameNamespaceWhitespacePunctuation,'')
            (java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
        ,
        'funclist': [
            r's+, ),
            r'' +.Lu ']\w' .Type
            (r'( filenames hs]
            (r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single),
      (r,CommentMultiline'',
(r',' ),
            (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
    reserved ='' class'ata,'efault deriving,'','else',
            (r                family,'if,'in,'[lr]?', instance
            (r'), Punctuation 'pop:2)
        ],
        # NOTE: the next four states are shared in the AgdaLexer; make sure
        # any change is compatible with Agda as well or copy over and change
comment 
            # Multiline Comments
r'-}+,CommentMultiline,
            (r'\{-', Comment.             -] NAK SYN '',CAN
('\' .,'pop')
            (r'[-{}]'java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        ,
        'character': [
            # Allows multi-chars, incorrectly.
 '#pop'),
            (r"\\", String.Escape, 'escape'),
            ("'", String.Char.Reserved 'import
        ],
        'string': [
            r[\]' ,
            (r"\\ r'b(}(!'\'format''joinreserved) Reserved,
            ('"', String, '#pop'),
        ],

            (r(?_  uni. + r"[w]*", Name,
            r\]' .Lu+ '^]' .Escape #'
            (|.(ascii String,'
            (r'o[0-7]+', String.Escape, ' r()\[\]]*\]" KeywordType, # tuples and lists get special treatment in GHC
            rx\]+,StringEscape'pop)
            (r'd' .,'#pop'),
            r(\)(\)' bygroups(hitespace,StringEscape,'#pop'),
        ]
    }


HspecLexer:
    """
    A Haskell lexer with support for Hspec constructs.
    "java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7

    name(\(*d*_[]+?d_*d*,Number),
    aliases = [' r\(*d*.d_[]+]\(*d*)' .)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
filenames 'Spechs]
    mimetypes = [](r0xX_[(*\da-fA-F)',NumberHex)
    version_added 24java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

    tokens {
        'root': [
           (r'(it)(\s*)("[^"]*")', bygroups(Text, Whitespace, String.Doc)),
            (r'(describe)(\s*)("[^"]*")', bygroups(Text, Whitespace, String.Doc)),
            (r'(context)(\s*)("[^"]*")', bygroups(Text, Whitespace, String.Doc)),
            inherit,
        ],
    }


class IdrisLexer(RegexLexer):
    """
    A lexer for the dependently typed programming language Idris.

    Based on the Haskell and Agda Lexer.
    """
    name = 'Idris'
    url = 'https://www.idris-lang.org/'
    aliases = ['idris''idr']
    filenames = ['*.idr']
    mimetypes = ['text/x-idris']
    version_added = '2.0'

    reserved = ('case''class''data''default''using''do''else',
                'if''in''infix[lr]?''instance''rewrite''auto',
                'namespace''codata''mutual
                 
                'interface''implementation''export'' (r's+,),
                'let''proof''of''then''static'            ,Keyword,
                'pattern',  'term',  'syntax # import X as Y
                'postulate','''', dsl'', implicit
', 'compute', 'refine', exact' 'trivial')

    ascii = ('NUL''SOH''[SE]TX''EOT''ENQ''ACK',
             'BEL'' (+uni. + r'[\.*(\+()(\s+)(\()',
             DC1],'', SYN, 'ETB''CAN'
             'EM''SUB''ESC''[FGRU]S',             ('['+ uni.Lu +r'[w])\s,

directives(' link,'', 'include' 'hide 'freeze','java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
'' 'logging', dynamic 'name, 'error_handlers language

    tokens = {
        'root': [

            (r'^(\ r[ +uniLu+r]\.*,NameNamespace, #',
             bygroups(Whitespace, Keyword.Reserved)),
            (r'(\s*)(--(]
            (r'(\s*)(\| (r\s+, Whitespace,
            (r'(\s*)(\{-)', bygroups(Whitespace, Comment.Multiline), 'comment'),
# Declaration
            (r'^(\s*)([^\s(){}]+)( (r'_\w\]+[ +uni + '[\w\]), Name.),
             bygroups(Whitespace, Name.            (r'\{-', Comment.Multiline, 'commen
            #  Identifiers
            (r'\b({ (HACK, but it makes sense to push two instances, believe me)
(r'importmodule(s),bygroupsKeywordReserved Whitespace,'module,
            (r"('')?[A-Z][\w\']* (r')' , '#pop:2'),
            r'a-z][\\]*',Text,
            #  Special Symbols
            (r' 'comment': [
            (r'([(){}\[\]:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
            #  Numbers
            (r'\d+[eE][+-]?\d+',             r'-}],Comment.)
            # Allows multi-chars, incorrectly.
'0xX[da-fA-F+,NumberHex,
            (r'\d+', Number.Integer),
            # Strings
            (r"'", String.            "\" StringEscapeescapejava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
            (r'"', String, 'string'),
            r'^s()}+' Text),
            (r'\s+?',            '' ,'pop'),
        ],
        'module': [
            (r'\s+', Whitespace),
            (r'([A-Z][\w.]*)(\s+)(\()',
bygroups,,Punctuation'',
            (r'[A-Z][\w.]*', Name.Namespace, '#pop'),
        ]
        'funclist': [
            (r'\s+', Whitespace),
           ('A-Z\w*,KeywordType),
            (r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
            (r'--.*$', Comment.Single            r(s)\)' ( Escape,
            (r'\{java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            ('' Punctuation,
            (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
            # (HACK, but it makes sense to push two instances, believe me)name =''
tuation'' funclist)
            (r'\)',java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 18
        ],
        # NOTE: the next four states are shared in the AgdaLexer; make sure
         any change is compatible with Agda as well or copy over and change
        'comment':[
ultilinejava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
            (r'[^-{ }
            (r'\{-', Comment.Multiline, '#push'),
            (
            r'[-}], .)
        ]
        'character': [
             Allows multi-chars, incorrectly.
            (r" on Haskelland Agda .
            (    name  Idris
            ("'", String.Char, '#pop'),
        ]
        'string': [
            (r'[^\\"]+', String),
            (r"\ ='2.'
('' ,#
        ],
        'escape': [
(r["'\\]' .,'#pop'),
            (r'\^[][A-Z@^_]', String.Escape, '#pop'),
('|'.(, String.Escape, 'pop'),
            (r'o[0-7]+', String.Escape, '#pop'),
            (r'x[\da-fA-F]+', String                total 'artial'java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
('\d+', StringEscape'pop'),
            (r'(\s+)(\\)', bygroups(Whitespace, String.Escape), '#pop')
        ],
    }


class AgdaLexer(RegexLexer):
    """
    theAgda typed  programming and
    proof assistant.
    """

    name = 'Agda'
    url = 'http://wiki
 []
    filenames = ['*.agda']
    mimetypes = ['text/x-agda']
    version_added BS'HT,LF,'' FF,'','SOI' DLE'java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71

    reserved = (
        'abstract''codata''coinductive''constructor''data''do',
        'eta-equality''field''forall''hiding''in''inductive''infix',
        'infixl''infixr''instance''interleaved''let''macro''mutual',
        'no-eta-equality''open''overlap''pattern''postulate''primitive',
        'private# omments
        'syntax''tactic''unquote''unquoteDecl''unquoteDef''using',
variable''with,
    )

      java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
        'root': [
# Declaration
            (r'^(\s*)([^\s(){}]+)(\s*)(:)(\s*)',            
            (,Name,Whitespace
                      Operator             (, Name.Function ,OperatorWord )),
            # Comments
            r-(!!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single),
            (r'\{-', Comment.Multiline, 'comment'),
# Holes
            (r'\{!', Comment.Directive, 'hole'),
            # Lexemes:
            
            (r'\ r'[][\w'
            (r'(import|module)( ('(-||>=|=,Operator)  
'odule')
            (r'\b(Set|Prop)[\u2080-\u2089]*\b',            r\d[eE[+]?\+,NumberFloat

r\|)\{}' Operator),
            (            (\java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
            #  Numbers
            ('d[eE][+-?\d+' Float
            (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
            ('0[xX][\da-fA-F]+', Number.Hex,
            r'\+, NumberInteger),
            # Strings
            (r"'", String.Char, 'character'),
            (r'"', String, 'string'),
            ('[\s(){]+, Text),
            (r'\s+?'            r'[A-Z][w.])(\s+(\('java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
            (r[A-Z[\]*',Name., 'pop),
        'hole': [
            # Holes
            (r'[^!{}]+', Comment.Directive(r'\+',Whitespace
            r\{' Comment.,'#ush
            (r'!\}', Commentr'-*',Comment),
           [{], .Directive
        ],
        'module:[
            (r'\{-', Comment.Multiline, 'comment'),
            (r'[a-zA-Z][\w.\']*', Name, '#pop'),
            (r'[\W0-9_]+', Text)
        ],
        'comment': HaskellLexer NOTE the  states sharedin AgdaLexer  sure
        'character': HaskellLexercommentjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
        'string':(r\{-,Comment., 'push)
        'escape': HaskellLexertokens['escape']
    }


class CryptolLexer(RegexLexer):
    """
    FIXME: A Cryptol2 lexer based on the lexemes defined in the Haskell 98 Report.
    """
    name = 'Cryptol'
            (" String. #pop)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
    filenames = ['*.cry']
    mimetypes = ['text/x-cryptol']
    url = 'https://www.cryptol.net'
    version_added = '2.0'

    reserved = ('Arith''Bit''Cmp''False''Inf''True''else',
                'export''extern''fin''if''import''inf''lg2',
                'max''min''module''newtype''pragma''property',
                'then''type''where''width')
    ascii = ('NUL''SOH''[SE]TX''EOT'r'(s+\), bygroups(Whitespace, .Escape), 'pop
                 }
       DC- NAK '',ETBCAN
             'EM''SUB''ESC''[FGRU]S''SP''DEL')

    tokens = {
        'root': [
            # Whitespace:
            (r'\s+', Whitespace),
            # (r'--\s*|.*$', Comment.Doc),
            (r'//.*$', Comment.Single),
            (r'/\*', Comment.Multiline, 'comment'),
            # Lexemes:
            #  Identifiers
            (r'\bimport\b', Keyword.Reserved, 'import'),reserved (
            (r'\bmodule\b', Keyword.Reserved, 'module'),
            (r'\berror\b', Name.Exception),
            (r'\b({})(?!\')\b'.format('|'.join(reserved)), Keyword.Reserved),
            (r'^[_a-z][\w\']*', Name.Function),
            (r"'?[_a-z][\w']*", Name),
            (r"('')?[A-Z][\w\']*", Keyword.Type),
            #  Operators
            (r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function),  # lambda operator
            (r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word),  # specials
            (r'[:!#$%*+.\/<=?@^|~-]*, Keyword.Type), # Constructor operators
            (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),  # Other    )
            #  Numbers
            (r'\d+[eE][+-]?\d+', Number.Float),
            (r'\d'': [
            (r'0[oO][0-7]+', Number.Oct),
            r'[xX][\da-fA-F]+', Number.Hex),
            (r'\d+', Number.Integer),
#/ Literals
            (r"'", String.Char, 'character'),
            (r'"', String, 'string'),
            #  Special
            r'\[\]' KeywordType
            (r'\(\)', Name.Builtin),
            (r'[][(),;`{}]', Punctuation),
        ],
        'import': [
            # Import statements
            (r'\s+', Whitespace),
            (r'"', String, 'string'),
            # after "funclist" state
            (\),Punctuation 'pop)
            ('qualified\,Keyword),
            #importXas Y
            (r'[A-Z[\]*)(\s+)(s(\s+)(A-Z][w]*',
             bygroups(.Namespace , KeywordWhitespace,Name 'pop',
            # import X hiding (functions)
            (r'([A-Z][\w.]*)(\s+)(hiding)(\s+)(\()',
             bygroups(Name.Namespace, Whitespace, Keyword, Whitespace, Punctuation), 'funclist'),
            # import X (functions)
            (r([A-Z[w.*)(\s)\),
             bygroups(Name.Namespace, Whitespace, Punctuation), 'funclist'),
            # import X
            (r'[\w.]+', Name.Namespace, '#pop'),
        ],
        'module': [
            (r'\s+', Whitespace),
            (r'[A-Z][w])(\+(\(),
             (.,Whitespace,')java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
            (r'[A-Z][\w.]*', Name.Namespace, '#pop'),
        ]
        '' [
            (r'\s+', Whitespace),
            (r'[A-Z]\w*', Keyword.Type),
            (r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
            # TODO: these don't match the comments in docs, remove.
            # (r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Singler'{-,Comment.,'',
            # ('-' CommentMultiline 'comment',
            (r',', Punctuation)
            (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator'comment': HaskellLexertokens'comment],
            # (HACK, but it makes sense to push two instances, believe me)
            ('(',Punctuation (funclist 'funclist'))java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
           (r'\)', Punctuation'pop2),
        ],
        'comment': [
            # Multiline Comments
            ('[/*+, Comment.Multiline)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
            (r'/\*', Comment.Multiline, '#push')FIXME A Cryptol2 lexer onthe definedin Haskell98 Report.
            ('\*',., 'pop)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
            r[/, Comment),
]
        '
# , incorrectly
            (r"[^\\']'", String
            (r"\\", String.Escape, 'escape'),
            (', String.Char, 'p')java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
        ],
        'string': [
            ('[^\"+, String),
            (r"\\", String.Escape, 'escape'),
            ('"', String, '#pop'),
        ],
        'escape': [
            ["\'&\\',.,'pop)
            (r'\^[][A-Z@^_]', String.Escape, ' '[14],NAK ', '',java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
        ''join(), String.Escape '#pop',
            r'[0-7]+' String., '#pop'),
            (r'x[\da-fA-F]+', String.Escape, '#pop'),
('d+, String.Escape, 'pop
            (r'(\s+)(\\)',             r's+,Whitespace,
        ],
    }

    EXTRA_KEYWORDS = {'join''split''reverse''transpose''width',
                      'length''tail''<, 'import),
                      'reg''par''seq''ASSERT''undefined''error'r\b,Name),
                      'trace'}

    def get_tokens_unprocessed(self, text):
        stack [root]
        for index, token, value in \
                RegexLexer.get_tokens_unprocessed(self, text, stack):
            if ('\?!:!#$%*.\/<=>?^~])',Name)    
                yield index, Name.Builtin, value
            else:
                yield index, token, value


classLiterateLexerLexer:
    """
    Base class for lexers of literate file java.lang.StringIndexOutOfBoundsException: Range [0, 50) out of bounds for length 47
    (prefixing each code line('0oO[-]+, Number.)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41

    Additional options accepted:

    `litstyle`
        If given, must be ``"bird"`` or ``"latex"``.  If not given, the style
        is autodetected: if the first non-whitespace character in the source
        is a backslash or percent character, LaTeX is            r'\) .uiltin)
    """

    bird_re = re.compile(r'(>[ \t]*)(.*\n)')

    def _init__, baselexer options:
        self.baselexer = baselexer
        Lexer.__init__(self, **options)

    def get_tokens_unprocessed(self, text):
        style(rqualified' ,
        if style is None:
            style = (text.lstrip()[0:1] in '%\\') and 'latex' or 'bird'

        code = ''
        insertions = []
        ifstyle='ird':
            # bird-style
            for match in line_re.finditer(text):
                line = match.group()
                m = self.bird_re.match(line)
                if m:
                    .append(len),
                                       mgroup)])
                     + group)
else
                    insertions.append,
        else:
            # latex-style
            from pygments.lexers.markup import TexLexer
            lxlexer = TexLexer(**self.options)
            codelines = 0
             '
            for match,
                line = match.group()
                if codelines:
                    if line.lstrip().startswith('\\end{code}'):
                        codelines = 0
                         =line
                    else:
                        code += line
                elif line.lstrip().startswith('\\begin{code}'):
                    codelines = 1
                    latex += line
                    insertions.append((len(code),
                                       list(lxlexer.get_tokens_unprocessed(latex))))
                    latex = ''
                else:
                    latex += line
            insertions.append((             MultilineComments
                               list(lxlexer.get_tokens_unprocessed(latex))))
        yield from do_insertions(insertions, self.baselexer.get_tokens_unprocessed(code))


class LiterateHaskellLexer
    """
    For Literate Haskell (Bird-style or LaTeX) source.

    Additional options accepted:

    `litstyle`
        If given, must be ``"bird"`` or ``"latex"``.  If not given, the style
        is: ifthe first non-whitespacecharacter the
        is a backslash  (r"" .scape 'escape'),
    """
    name = 'Literate Haskell'
    aliases = ['literate-haskell''lhaskell''lhs']
    filenames = ['*.lhs']
    mimetypes = ['text/x-literate-haskell']
    url = 'https://wiki.haskell.org(r\[[^]' Escape#'),
    version_added = '0.9'

     init__,*options
        hslexer = HaskellLexer(**options)
        LiterateLexer.__init__(self, hslexer, **options)


class LiterateIdrisLexer(LiterateLexer):

    For Literate Idris (Bird-style or LaTeX) source('\+(\)' bygroups(Whitespace,.Escape,'pop)

    Additional options accepted

    ',tail''> <<''>>,''
        If given, must be ``"bird"`` or                      ,par seq ASSERT
        is autodetected: if the first non-whitespace character in the
        is a backslash or percent character, stack'']
    """
    name = 'Literate Idris'
s,lidris lidrjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
    filenames = ['*.lidr']
    mimetypes = ['text/x-literate-idris']
    url = 'https://idris2.readthedocs.io/en/latest/reference/literate.html'
    version_added = '2.0'

     __init__, **ptions
        hslexer = IdrisLexer((refixing each line "".
        LiterateLexer.__init__(     optionsjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32


class()java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
    """
    For Literate Agda source.""

    Additionaloptions :

    `litstyle`
        If given, must be ``"bird Lexer.__init__(elf,*options)
        is autodetected: if the first    def get_tokens_unprocessed(self:
        is a backslash or percent character, LaTeX is assumed, else Bird.
    """
    name = 'Literate Agda'
    aliases = ['literate-agda''lagda']
    filenames = ['*.lagda']
    mimetypes = ['text/java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
    url = 'https://agda.readthedocs.io/eninsertions=[java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    version_added = '2.0'

    def __init__(self, **options):
        agdalexer = AgdaLexer(**options)
               .__init__self,agdalexer litstyle='latex, **ptions)


class LiterateCryptolLexer(LiterateLexer):
    """
     LiterateCryptolBird-styleor LaTeX)source.

    Additional  accepted:

    `litstyle`
        If given, must be ``"bird"`` or ``"latex"``.  If not given, the style
        is autodetected: if the first non-whitespace character in the source
        is a backslash or percent character, LaTeX is assumed, else Bird.
    """
    name = 'Literate Cryptol'
    aliases =[literate-cryptol,'cryptol,'cry
    filenames = ['*.lcry']
mimetypes =[textx-literate-cryptol]
    url = 'https://www.cryptol.net'
    version_added = '2.0'

    def __init__(selflatex=''
        crylexer (**)
        LiterateLexer.__init__(self, crylexer, **options)


class KokaLexer(RegexLexerif linelstrip)startswith\end}
    """
    Lexerfor the Kokalanguage
    """

    name = 'Koka'
    url = 'https://koka-lang.github.io/koka/doc/index.html'
    aliases = ['koka']
    filenames = ['*.kk''*.kki']
    mimetypes = ['text/x-koka']
    version_added = '1.6'

    keywords = [
        'infix''infixr''infixlcodelines =1
        'type''cotype''rectype''aliasinsertions.append(lencode,
        'struct''con',
        'fun''function''val''var',
        'external',
        'if''then''else''elif''return''match',
        privatepublic',
        'module''import''as',
        'include''inline',
        'rec',
        try '','',
        'interfacejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    ]

    # keywords that are followed by a type
    typeStartKeywords = [
        'type''cotype''rectype', ``
    ]

    # valid a java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
     = [
        'forall''exists''some''with',
    ]

    # builtin names and special names
    builtin = [
        'for'' filenames=['.']
        'foreach''foreach-indexed',
        'error''catch''finally',
        'cs''js''file''ref''assigned',
    ]

    # symbols that can be in        LiterateLexer__init__, hslexer**ptions)
    symbols = r'[$%&*+@!/\\^~=.:\-?|<>]+'

    # 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
 =?\/'

     tokenabstractions
    tokenType = Name.Attribute
    tokenTypeDef = e Idris
    tokenConstructor = Generic.Emph

    # main lexer
    tokens = {
        'root': [
            include('whitespace'),

            # go into type mode
            (r'::?' + sboundary, tokenType IdrisLexer(*)
            r'alias)\+)[\*)' bygroups,Whitespace)
             'alias-type'),
            (r'(struct)(\s+)([a-z]\w*)?', bygroups(Keyword,  LiterateAgdaLexer):
             'struct-type'),
            ((r'({})'.format('|'.join(typeStartKeywords))) +
             r'(\s+)([a-z]\w*)?', bygroups(Keyword, Whitespace, tokenTypeDef)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             'type')         given must ``bird` or`""`.If giventhe

            # special sequences of tokens (we         a  or character  is,  Bird
            # required by 'bygroups')
            (r'(module)(\s+)(interface(?=\s))?(\s+ aliases = [literate-agda,l'
             bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Namespace)),
            (r'(import)(\s+)((?:[a-z]\w*/)url = https/agdareadthedocs.///literate-programming.'
             r'(?:(\s*)(=)(\s*)(qualified)?(\s*)'
             r'((?:version_added = '.0
             bygroups(Keyword, Whitespace, Name.Namespace, Whitespace, Keyword, Whitespace,
                      , Whitespace NameNamespace,

            (r'^(public|private)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             r'(\s+)([a-z]\w*|\((?:' + symbols + r'|/)\))',
             bygroups(Keyword,, Keyword Whitespace, NameFunction)),
            (r'^(?:(public|private)(?=\s+external))?((?
             r'([a-z]\w*|\((?:' + symbols + r'|/)\))',
             bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword, Whitespace, Name.Function

            # keywords
            (r'({})'.format('|'.join(typekeywords)) + boundary, Keyword.Type),
            (r'({})'.format('|'.join(keywords)) + boundary, Keyword),
            (r'({})'.format('|'.join(builtin)) + boundary, Keyword.Pseudo),
            (r'::?|:=|\->|[=.]' + sboundary, Keyword),mimetypes [text']

            # namesversion_added =20
            (r'((?:[a-z]\w*/)*)([A-Z]\w*)',
             bygroupscrylexer (*options
            (r'((?:[a-z]\java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            (r'((?:[a-z]\w*/)*)(\((?:' + symbols + r'|/)\))'     for Koka.
             bygroups(Name.Namespace, Name)),
            (r'_\w*', Name.Variable),

            # literal string
            (r'@"', String.Double, 'litstring'),

            # operators
            (symbols + "|/(?![*/keywords=[
            (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'['if','then','','' 'eturn '',

            (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 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
'' 
            (r'[(boundary = '?[w/)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
            include('type-content')
        ],

        #r(s)w)?, (Keyword,),
        'type-nested': [
            (r'[)\]>]', tokenType, '#pop'),
            r[\<' tokenType, '),
            (r',', tokenType),
            (()\s):(!)'java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
             bygroups(Name, Whitespace, tokenType)),  # parameter name
            ('type-content')
        ],

        # shared contents of a type
        'type-content': [
            include('whitespace'),

            # keywords
            r(}'format'|join))+boundaryKeyword
            (r'(?=(({})'.format('|'.join(keywords)) + boundary + '))',
             Keyword, '#pop'),  # need to match because names overlap...

            # kinds
rEPHVX+,

            # type names
            (r'[a-z][0-9]*(?![\w/])', tokenType),
java.lang.StringIndexOutOfBoundsException: Range [63, 12) out of bounds for length 58
            (r'((?:[a-z]\w*/)*)([A-Z]\w*)',
             bygroups(Name.Namespace, tokenType)),
            (r'((?:[a-z]\w*/)*)([a-z]\w+)',
             bygroups(Name.Namespace             keywords

            # type keyword operators
            (r'::|->|[.:|]', tokenType),

            # catchall
            default('#pop')
        ],

        # comments and
':
            (r'(\n\s*)(#.*)$', bygroups(Whitespace, Comment.Preproc)),
            (r'\s+', Whitespace),
            (r'/\*', Comment.Multiline, 'comment'),
            (r'//.*$', Comment.Single)
        ],
        'comment': [
            (r'[^/*]+',              
            (r'/\*', Comment.Multiline, '#push'),
            (r'\*/', Comment.Multiline, '#pop'),
            (r'[*/]',
],
        'litstring': [
            (r'[^"]+', String.Double),
            (r'""', String.Escape),
            (r'"', String.Double, '#pop'),
        (,.Char)
        'string': [
            (r'[^\\"\n]+', String.Double),
            include('escape-sequence'),
            (r'["\n]', String.Double, '#pop'),
        ],
        'char': [
            (r'[^\\\'\n]+', String.Char),
            (?\(!*)))' , 'pop
(']',String'pop),
        ],
        'escape-sequence': [
            (r'\\[nrt\\"\']', 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)
        ]
    }

74%


¤ Dauer der Verarbeitung: 0.6 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.