def compiled_scan(self,restrict): token = StarScan.scan() print "Calling compiled scan, got %s" % `token` if token[2] not in restrict: msg = "Bad Token" if restrict: msg = "Trying to find one of "+join(restrict,", ") raise SyntaxError(self.pos,msg) self.tokens.append(token) self.restrictions.append(restrict) return
def compiled_scan(self,restrict): """Should scan another token and add it to the list, self.tokens, and add the restriction to self.restrictions""" token = StarScan.scan() if token[2] not in restrict: msg = "Bad Token" if restrict: msg = "Trying to find one of "+join(restrict,", ") raise SyntaxError(self.pos, msg) self.tokens.append(token) self.restrictions.append(restrict) return