aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-08-03 21:00:28 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-08-03 21:04:06 +0900
commitbb878f980b26f4a90a0ba7ec18e6a044a04e7d14 (patch)
tree856715a8d9cea75e6c60442ae6bc7242260e7990
parentAdd CHANGELOG (diff)
downloadurubu-bb878f980b26f4a90a0ba7ec18e6a044a04e7d14.tar.gz
urubu-bb878f980b26f4a90a0ba7ec18e6a044a04e7d14.tar.xz
Fix the name of the EOF symbol in the description file
-rw-r--r--grammar/slr.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/grammar/slr.go b/grammar/slr.go
index 2f4c786..1bca78f 100644
--- a/grammar/slr.go
+++ b/grammar/slr.go
@@ -412,6 +412,13 @@ func (b *slrTableBuilder) productionToString(prod *production, dot int) string {
}
func (b *slrTableBuilder) symbolToText(sym symbol) string {
+ if sym.isNil() {
+ return "<NULL>"
+ }
+ if sym.isEOF() {
+ return "<EOF>"
+ }
+
text, ok := b.symTab.toText(sym)
if !ok {
return fmt.Sprintf("<symbol not found: %v>", sym)