public List<Token> scan() {
		ArrayList<Token> tokens = new ArrayList<>();
		pos = 0;

		while (pos < input.length()) {
			char c = input.charAt(pos);

			if (Character.isDigit(c)) {
				tokens.add(scanNumericConstant());
			} else if (c == '"') {
				tokens.add(scanStringConstant());
			} else if (c == '\'') {
				tokens.add(scanCharacterConstant());
			} else if (isOperatorStart(c)) {
				tokens.add(scanOperator());
			} else if (Character.isLetter(c) || c == '_') {
				tokens.add(scanIdentifier());
			} else if (Character.isWhitespace(c)) {
				scanWhiteSpace(tokens);
			} else {
				syntaxError("unknown token encountered",pos);
			}
		}

		return tokens;
	}
public List<Token> scan() {
		ArrayList<Token> tokens = new ArrayList<>();
		pos = 0;

		while (pos < input.length()) {
			char c = input.charAt(pos);

			if (Character.isDigit(c)) {
				tokens.add(scanNumericConstant());
			} else if (c == '"') {
				tokens.add(scanStringConstant());
			} else if (c == '\'') {
				tokens.add(scanCharacterConstant());
			} else if (isOperatorStart(c)) {
				tokens.add(scanOperator());
			} else if (Character.isLetter(c) || c == '_') {
				tokens.add(scanIdentifier());
			} else if (Character.isWhitespace(c)) {
				scanWhiteSpace(tokens);
			} else {
				syntaxError("unknown token encountered",pos);
			}
		}

		return tokens;
	}
public List < Token > scan ( ) { ArrayList < Token > tokens = new ArrayList <> ( ) ; pos = 0 ; while ( pos < input . length ( ) ) { char c = input . charAt ( pos ) ; if ( Character . isDigit ( c ) ) { tokens . add ( scanNumericConstant ( ) ) ; } else if ( c == ' ' ) { tokens . add ( scanStringConstant ( ) ) ; } else if ( c == ' ' ) { tokens . add ( scanCharacterConstant ( ) ) ; } else if ( isOperatorStart ( c ) ) { tokens . add ( scanOperator ( ) ) ; } else if ( Character . isLetter ( c ) || c == ' ' ) { tokens . add ( scanIdentifier ( ) ) ; } else if ( Character . isWhitespace ( c ) ) { scanWhiteSpace ( tokens ) ; } else { syntaxError ( "unknown token encountered" , pos ) ; } } return tokens ; }
Scan all characters from the input stream and generate a corresponding
list of tokens, whilst discarding all whitespace and comments.

@return
Scan all characters from the input stream and generate a corresponding list of tokens whilst discarding all whitespace and comments .