From 210a76a5aa0e62f8ab48a94e3c5b5212b5da08fa Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sat, 17 Apr 2021 16:14:58 +0900 Subject: 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 --- cli/cmd/root.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'cli/cmd/root.go') 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 } -- cgit v1.2.3