xo-interpreter2 stack: + literal array parsing

This commit is contained in:
Roland Conybeare 2026-03-03 12:12:09 +11:00
commit c05b301742
2 changed files with 19 additions and 2 deletions

View file

@ -68,7 +68,8 @@ namespace xo {
}
bool
DArray::push_back(obj<AGCObject> elt) noexcept {
DArray::push_back(obj<AGCObject> elt) noexcept
{
if (size_ >= capacity_) {
return false;
} else {
@ -85,7 +86,8 @@ namespace xo {
}
bool
DArray::resize(size_type new_z) noexcept {
DArray::resize(size_type new_z) noexcept
{
if (new_z >= capacity_) {
return false;
} else if (new_z > size_) {
@ -97,6 +99,14 @@ namespace xo {
return true;
}
void
DArray::shrink_to_fit() noexcept
{
if (capacity_ > size_) {
this->capacity_ = size_;
}
}
// printing support
bool