From d5a48dd362189825517cf6d183deec092d74720e Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Sun, 2 Jul 2023 09:59:45 -0400 Subject: [PATCH] lexIdent is the problem for sure --- states.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/states.go b/states.go index d52ad4e..37bf875 100644 --- a/states.go +++ b/states.go @@ -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") }