def assign_fields(self): sel = self.token[0] self.sel = list(map(lambda x: x.strip(), sel.split(','))) self.end = pp.getTokensEndLoc() self.subrules = [] for e in self.token[1]: if hasattr(e, 'sel'): # this is the subrule # self.sel += e.sel # collect selectors from inner blocks self.subrules.append(e) e.parent = self else: self.has_declarations = True del self.token
def keep_pos(source, location, tokens): """Wrap the tokens with a class that also keeps track of the match's location.""" return (WrappedResult(tokens, location, getTokensEndLoc()),)
def keep_pos(source, location, tokens): """Wrap the tokens with a class that also keeps track of the match's location.""" return (WrappedResult(tokens, location, getTokensEndLoc()), )
def combine(name, start, tokens): end = pp.getTokensEndLoc() return {name[start:end]: toolz.merge_with(sum, *tokens)}