lexIdent is the problem for sure

main
Nick Dumas 1 year ago
parent 0c7b00e9b5
commit d5a48dd362

@ -29,22 +29,16 @@ func isBlockRef(s string) bool {
func lexIdent(l *Lexer) stateFn { func lexIdent(l *Lexer) stateFn {
for { for {
L := l.L.Named("lexIdent") L := l.L.Named("lexIdent")
if isCloseLink(l.input[l.GetPos():]) {
L.Debug("found CloseLink")
l.emit(LexIdent)
return lexCloseLink
}
s := l.input[l.GetPos():] s := l.input[l.GetPos():]
r := l.next()
L = l.L.With(
zap.String("rune", string(r)),
)
L.Debug("stepping through lexIdent") L.Debug("stepping through lexIdent")
if r == '\\' { // i think this will handle escape characters? if s[0] == '\\' { // i think this will handle escape characters?
break break
} }
switch { switch {
case isCloseLink(s):
L.Debug("found CloseLink")
l.emit(LexIdent)
return lexCloseLink
case isBlockRef(s): case isBlockRef(s):
L.Debug("found BlockRef") L.Debug("found BlockRef")
l.emit(LexIdent) l.emit(LexIdent)
@ -57,8 +51,12 @@ func lexIdent(l *Lexer) stateFn {
L.Debug("found Heading") L.Debug("found Heading")
l.emit(LexIdent) l.emit(LexIdent)
return lexHeading return lexHeading
} }
r := l.next()
L = l.L.With(
zap.String("rune", string(r)),
)
} }
return l.errorf("malformed link") return l.errorf("malformed link")
} }

Loading…
Cancel
Save