From b5ad1d30df993d68cc64c140bf1005b5490f2605 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sat, 21 May 2022 14:01:09 +0900 Subject: Stop supporting SLR(1) and always use LALR(1) --- cmd/vartan/compile.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'cmd/vartan/compile.go') diff --git a/cmd/vartan/compile.go b/cmd/vartan/compile.go index e2b5f56..7e594a8 100644 --- a/cmd/vartan/compile.go +++ b/cmd/vartan/compile.go @@ -16,7 +16,6 @@ import ( var compileFlags = struct { output *string - class *string }{} func init() { @@ -28,7 +27,6 @@ func init() { RunE: runCompile, } compileFlags.output = cmd.Flags().StringP("output", "o", "", "output file path (default stdout)") - compileFlags.class = cmd.Flags().StringP("class", "", "lalr", "LALR or SLR") rootCmd.AddCommand(cmd) } @@ -92,19 +90,7 @@ func runCompile(cmd *cobra.Command, args []string) (retErr error) { reportFileName = fmt.Sprintf("%v-report.json", strings.TrimSuffix(grmFileName, ".vartan")) } - opts := []grammar.CompileOption{ - grammar.EnableReporting(reportFileName), - } - switch strings.ToLower(*compileFlags.class) { - case "slr": - opts = append(opts, grammar.SpecifyClass(grammar.ClassSLR)) - case "lalr": - opts = append(opts, grammar.SpecifyClass(grammar.ClassLALR)) - default: - return fmt.Errorf("invalid class: %v", *compileFlags.class) - } - - cgram, err := grammar.Compile(gram, opts...) + cgram, err := grammar.Compile(gram, grammar.EnableReporting(reportFileName)) if err != nil { return err } -- cgit v1.2.3