feat: 语法树的访问者和类型检测访问者 (#56)

Reviewed-on: PostGuard/Canon#56
This commit is contained in:
2024-04-26 10:18:49 +08:00
parent b20c3234c5
commit 17dbcccb59
63 changed files with 2757 additions and 704 deletions

View File

@@ -5,9 +5,9 @@ namespace Canon.Generator.Extensions;
public static class RootCommandExtension
{
public static void AddGenerateCommand(this RootCommand rootCommand)
public static void AddGrammarCommand(this RootCommand rootCommand)
{
Command generateCommand = new("generate", "Generate source files.");
Command generateCommand = new("grammar", "Generate grammar parser source files.");
Argument<string> filenameArgument = new(name: "filename",
description: "determines the generated file name.",
@@ -37,4 +37,16 @@ public static class RootCommandExtension
rootCommand.AddCommand(generateCommand);
}
public static void AddSyntaxVisitorCommand(this RootCommand rootCommand)
{
Command syntaxCommand = new("syntax", "Generate syntax visitor source code.");
syntaxCommand.SetHandler(async () =>
{
await SyntaxVisitorGenerator.SyntaxVisitorGenerator.Generate();
});
rootCommand.AddCommand(syntaxCommand);
}
}