added recognition of # at start of line as comment desginator
This commit is contained in:
parent
98602abb9e
commit
49626f9925
@ -46,7 +46,13 @@ std::string interpreter::eval(std::istream& in, bool& done) {
|
|||||||
while (_pc < _prog.size() && !done) {
|
while (_pc < _prog.size() && !done) {
|
||||||
// fetch next instruction
|
// fetch next instruction
|
||||||
std::string code {_prog[_pc]};
|
std::string code {_prog[_pc]};
|
||||||
|
|
||||||
|
// check comment
|
||||||
|
if (code[0] == '#') {
|
||||||
|
_pc++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// check literal int
|
// check literal int
|
||||||
if (std::isdigit(code[0])) {
|
if (std::isdigit(code[0])) {
|
||||||
_stack.push_back(code);
|
_stack.push_back(code);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user