From ab1ad9eecffed26c4aa3d6fd346d7b06e9eadbb1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 2 Dec 2024 15:41:30 -0300 Subject: Build and test existing code as is --- cmd/vartan/root.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'cmd/vartan/root.go') diff --git a/cmd/vartan/root.go b/cmd/vartan/root.go index 8d2219d..32eb3c3 100644 --- a/cmd/vartan/root.go +++ b/cmd/vartan/root.go @@ -1,9 +1,10 @@ package main import ( - "github.com/spf13/cobra" + "os" ) +/* var rootCmd = &cobra.Command{ Use: "vartan", Short: "Generate a portable LALR(1) parsing table from grammar you defined", @@ -13,7 +14,23 @@ var rootCmd = &cobra.Command{ SilenceErrors: true, SilenceUsage: true, } +*/ func Execute() error { - return rootCmd.Execute() + // return rootCmd.Execute() + + cmd := os.Args[1] + args := os.Args[2:] + + if cmd == "compile" { + return runCompile(args) + } else if cmd == "parse" { + return runParse(args) + } else if cmd == "show" { + return runShow(args) + } else if cmd == "test" { + return runTest(args) + } + + return nil // FIXME } -- cgit v1.2.3