Exemplo n.º 1
0
 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
Exemplo n.º 2
0
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()),)
Exemplo n.º 3
0
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()), )
Exemplo n.º 4
0
def combine(name, start, tokens):
    end = pp.getTokensEndLoc()
    return {name[start:end]: toolz.merge_with(sum, *tokens)}