Ejemplo n.º 1
0
    def __init__(self, **options):
        level = get_choice_opt(options, 'unicodelevel', list(self.tokens.keys()), 'basic')
        if level not in self._all_tokens:
            # compile the regexes now
            self._tokens = self.__class__.process_tokendef(level)
        else:
            self._tokens = self._all_tokens[level]

        RegexLexer.__init__(self, **options)
Ejemplo n.º 2
0
    def __init__(self, **options):
        level = get_choice_opt(options, 'unicodelevel',
                               list(self.tokens.keys()), 'basic')
        if level not in self._all_tokens:
            # compile the regexes now
            self._tokens = self.__class__.process_tokendef(level)
        else:
            self._tokens = self._all_tokens[level]

        RegexLexer.__init__(self, **options)
Ejemplo n.º 3
0
 def __init__(self, **options):
     from pygments3.lexers._clbuiltins import BUILTIN_FUNCTIONS, \
         SPECIAL_FORMS, MACROS, LAMBDA_LIST_KEYWORDS, DECLARATIONS, \
         BUILTIN_TYPES, BUILTIN_CLASSES
     self.builtin_function = BUILTIN_FUNCTIONS
     self.special_forms = SPECIAL_FORMS
     self.macros = MACROS
     self.lambda_list_keywords = LAMBDA_LIST_KEYWORDS
     self.declarations = DECLARATIONS
     self.builtin_types = BUILTIN_TYPES
     self.builtin_classes = BUILTIN_CLASSES
     RegexLexer.__init__(self, **options)
Ejemplo n.º 4
0
 def get_tokens_unprocessed(self, text):
     stack = ['root']
     for index, token, value in RegexLexer.get_tokens_unprocessed(self, text, stack):
         if token is Name.Variable:
             if value in self.builtin_function:
                 yield index, Name.Builtin, value
                 continue
             if value in self.special_forms:
                 yield index, Keyword, value
                 continue
             if value in self.macros:
                 yield index, Name.Builtin, value
                 continue
             if value in self.lambda_list_keywords:
                 yield index, Keyword, value
                 continue
             if value in self.declarations:
                 yield index, Keyword, value
                 continue
             if value in self.builtin_types:
                 yield index, Keyword.Type, value
                 continue
             if value in self.builtin_classes:
                 yield index, Name.Class, value
                 continue
         yield index, token, value
Ejemplo n.º 5
0
Archivo: web.py Proyecto: Mekyi/crunchy
    def __init__(self, **options):
        self.funcnamehighlighting = get_bool_opt(options, "funcnamehighlighting", True)
        self.disabledmodules = get_list_opt(options, "disabledmodules", ["unknown"])
        self.startinline = get_bool_opt(options, "startinline", False)

        # private option argument for the lexer itself
        if "_startinline" in options:
            self.startinline = options.pop("_startinline")

        # collect activated functions in a set
        self._functions = set()
        if self.funcnamehighlighting:
            from pygments3.lexers._phpbuiltins import MODULES

            for key, value in MODULES.items():
                if key not in self.disabledmodules:
                    self._functions.update(value)
        RegexLexer.__init__(self, **options)
Ejemplo n.º 6
0
Archivo: web.py Proyecto: Mekyi/crunchy
 def get_tokens_unprocessed(self, text):
     stack = ["root"]
     if self.startinline:
         stack.append("php")
     for index, token, value in RegexLexer.get_tokens_unprocessed(self, text, stack):
         if token is Name.Other:
             if value in self._functions:
                 yield index, Name.Builtin, value
                 continue
         yield index, token, value
Ejemplo n.º 7
0
    def __init__(self, **options):
        self.funcnamehighlighting = get_bool_opt(options,
                                                 'funcnamehighlighting', True)
        self.disabledmodules = get_list_opt(options, 'disabledmodules',
                                            ['unknown'])
        self.startinline = get_bool_opt(options, 'startinline', False)

        # private option argument for the lexer itself
        if '_startinline' in options:
            self.startinline = options.pop('_startinline')

        # collect activated functions in a set
        self._functions = set()
        if self.funcnamehighlighting:
            from pygments3.lexers._phpbuiltins import MODULES
            for key, value in MODULES.items():
                if key not in self.disabledmodules:
                    self._functions.update(value)
        RegexLexer.__init__(self, **options)
Ejemplo n.º 8
0
 def get_tokens_unprocessed(self, text):
     stack = ['root']
     if self.startinline:
         stack.append('php')
     for index, token, value in \
         RegexLexer.get_tokens_unprocessed(self, text, stack):
         if token is Name.Other:
             if value in self._functions:
                 yield index, Name.Builtin, value
                 continue
         yield index, token, value