Permalink
Browse files

ExpressionSample - support PRINT (empty)

  • Loading branch information...
bobbymcr committed Apr 15, 2018
1 parent 026593b commit 7067cb3c3402f9d3b5d51eb786e02b736f385255
@@ -0,0 +1,18 @@
// <copyright file="Print.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>
namespace GWParse.Test.Statements
{
using Xunit;
public sealed class Print
{
[InlineData("PRINT", "Print()")]
[Theory]
public void Empty(string input, string output)
{
Test.Good(input, output);
}
}
}
@@ -0,0 +1,11 @@
// <copyright file="PrintStatement.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>
namespace GWParse.Statements
{
internal sealed class PrintStatement : BasicStatement
{
public override string ToString() => "Print()";
}
}
@@ -37,14 +37,18 @@ internal static class Stmt
from list in Arrays
select new DimensionStatement(list);
private static readonly Parser<BasicStatement> Print =
from k in Parse.IgnoreCase("PRINT")
select new PrintStatement();
private static readonly Parser<BasicStatement> Assign =
from left in Expr.AnyVar
from o in Parse.Char('=').Token()
from right in Expr.Any
select new AssignmentStatement(left, right);
private static readonly Parser<BasicStatement> Any =
Rem.Or(Cls).Or(Dim).Or(Assign);
Rem.Or(Cls).Or(Dim).Or(Print).Or(Assign);
public static BasicStatement FromString(string input)
{

0 comments on commit 7067cb3

Please sign in to comment.