Skip to content

Commit

Permalink
Added ForEachRule.
Browse files Browse the repository at this point in the history
  • Loading branch information
skiwi2 committed Feb 9, 2019
1 parent 10db5d4 commit 5ce9182
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions MagicParser/MagicParser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rules\CardList.cs" />
<Compile Include="Rules\ForEachRule.cs" />
<Compile Include="Rules\ListRule.cs" />
<Compile Include="Rules\RegexRule.cs" />
<Compile Include="Rules\EntersRule.cs" />
Expand Down
3 changes: 2 additions & 1 deletion MagicParser/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ static void Main(string[] args)
new WhenRule(),
new EntersRule(),
new CardList(),
new ZoneRule()
new ZoneRule(),
new ForEachRule()
});

var text = @"When Archway Angel enters the battlefield, you gain 2 life for each Gate you control.";
Expand Down
16 changes: 16 additions & 0 deletions MagicParser/Rules/ForEachRule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MagicParser.Rules
{
public class ForEachRule : RegexRule
{
public ForEachRule() : base(@"^(.+) for each (.+)$", 2)
{

}
}
}

0 comments on commit 5ce9182

Please sign in to comment.