private TokenString tokenizeCurrentLine() {
        TokenString tokenString = new TokenString();
        boolean finishedLine = false;

        // Sorts through the list of TokenTypes, ordering them from longest to shortest.
        TokenType[] types = TokenType.values();
        Arrays.sort(types, Comparator.comparing((TokenType t) -> t.length()).reversed());

        while (!finishedLine) {
            if (source.get(currentLine).length() == 0) {
                finishedLine = true;
                continue;
            }

            boolean matched = false;
            for (TokenType t : types) {
                if (t.match(source.get(currentLine))) {
                    int position = currentPosition;
                    consume(t.length());
                    tokenString.append(new Token(t, t.tokenValue, currentLine, position));
                    matched = true;
                    break;
                }
            }

            if (!matched) {
                if (Character.isDigit(source.get(currentLine).charAt(0))) {
                    tokenString.append(tokenizeNumericalLiteral());
                } else if (isIdentifierCharacter(source.get(currentLine).charAt(0))) {
                    tokenString.append(tokenizeIdentifier());
                } else if (source.get(currentLine).charAt(0) == '"') {
                    tokenString.append(tokenizeStringLiteral());
                } else if (Character.isWhitespace(source.get(currentLine).charAt(0))) {
                    tokenString.append(new Token(TokenType.WHITESPACE, "", currentLine, currentPosition));
                    consume(1);
                } else {
                    Handler.reportError(new Handler.BuildError(3, currentLine, currentPosition, Character.toString(source.get(currentLine).charAt(0))));
                    consume(1);
                }
            }

            Handler.abortIfErrors();
        }

        return tokenString;
    }