func (s *scanner) scanIdent() (tok token, lit string) {
	// Create a buffer and read the current character into it.
	var buf bytes.Buffer
	buf.WriteRune(s.read())

	// Read every subsequent ident character into the buffer.
	// Non-ident characters and EOF will cause the loop to exit.
	for {
		if ch := s.read(); ch == eof {
			break
		} else if !isLetter(ch) && !isDigit(ch) && ch != '_' {
			s.unread()
			break
		} else {
			_, _ = buf.WriteRune(ch)
		}
	}

	// Otherwise return as a regular identifier.
	v := buf.String()
	switch v {
	case "in", "match":
		return tokOperator, v
	}
	return tokIdentifier, v
}
// scanIdent consumes the current rune and all contiguous ident runes.
scanIdent consumes the current rune and all contiguous ident runes.
// scanIdent consumes the current rune and all contiguous ident runes .
func (s *scanner) scanIdent() (tok token, lit string) {
	var buf bytes.Buffer
	buf.WriteRune(s.read())
	for {
		if ch := s.read(); ch == eof {
			break
		} else if !isLetter(ch) && !isDigit(ch) && ch != '_' {
			s.unread()
			break
		} else {
			_, _ = buf.WriteRune(ch)
		}
	}
	v := buf.String()
	switch v {
	case "in", "match":
		return tokOperator, v
	}
	return tokIdentifier, v
}
func ( s * scanner ) scanIdent ( ) ( tok token , lit string ) { var buf bytes . Buffer buf . WriteRune ( s . read ( ) ) for { if ch := s . read ( ) ; ch == eof { break } else if ! isLetter ( ch ) && ! isDigit ( ch ) && ch != '_' { s . unread ( ) break } else { _ , _ = buf . WriteRune ( ch ) } } v := buf . String ( ) switch v { case " " , " " : return tokOperator , v } return tokIdentifier , v }
scanIdent consumes the current rune and all contiguous ident runes.
scanIdent consumes the current rune and all contiguous ident runes .
// Create a buffer and read the current character into it. // Read every subsequent ident character into the buffer. // Non-ident characters and EOF will cause the loop to exit. // Otherwise return as a regular identifier.