private void processToken() throws SyntaxException, IOException {
        while (hasNextCharacter()) {
            nextCharacter();

            if (isAlpha(getCurrentCharacter())) {
                tokens.add(EbnfScannerHelper.scanIdentifier(this));
                currentToken++;
                return;
            } else if (isQuote(getCurrentCharacter())) {
                tokens.add(EbnfScannerHelper.scanLiteral(this));
                currentToken++;
                return;
            } else if (isOperator(getCurrentCharacter())) {
                if ('(' == getCurrentCharacter() && '*' == peekCharacter()) {
                    tokens.add(EbnfScannerHelper.scanComment(this));
                } else {
                    tokens.add(EbnfScannerHelper.scanOperator(this));
                }
                currentToken++;
                return;
            } else if (isWhiteSpace(getCurrentCharacter())) { // NOPMD
                // Ignore white spaces.
            } else if (EOF == getCurrentCharacter()) {
                // Break out the loop, if there are no more characters.
                break;
            } else {
                raiseError(String.format("Invalid character '%s' at %s",
                                        getCurrentCharacter(),
                                        createPosition()));
            }

            checkNewline();
        }

        tokens.add(new Token(TokenType.EOF, file, createPosition()));
        currentToken++;
    }