Permalink
Browse files

AdventureSample - support negation

  • Loading branch information...
bobbymcr committed May 1, 2018
1 parent cc36819 commit a0b617dc0d78babb6f284e188f7f65a75c3a91ab
@@ -524,6 +524,7 @@ private SyntaxNode Unary(string name, SyntaxNode x)
switch (name)
{
case "Len": return this.Len(x);
case "Neg": return this.Neg(x);
default: throw new NotSupportedException("Operator:" + name);
}
}
@@ -571,6 +572,11 @@ private SyntaxNode Len(SyntaxNode x)
return this.generator.MemberAccessExpression(x, "Length");
}
private SyntaxNode Neg(SyntaxNode x)
{
return this.generator.NegateExpression(x);
}
private SyntaxNode Left(SyntaxNode x, SyntaxNode n)
{
string name = "LEFT_s";
@@ -39,6 +39,7 @@ 140 CLS
250 NEXT I
260 A$=MID$(A$,A,1)
270 A$=LEFT$(A$,A)
280 A=-1
1000 GOTO 20
2000 CLS
2001 DATA 1
@@ -262,6 +263,7 @@ private int Main()
A_s = (MID_s(A_s, (int)(A_n), (int)(1)));
A_s = (LEFT_s(A_s, (int)(A_n)));
A_n = (-(1));
goto L20;
return 2;
}

0 comments on commit a0b617d

Please sign in to comment.