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