This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
666 B

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