character A_upper_calltype A_upper_input(bool writeback, character c, buffer& ib) { if (writeback) { ib.push_front(c); return 0; } else { if (ib.size() > 0) return ib.pop_front(); return (character)fgetc(stdin); } }
// ni stands for "next int". int ni(buffer& buf) { int i = atoi(buf.front().c_str()); if (i == 0) for(char ch : buf.front()) if (!isdigit(ch)) error("Expected number, found \"" + buf.front() + "\"."); buf.pop_front(); return i; }
// ns stands for "next std::string". std::string ns(buffer& buf) { std::string s = buf.front(); buf.pop_front(); return s; }
// nch stands of "next char". char nch(buffer& buf) { char ch = (buf.front()[0]); buf.pop_front(); return ch; }