use new exit lable
This commit is contained in:
@@ -38,8 +38,14 @@ namespace Nitload
|
||||
SequenceEmitter<string> body = new();
|
||||
List<SequenceEmitter<string>> functions = [];
|
||||
SourceGenContext context = new();
|
||||
ExitLabel exit = context.RequestExitLabel(ExitMode.Goto);
|
||||
GenerateMethodSource(analysis.Ast.Root, body, functions, context, exit);
|
||||
ExitLabel local_fail = context.RequestExitLabel(ExitKind.MatchFailed);
|
||||
ExitLabel backtrack = local_fail;
|
||||
ExitLabel end = context.RequestExitLabel(ExitKind.MatchEnd);
|
||||
GenerateMethodSource(analysis.Ast.Root, body, functions, context, local_fail, ref backtrack);
|
||||
_ = body.AppendLine($"goto {end.GetLabelName()};")
|
||||
.AppendLine($"{local_fail.GetLabelName()}: {{}}")
|
||||
.AppendLine("// TODO(NGRA): Produce the root failure result here.")
|
||||
.AppendLine($"{end.GetLabelName()}: {{}}");
|
||||
|
||||
foreach (string line in body.ToList()) {
|
||||
Console.WriteLine(line);
|
||||
|
||||
Reference in New Issue
Block a user