diff --git a/src/Parlot/Fluent/SequenceSkipAnd.cs b/src/Parlot/Fluent/SequenceSkipAnd.cs index d367808..68ea95f 100644 --- a/src/Parlot/Fluent/SequenceSkipAnd.cs +++ b/src/Parlot/Fluent/SequenceSkipAnd.cs @@ -56,7 +56,7 @@ public CompilationResult Compile(CompilationContext context) var result = new CompilationResult(); var success = context.DeclareSuccessVariable(result, false); - var value = context.DeclareValueVariable(result, Expression.Default(typeof(T1))); + var value = context.DeclareValueVariable(result, Expression.Default(typeof(T2))); // T value; // diff --git a/test/Parlot.Tests/CompileTests.cs b/test/Parlot.Tests/CompileTests.cs index 932cd15..194ba7d 100644 --- a/test/Parlot.Tests/CompileTests.cs +++ b/test/Parlot.Tests/CompileTests.cs @@ -305,29 +305,19 @@ public void ShouldCompileOneOfABT() [Fact] public void ShouldCompileAndSkip() { - var code = - OneOf( - Terms.Text("hello").AndSkip(Terms.Text("world")), - Terms.Text("hello").AndSkip(Terms.Text("universe")) - ).Compile(); + var code = Terms.Text("hello").AndSkip(Terms.Integer()).Compile(); Assert.False(code.TryParse("hello country", out var result)); - Assert.True(code.TryParse("hello universe", out result) && result == "hello"); - Assert.True(code.TryParse("hello world", out result) && result == "hello"); + Assert.True(code.TryParse("hello 1", out result) && result == "hello"); } [Fact] public void ShouldCompileSkipAnd() { - var code = - OneOf( - Terms.Text("hello").SkipAnd(Terms.Text("world")), - Terms.Text("hello").SkipAnd(Terms.Text("universe")) - ).Compile(); + var code = Terms.Text("hello").SkipAnd(Terms.Integer()).Compile(); Assert.False(code.TryParse("hello country", out var result)); - Assert.True(code.TryParse("hello universe", out result) && result == "universe"); - Assert.True(code.TryParse("hello world", out result) && result == "world"); + Assert.True(code.TryParse("hello 1", out result) && result == 1); } [Fact]