aboutsummaryrefslogtreecommitdiff
path: root/grammar/slr.go
diff options
context:
space:
mode:
Diffstat (limited to 'grammar/slr.go')
-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)