Пример #1
0
    def get_delta(self, ctx):
        for name, (idx, type_name
                   ) in self.bare.get_var_offsets_and_type_names(ctx).items():
            ctx.named_locations[name] = idx
            ctx.name_type_names[name] = type_name

        return StateDelta()
Пример #2
0
    def get_delta(self, ctx):
        total_delta = StateDelta()
        for x in self.tokens:
            delta = x.get_delta(ctx)
            ctx = ctx.with_delta_applied(delta)
            total_delta = total_delta @ delta

        return total_delta
Пример #3
0
    def get_delta(self, ctx):
        at, type_ = self.path.get_location_and_type(ctx)

        if ctx.t_get_size(type_) != 1:
            if not ctx.quiet:
                err = GotoWide(self.span, type_, ctx)
                err.show()
                ctx.n_errors += 1

        delta = at - ctx.ptr
        return StateDelta(delta)
Пример #4
0
    def get_delta(self, ctx):
        for unvar in self.unvars:
            if unvar in ctx.named_locations and unvar in ctx.name_type_names:
                del ctx.named_locations[unvar]
                del ctx.name_type_names[unvar]
            else:
                if not ctx.quiet:
                    er = MemNotFoundError(
                        self.span,
                        unvar,
                        ctx,
                    )
                    er.show()
                    ctx.n_errors += 1

        return StateDelta()
Пример #5
0
    def get_delta(self, ctx):
        if self.token == ">":
            return StateDelta(1)

        elif self.token == "<":
            return StateDelta(-1)

        if self.token == "+":
            return StateDelta.do_action(Delta(self.span, 1))

        if self.token == "-":
            return StateDelta.do_action(Delta(self.span, -1))

        if self.token == ",":
            return StateDelta.do_action(Unknown(self.span))

        return StateDelta(0)
Пример #6
0
 def get_delta(self, ctx):
     return StateDelta()
Пример #7
0
 def get_delta(self, ctx):
     total = StateDelta()
     for i in range(self.count):
         total @= self.inner.get_delta(ctx)
         ctx.apply_delta(self.inner.get_delta(ctx))
     return total
Пример #8
0
    def get_delta(self, ctx):
        res = self.get_inner_delta_rep(ctx)
        reset_current = StateDelta.do_action(SetTo(self.span, 0))

        return res @ reset_current