nitra
nitra copied to clipboard
Assertion exception when generating AST
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