feat, wip: refactoring and simplification of how casts are made.

This commit is contained in:
Romain Dorgueil
2018-07-29 11:59:47 +01:00
parent f5ebe1b1e7
commit 980a76399b
17 changed files with 251 additions and 65 deletions

View File

@ -20,30 +20,13 @@
"""
class Token:
def __init__(self, name):
self.__name__ = name
def __repr__(self):
return '<{}>'.format(self.__name__)
class Flag(Token):
must_be_first = False
must_be_last = False
allows_data = True
from bonobo.structs.tokens import Token
from bonobo.util.envelopes import UnchangedEnvelope
BEGIN = Token('Begin')
END = Token('End')
INHERIT = Flag('Inherit')
NOT_MODIFIED = Flag('NotModified')
NOT_MODIFIED.must_be_first = True
NOT_MODIFIED.must_be_last = True
NOT_MODIFIED.allows_data = False
NOT_MODIFIED = UnchangedEnvelope()
EMPTY = tuple()