This ash script:
is obviously erroneous: there is a "[" instead of a "(".
ASH's error checking could be a bit more robust, though:
In fact, this script:
which has what looks like the same error is even less robust:
with this stack trace:
Code:
record rec
{
int x;
};
rec r = new rec[1);
is obviously erroneous: there is a "[" instead of a "(".
ASH's error checking could be a bit more robust, though:
Code:
> badrec.ash
Variable 'null' cannot be indexed (badrec.ash, line 6, char 9 to char 17)
In fact, this script:
Code:
record rec
{
int x;
int y;
};
rec[int] map1;
rec[int] map2;
foreach i, r in map1 {
map2[i] = new rec[r.y, r.x);
}
which has what looks like the same error is even less robust:
Code:
> badrec2
Unexpected error, debug log printed.
with this stack trace:
Code:
Unexpected error, debug log printed.
class net.sourceforge.kolmafia.textui.ScriptException: Internal error: key is not a Value
net.sourceforge.kolmafia.textui.ScriptException: Internal error: key is not a Value
at net.sourceforge.kolmafia.textui.parsetree.RecordType.getDataType(RecordType.java:80)
at net.sourceforge.kolmafia.textui.parsetree.CompositeReference.getType(CompositeReference.java:43)
at net.sourceforge.kolmafia.textui.Parser.autoCoerceValue(Parser.java:1042)
at net.sourceforge.kolmafia.textui.Parser.parseAssignment(Parser.java:3364)
at net.sourceforge.kolmafia.textui.Parser.parseEvaluable(Parser.java:3779)
at net.sourceforge.kolmafia.textui.Parser.parseCommand(Parser.java:1244)
at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:558)
at net.sourceforge.kolmafia.textui.Parser.parseLoopScope(Parser.java:2935)
at net.sourceforge.kolmafia.textui.Parser.parseLoopScope(Parser.java:2920)
at net.sourceforge.kolmafia.textui.Parser.parseForeach(Parser.java:2575)
at net.sourceforge.kolmafia.textui.Parser.parseCommand(Parser.java:1210)
at net.sourceforge.kolmafia.textui.Parser.parseScope(Parser.java:558)
at net.sourceforge.kolmafia.textui.Parser.parseFile(Parser.java:480)
...