diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-04-17 16:14:58 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-04-17 18:18:05 +0900 |
commit | 210a76a5aa0e62f8ab48a94e3c5b5212b5da08fa (patch) | |
tree | 9960191561bc70fa04bca108a3b94a4fe09621c4 /cli/cmd/root.go | |
parent | Increase the maximum number of symbol positions per pattern (diff) | |
download | tre-210a76a5aa0e62f8ab48a94e3c5b5212b5da08fa.tar.gz tre-210a76a5aa0e62f8ab48a94e3c5b5212b5da08fa.tar.xz |
Change the lexical specs of regexp and define concrete syntax error values
* Make the lexer treat ']' as an ordinary character in default mode
* Define values of the syntax error type that represents error information concretely
Diffstat (limited to 'cli/cmd/root.go')
-rw-r--r-- | cli/cmd/root.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cli/cmd/root.go b/cli/cmd/root.go index 03579d8..3c7109b 100644 --- a/cli/cmd/root.go +++ b/cli/cmd/root.go @@ -1,6 +1,11 @@ package cmd -import "github.com/spf13/cobra" +import ( + "fmt" + "os" + + "github.com/spf13/cobra" +) var rootCmd = &cobra.Command{ Use: "maleeni", @@ -9,9 +14,15 @@ var rootCmd = &cobra.Command{ * Generates a portable DFA from a lexical specification. * Tokenizes a text stream according to the lexical specification. This feature is primarily aimed at debugging the lexical specification.`, - SilenceUsage: true, + SilenceErrors: true, + SilenceUsage: true, } func Execute() error { - return rootCmd.Execute() + err := rootCmd.Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + return err + } + return nil } |