crashappsec / libcon4m

Base Compiler and Runtime Support for con4m
Apache License 2.0
0 stars 0 forks source link

builtins: add `high`, `starts_with`, `ends_with` #95

Open ee7 opened 1 month ago

ee7 commented 1 month ago

The chalk spec and config files use these, and my understanding is that we want them as language builtins.

Refs: #94


I'm happy to implement some other builtins. But I wanted to double-check first which ones would be good for right now.

I've deliberately not implemented low() in this PR because:

I heard there was a c4m_path_split to wrap, but I don't see it, so I've omitted that for now.

util/wrappers.c probably isn't the best place for high(). Please let me know if we want it somewhere else. The existing include/util/math.h or src/adts/numbers.c didn't seem quite right.

I've based this PR on top of main rather than jtv/parity-push. There's currently no merge conflict. But I'm happy to target jtv/parity-push instead, if we prefer that.