// 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(); !unicode.IsLetter(ch) && !unicode.IsDigit(ch) && ch != '_' {
			s.unread()
			break
		} else {
			_, _ = buf.WriteRune(ch)
		}
	}
	if tok, ok := keywords[buf.String()]; ok {
		return tok, buf.String()
	}
	return IDENT, buf.String()
}
func ( s * Scanner ) scanIdent ( ) ( tok Token , lit string ) { var buf bytes . Buffer buf . WriteRune ( s . read ( ) ) for { if ch := s . read ( ) ; ! unicode . IsLetter ( ch ) && ! unicode . IsDigit ( ch ) && ch != '_' { s . unread ( ) break } else { _ , _ = buf . WriteRune ( ch ) } } if tok , ok := keywords [ buf . String ( ) ] ; ok { return tok , buf . String ( ) } return IDENT , buf . String ( ) }
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 including EOF/EOL will cause the loop to exit. // If the string matches a keyword then return that keyword. // switch buf.String() { // case "Declaration": // 	return Declaration, buf.String() // Otherwise return as a regular identifier.