~jasper/type_stack_calc

ref: 6aca66fb1a7cf1e10f7dd3263f04537c8ff37590 type_stack_calc/type_stack_calc/base/code.py -rw-r--r-- 343 bytes
6aca66fb — Jasper den Ouden Apparently `to_c` can already read ahead one, hopefully its this simple... 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
from type_stack_calc.base.with_params import WithParams

class BaseCode(list, WithParams):
    """Provides some things in common for `Code` and `Args` later."""
    def __repr__(self):
        return "".join((self.tp, ','.join(self), self.close))

    def to_c(self, tc, _gen):
        tc[0](f"/* Code({len(self)})[" + " ".join(self) + "]*/")