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 +--------------- cmd/vartan/show.go | 6 +----- 2 files changed, 2 insertions(+), 20 deletions(-) (limited to 'cmd/vartan') 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 } diff --git a/cmd/vartan/show.go b/cmd/vartan/show.go index 7b112d9..7c2482c 100644 --- a/cmd/vartan/show.go +++ b/cmd/vartan/show.go @@ -60,11 +60,7 @@ func readReport(path string) (*spec.Report, error) { return report, nil } -const reportTemplate = `# Class - -{{ .Class }} - -# Conflicts +const reportTemplate = `# Conflicts {{ printConflictSummary . }} -- cgit v1.2.3