Explorar o código

New: Store tree representation for complete URNs

Leonardo Di Donato %!s(int64=8) %!d(string=hai) anos
pai
achega
db921c712e
Modificáronse 1 ficheiros con 10 adicións e 5 borrados
  1. 10 5
      listener.go

+ 10 - 5
listener.go

@@ -7,22 +7,27 @@ import (
 // Listener is ...
 type Listener struct {
 	*grammar.BaseUrnListener
-	target *Urn
+	target *URN
 }
 
 // NewListener is ...
-func NewListener(target *Urn) *Listener {
+func NewListener(u *URN) *Listener {
 	return &Listener{
-		target: target,
+		target: u,
 	}
 }
 
-// ExitID is called when production id is exited
+// ExitID is called when rule iD is exited
 func (l *Listener) ExitID(ctx *grammar.IDContext) {
 	l.target.ID = ctx.GetText()
 }
 
-// ExitSS is called when production ss is exited
+// ExitSS is called when rule sS is exited
 func (l *Listener) ExitSS(ctx *grammar.SSContext) {
 	l.target.SS = ctx.GetText()
 }
+
+// ExitUrn is called when rule urn is exited
+func (l *Listener) ExitUrn(ctx *grammar.UrnContext) {
+	l.target.tree = ctx.ToStringTree(nil, ctx.GetParser())
+}