// scan returns the next token and literal value.
scan returns the next token and literal value.
// scan returns the next token and literal value .
func (s *Scanner) scan() (tok Token, lit string) {
	ch := s.read()
	if isWhitespace(ch) {
		s.unread()
		return s.scanWhitespace()
	} else if ch == lf || ch == cr {
		s.unread()
		return s.scanEOL()
	} else if unicode.IsLetter(ch) {
		s.unread()
		return s.scanIdent()
	} else if ch == '"' {
		s.unread()
		return s.scanStringliteral()
	} else if ch == '#' {
		s.unread()
		return s.scanLinecomment()
	} else if ch == '^' {
		s.unread()
		return s.scanDoubleCircum()
	} else if ch == '<' {
		s.unread()
		return s.scanIRI()
	} else if isDigit(ch) {
		s.unread()
		return s.scanNumber()
	}
	switch ch {
	case eof:
		return EOF, ""
	case ':':
		return COLON, string(ch)
	case '=':
		return EQUALS, string(ch)
	case ',':
		return COMMA, string(ch)
	case '"':
		return QUOTE, string(ch)
	case '(':
		return B1, string(ch)
	case ')':
		return B2, string(ch)
	case '+':
		return PLUS, string(ch)
	case '-':
		return MINUS, string(ch)
	case '@':
		return AT, string(ch)
	}
	return ILLEGAL, string(ch)
}
func ( s * Scanner ) scan ( ) ( tok Token , lit string ) { ch := s . read ( ) if isWhitespace ( ch ) { s . unread ( ) return s . scanWhitespace ( ) } else if ch == lf || ch == cr { s . unread ( ) return s . scanEOL ( ) } else if unicode . IsLetter ( ch ) { s . unread ( ) return s . scanIdent ( ) } else if ch == '"' { s . unread ( ) return s . scanStringliteral ( ) } else if ch == '#' { s . unread ( ) return s . scanLinecomment ( ) } else if ch == '^' { s . unread ( ) return s . scanDoubleCircum ( ) } else if ch == '<' { s . unread ( ) return s . scanIRI ( ) } else if isDigit ( ch ) { s . unread ( ) return s . scanNumber ( ) } switch ch { case eof : return EOF , " " case ':' : return COLON , string ( ch ) case '=' : return EQUALS , string ( ch ) case ',' : return COMMA , string ( ch ) case '"' : return QUOTE , string ( ch ) case '(' : return B1 , string ( ch ) case ')' : return B2 , string ( ch ) case '+' : return PLUS , string ( ch ) case '-' : return MINUS , string ( ch ) case '@' : return AT , string ( ch ) } return ILLEGAL , string ( ch ) }
scan returns the next token and literal value.
scan returns the next token and literal value .
// Read the next rune. // If we see whitespace then consume all contiguous whitespace. // If we see a letter then consume as an ident or reserved word. // } else if isSign(ch) || isDigit(ch) { // Otherwise read the individual character.