nitra icon indicating copy to clipboard operation
nitra copied to clipboard

Assertion exception when generating AST

Open ssrmm opened this issue 8 years ago • 0 comments

The following code produces an assertion exception upon generation of the AST:

using Nitra;

namespace Test
{
  syntax module TestSyntax
  {    
    using Nitra.Core;

    [StartRule]
    syntax Test = FooBar=("Foo" sm "Bar"?) ';';
  }

  ast TestAst
  {
    Content : string;
  }

  map syntax TestSyntax.Test -> TestAst
  {
    Content = ParsedValue(FooBar.Span, GetText(FooBar.Span));
  }
}

The exception happens at the assert in ParseResult.n#L355

In order for this error to happen, Bar must be optional and FooBar must surround both Foo and Bar

ssrmm avatar Nov 30 '16 15:11 ssrmm