diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2022-05-21 14:01:09 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2022-05-22 15:44:47 +0900 |
commit | b5ad1d30df993d68cc64c140bf1005b5490f2605 (patch) | |
tree | 919e3102866b4dcf4ed58c0a48227ee0c81f1f5d /cmd | |
parent | Prohibit applying #left, #right, #assign, and #prec to an error symbol (diff) | |
download | cotia-b5ad1d30df993d68cc64c140bf1005b5490f2605.tar.gz cotia-b5ad1d30df993d68cc64c140bf1005b5490f2605.tar.xz |
Stop supporting SLR(1) and always use LALR(1)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/vartan/compile.go | 16 | ||||
-rw-r--r-- | cmd/vartan/show.go | 6 |
2 files changed, 2 insertions, 20 deletions
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 . }} |