debugging

dev
Nick Dumas 2 years ago
parent c109f142b6
commit 4735f0b36d

@ -1,6 +1,7 @@
package wikilink
import (
"log"
"strings"
)
@ -25,6 +26,7 @@ func isBlockRef(s string) bool {
}
func lexIdent(l *Lexer) stateFn {
log.Println("lexIdent")
for {
r := l.next()
s := l.input[l.pos:]
@ -47,11 +49,11 @@ func lexIdent(l *Lexer) stateFn {
}
}
panic("we shouldn't be here")
return nil // this shouldn't ever be reached
return l.errorf("malformed link")
}
func lexHeading(l *Lexer) stateFn {
log.Println("lexHeading")
l.pos += len(Heading)
l.emit(ItemHeading)
@ -59,6 +61,7 @@ func lexHeading(l *Lexer) stateFn {
}
func lexBlockRef(l *Lexer) stateFn {
log.Println("lexBlockRef")
l.pos += len(BlockRef)
l.emit(ItemBlockRef)
@ -66,6 +69,7 @@ func lexBlockRef(l *Lexer) stateFn {
}
func lexAlias(l *Lexer) stateFn {
log.Println("lexAlias")
l.pos += len(Alias)
l.emit(ItemAlias)
@ -73,6 +77,7 @@ func lexAlias(l *Lexer) stateFn {
}
func lexText(l *Lexer) stateFn {
log.Println("lexText")
for {
if isOpenLink(l.input[l.pos:]) {
return lexOpenLink
@ -87,6 +92,7 @@ func lexText(l *Lexer) stateFn {
}
func lexOpenLink(l *Lexer) stateFn {
log.Println("lexOpenLink")
l.pos += len(OpenLink)
l.emit(ItemOpenLink)
@ -94,6 +100,7 @@ func lexOpenLink(l *Lexer) stateFn {
}
func lexCloseLink(l *Lexer) stateFn {
log.Println("lexCloseLink")
l.pos += len(CloseLink)
l.emit(ItemCloseLink)

Loading…
Cancel
Save