rsdn / nitra

Nitra is a language workbench

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assertion exception when generating AST

ssrmm opened this issue · comments

commented

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