public Token[] Tokenize() throws IllegalArgumentException {
        // following string builder will be used to check the presence of
        // unsupported characters
        // creates a new string that concatenates with the token that was just
        // found, and at the end is checked with the original string
        // if the strings do not match (after whitespace is removed) an
        // exception is thrown as there are unsupported characters in the input

        copyInput = new StringBuilder();
        String inputNoWhiteSpace;
        while (index < input.length()) {
            if (!(matcher.find(index))) {
                break;
            }
            String value = matcher.group();
            copyInput.append(value);
            tokenList.add(new Token(value));
            numTokens++;
            index = matcher.end();
        }

        // Check copyInput is equal to input stripped of all whitespace
        inputNoWhiteSpace = input.replace(" ", "");
        if (!(inputNoWhiteSpace.equals(copyInput.toString()))) {
            throw new IllegalArgumentException("Illegal character passed in");
        }
        // Check for only whitespace being passed in
        if (numTokens == 0) {
            throw new IllegalArgumentException("No valid tokens found");
        }
        // Add an END token to be used in the parser
        tokenList.add(new Token(""));
        Token[] tokenArray = new Token[tokenList.size()];

        // Convert to an array that will be passed into the parser
        for (int i = 0; i < tokenList.size(); i++) {
            tokenArray[i] = tokenList.get(i);
        }

        return tokenArray;
    }