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 }
func initialState(l *lexer.Lexer) lexer.StateFunc { r := l.IgnoreUpTo(func(r rune) bool { return variable(r) || assignment(r) || comma(r) || nonWhitespace(r) }) switch { case variable(r): return variableState case assignment(r): return assignmentState case comma(r): return commaState case nonWhitespace(r) && r != lexer.EOF: return textState } l.Emit(TokenEOF) return nil }
func commaState(l *lexer.Lexer) lexer.StateFunc { l.Ignore() l.Emit(TokenComma) return initialState }
func assignmentState(l *lexer.Lexer) lexer.StateFunc { l.Ignore() l.Emit(TokenAssignment) return initialState }
func variableState(l *lexer.Lexer) lexer.StateFunc { l.Ignore() l.NextUpTo(nonAlphanumeric) l.Emit(TokenVariable) return initialState }