# File generated by the BNF Converter (bnfc 2.9.5).

import pygments.lexer
from pygments.token import *
__all__ = ["ExternalLexer"]
class ExternalLexer(pygments.lexer.RegexLexer):
    name = 'External'
    aliases = ['external']
    KEYWORDS = ['in', 'record', 'type', 'where']
    def get_tokens_unprocessed(self, text):
        for index, token, value in super(ExternalLexer,self).get_tokens_unprocessed(text):
            if token is Name and value in self.KEYWORDS:
                yield index, Keyword, value
            else:
                yield index, token, value
    tokens = {
        'root': [
            (r'--.*\n', Comment),
            (r'\{-((.)(?<!-))*-((.)(?<![-\}])((.)(?<!-))*-|-)*\}', Comment),
            (r'True|False', Name),
            (r'(\d)+', Name),
            (r'(\d)+\.(\d)+', Name),
            (r'@(network|dataset|parameter|property|tensor)', Name),
            (r'@postulate', Name),
            (r'\{', Name),
            (r'\}', Name),
            (r'->', Name),
            (r'forallT', Name),
            (r'if', Name),
            (r'then', Name),
            (r'else', Name),
            (r'\.', Name),
            (r':', Name),
            (r'\\', Name),
            (r'let', Name),
            (r'Type', Name),
            (r'Unit', Name),
            (r'Bool', Name),
            (r'Index', Name),
            (r'Nat', Name),
            (r'Real', Name),
            (r'List', Name),
            (r'Vector', Name),
            (r'Tensor', Name),
            (r'forall', Name),
            (r'exists', Name),
            (r'foreach', Name),
            (r'=>', Name),
            (r'and', Name),
            (r'or', Name),
            (r'not', Name),
            (r'==', Name),
            (r'!=', Name),
            (r'<=', Name),
            (r'<', Name),
            (r'>=', Name),
            (r'>', Name),
            (r'==\.', Name),
            (r'!=\.', Name),
            (r'<=\.', Name),
            (r'<\.', Name),
            (r'>=\.', Name),
            (r'>\.', Name),
            (r'\*', Name),
            (r'/', Name),
            (r'\+', Name),
            (r'-', Name),
            (r'min', Name),
            (r'max', Name),
            (r'nil', Name),
            (r'::', Name),
            (r'\[', Name),
            (r'\]', Name),
            (r'!', Name),
            (r'map', Name),
            (r'fold', Name),
            (r'reduceOr', Name),
            (r'reduceAnd', Name),
            (r'reduceAdd', Name),
            (r'reduceMul', Name),
            (r'reduceMin', Name),
            (r'reduceMax', Name),
            (r'HasLeq', Name),
            (r'HasEq', Name),
            (r'HasNotEq', Name),
            (r'HasAdd', Name),
            (r'HasSub', Name),
            (r'HasMul', Name),
            (r'HasFold', Name),
            (r'HasMap', Name),
            (r'IsTensorType', Name),
            (r'name', Name),
            (r'infer', Name),
            (r'[a-zA-Z](_|\d|[a-zA-Z])*', Name),
            (r'\?(_|\d|[a-zA-Z])*', Name),
            (r'\.[a-zA-Z](_|\d|[a-zA-Z])*', Name),
            (r'[a-zA-Z]([a-zA-Z]|\d|_|\')*', Name),
            (r'@0|\(|\)|\{|\}|\{\{|\}\}|=|,|\(\)|;', Operator),
            (r'(\d)+', Number.Integer),
            (r'(\d)+\.(\d)+(e(-)?(\d)+)?', Number.Float),
            (r'"((.)(?<!["\\])|\\["\\nt])*"', String.Double),
            (r'\'((.)(?<![\'\\])|\\[\'\\nt])\'', String.Char),
            (r'\s+', Token.Space)
        ]
    }
