Пример #1
0
func textState(l *lexer.Lexer) lexer.StateFunc {
	l.NextUpTo(func(r rune) bool {
		return variable(r) || assignment(r) || comma(r) || whitespace(r)
	})
	l.Emit(TokenText)
	return initialState
}
Пример #2
0
func variableState(l *lexer.Lexer) lexer.StateFunc {
	l.Ignore()
	l.NextUpTo(nonAlphanumeric)
	l.Emit(TokenVariable)
	return initialState
}