aboutsummaryrefslogtreecommitdiff
path: root/cmd/vartan/root.go
blob: 32eb3c3766be1c7e18a5faa19fd92c193ea43ce7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main

import (
	"os"
)

/*
var rootCmd = &cobra.Command{
	Use:   "vartan",
	Short: "Generate a portable LALR(1) parsing table from grammar you defined",
	Long: `vartan provides two features:
- Generate a portable LALR(1) parsing table from grammar you defined.
- Parse a text stream according to the grammar.`,
	SilenceErrors: true,
	SilenceUsage:  true,
}
*/

func Execute() error {
	// 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
}