diff options
| author | Ryo Nihei <nihei.dev@gmail.com> | 2022-04-22 00:06:40 +0900 |
|---|---|---|
| committer | Ryo Nihei <nihei.dev@gmail.com> | 2022-04-22 00:09:08 +0900 |
| commit | 0f5c30198eae1777262aaa6c65d8b59875049beb (patch) | |
| tree | eea168df1a4aa584e2df3b607d405a2b7fcf8d79 /grammar/grammar.go | |
| parent | vartan-show command prints only adopted actions when conflicts occur (diff) | |
| download | urubu-0f5c30198eae1777262aaa6c65d8b59875049beb.tar.gz urubu-0f5c30198eae1777262aaa6c65d8b59875049beb.tar.xz | |
Suppress a report about conflicts resolved explicitly
Diffstat (limited to 'grammar/grammar.go')
| -rw-r--r-- | grammar/grammar.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/grammar/grammar.go b/grammar/grammar.go index 4e5b3b2..c996e36 100644 --- a/grammar/grammar.go +++ b/grammar/grammar.go @@ -1287,8 +1287,21 @@ func Compile(gram *Grammar, opts ...CompileOption) (*spec.CompiledGrammar, error } } - if len(b.conflicts) > 0 { - fmt.Fprintf(os.Stderr, "%v conflicts\n", len(b.conflicts)) + var implicitlyResolvedCount int + for _, s := range desc.States { + for _, c := range s.SRConflict { + if c.ResolvedBy == ResolvedByShift.Int() { + implicitlyResolvedCount++ + } + } + for _, c := range s.RRConflict { + if c.ResolvedBy == ResolvedByProdOrder.Int() { + implicitlyResolvedCount++ + } + } + } + if implicitlyResolvedCount > 0 { + fmt.Fprintf(os.Stderr, "%v conflicts\n", implicitlyResolvedCount) } } |
