mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2024-12-26 03:29:22 +00:00
Fix initialization
This commit is contained in:
parent
b75c1f027f
commit
b0b2299cfb
11
basic.js
11
basic.js
@ -601,11 +601,9 @@ this.basic = (function() {
|
||||
}
|
||||
},
|
||||
|
||||
'for': function FOR(varname, from, to, step) {
|
||||
state.variables[varname] = from;
|
||||
'for': function FOR(varname, to, step) {
|
||||
state.stack.push({
|
||||
index: varname,
|
||||
from: from,
|
||||
to: to,
|
||||
step: step,
|
||||
for_next: state.stmt_index,
|
||||
@ -1827,10 +1825,9 @@ this.basic = (function() {
|
||||
throw parse_error("Syntax error: Expected floating point variable");
|
||||
}
|
||||
identifiers.variables[name] = true;
|
||||
|
||||
return slib('for',
|
||||
quote(name),
|
||||
match("operator", "=") && parseNumericExpression(),
|
||||
return 'state.variables[' + quote(name) + '] = ' +
|
||||
(match("operator", "=") && parseNumericExpression()) + ';' +
|
||||
slib('for', quote(name),
|
||||
match("reserved", kws.TO) && parseNumericExpression(),
|
||||
test('reserved', kws.STEP, true) ? parseNumericExpression() : '1');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user