|
|
@ -3,6 +3,7 @@ package wikilink
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"log"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"unicode"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func lexFragment(l *Lexer) stateFn {
|
|
|
|
func lexFragment(l *Lexer) stateFn {
|
|
|
@ -27,14 +28,28 @@ func lexFragment(l *Lexer) stateFn {
|
|
|
|
func lexAlias(l *Lexer) stateFn {
|
|
|
|
func lexAlias(l *Lexer) stateFn {
|
|
|
|
// l.accept
|
|
|
|
// l.accept
|
|
|
|
log.Println("entering lexAlias")
|
|
|
|
log.Println("entering lexAlias")
|
|
|
|
|
|
|
|
for {
|
|
|
|
if strings.HasPrefix(l.input[l.pos:], CloseLink) {
|
|
|
|
if strings.HasPrefix(l.input[l.pos:], CloseLink) {
|
|
|
|
return lexCloseLink
|
|
|
|
return lexCloseLink
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
r := l.next()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
l.emit(ItemAlias)
|
|
|
|
l.emit(ItemAlias)
|
|
|
|
|
|
|
|
|
|
|
|
return lexInsideLink
|
|
|
|
return lexInsideLink
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func lexIdent(l *Lexer) stateFn {
|
|
|
|
|
|
|
|
for {
|
|
|
|
|
|
|
|
if strings.HasPrefix(l.input[l.pos:], CloseLink) {
|
|
|
|
|
|
|
|
return lexCloseLink
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// r := l.next()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return lexInsideLink
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func lexInsideLink(l *Lexer) stateFn {
|
|
|
|
func lexInsideLink(l *Lexer) stateFn {
|
|
|
|
log.Println("entering lexInsideLink")
|
|
|
|
log.Println("entering lexInsideLink")
|
|
|
|
|
|
|
|
|
|
|
|