This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

30 líneas
890 B

  1. from .utils import Serialize
  2. from .lexer import TerminalDef
  3. ###{standalone
  4. class LexerConf(Serialize):
  5. __serialize_fields__ = 'tokens', 'ignore', 'g_regex_flags', 'use_bytes'
  6. __serialize_namespace__ = TerminalDef,
  7. def __init__(self, tokens, re_module, ignore=(), postlex=None, callbacks=None, g_regex_flags=0, skip_validation=False, use_bytes=False):
  8. self.tokens = tokens # TODO should be terminals
  9. self.ignore = ignore
  10. self.postlex = postlex
  11. self.callbacks = callbacks or {}
  12. self.g_regex_flags = g_regex_flags
  13. self.re_module = re_module
  14. self.skip_validation = skip_validation
  15. self.use_bytes = use_bytes
  16. ###}
  17. class ParserConf:
  18. def __init__(self, rules, callbacks, start):
  19. assert isinstance(start, list)
  20. self.rules = rules
  21. self.callbacks = callbacks
  22. self.start = start