|
|
|
@ -29,22 +29,16 @@ func isBlockRef(s string) bool {
|
|
|
|
|
func lexIdent(l *Lexer) stateFn {
|
|
|
|
|
for {
|
|
|
|
|
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():]
|
|
|
|
|
r := l.next()
|
|
|
|
|
L = l.L.With(
|
|
|
|
|
zap.String("rune", string(r)),
|
|
|
|
|
)
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch {
|
|
|
|
|
case isCloseLink(s):
|
|
|
|
|
L.Debug("found CloseLink")
|
|
|
|
|
l.emit(LexIdent)
|
|
|
|
|
return lexCloseLink
|
|
|
|
|
case isBlockRef(s):
|
|
|
|
|
L.Debug("found BlockRef")
|
|
|
|
|
l.emit(LexIdent)
|
|
|
|
@ -57,8 +51,12 @@ func lexIdent(l *Lexer) stateFn {
|
|
|
|
|
L.Debug("found Heading")
|
|
|
|
|
l.emit(LexIdent)
|
|
|
|
|
return lexHeading
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
r := l.next()
|
|
|
|
|
L = l.L.With(
|
|
|
|
|
zap.String("rune", string(r)),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return l.errorf("malformed link")
|
|
|
|
|
}
|
|
|
|
|