def partial_eval(self): value = self.value.partial_eval() start_index = self.lang[CaseOp([ WhenOp(self.prefix.missing(), **{"then": ZERO}), WhenOp(IsNumberOp(self.prefix), **{"then": MaxOp([ZERO, self.prefix])}), FindOp([value, self.prefix], start=self.start), ])].partial_eval() len_prefix = self.lang[CaseOp([ WhenOp(self.prefix.missing(), **{"then": ZERO}), WhenOp(IsNumberOp(self.prefix), **{"then": ZERO}), LengthOp(self.prefix), ])].partial_eval() end_index = self.lang[CaseOp([ WhenOp(start_index.missing(), **{"then": NULL}), WhenOp(self.suffix.missing(), **{"then": LengthOp(value)}), WhenOp(IsNumberOp(self.suffix), **{"then": MinOp([self.suffix, LengthOp(value)])}), FindOp([value, self.suffix], start=AddOp([start_index, len_prefix])), ])].partial_eval() start_index = AddOp([start_index, len_prefix]).partial_eval() substring = BasicSubstringOp([value, start_index, end_index]).partial_eval() between = self.lang[WhenOp(end_index.missing(), **{ "then": self.default, "else": substring })].partial_eval() return between
def partial_eval(self): value = self.lang[self.value].partial_eval() length = self.lang[self.length].partial_eval() max_length = LengthOp(value) return self.lang[WhenOp( self.missing(), **{ "else": BasicSubstringOp( [value, ZERO, MaxOp([ZERO, MinOp([length, max_length])])]) })].partial_eval()
def partial_eval(self, lang): value = (self.value).partial_eval(lang) length = (self.length).partial_eval(lang) max_length = LengthOp(value) return WhenOp( self.missing(lang), **{"else": BasicSubstringOp([ value, MaxOp([ZERO, MinOp([max_length, SubOp([max_length, length])])]), max_length, ])} ).partial_eval(lang)
def partial_eval(self): value = self.lang[self.value].partial_eval() length = self.length.partial_eval() if length is ZERO: return value max_length = LengthOp(value) part = BasicSubstringOp([ value, ZERO, MaxOp([ZERO, MinOp([max_length, SubOp([max_length, length])])]), ]) return self.lang[WhenOp(self.missing(), **{"else": part})].partial_eval()
def partial_eval(self, lang): value = (self.value).partial_eval(lang) length = self.length.partial_eval(lang) if length is ZERO: return value max_length = LengthOp(value) part = BasicSubstringOp([ value, ZERO, MaxOp([ZERO, MinOp([max_length, SubOp([max_length, length])])]), ]) return (WhenOp(self.missing(lang), **{"else": part})).partial_eval(lang)
def partial_eval(self, lang): value = (self.value).partial_eval(lang) length = self.length.partial_eval(lang) if length is ZERO: return value max_length = LengthOp(value) output = WhenOp( self.missing(lang), **{"else": BasicSubstringOp([ value, MaxOp([ZERO, MinOp([length, max_length])]), max_length, ])} ).partial_eval(lang) return output
def partial_eval(self): value = self.lang[self.value].partial_eval() length = self.length.partial_eval() if length is ZERO: return value max_length = LengthOp(value) output = self.lang[WhenOp( self.missing(), **{ "else": BasicSubstringOp([ value, MaxOp([ZERO, MinOp([length, max_length])]), max_length ]) })].partial_eval() return output