private void joinTokens(final CobolToken token) {
        boolean codeToken = false;
        CobolToken prevToken = null;
        CobolType type = CobolType.UNDEFINED;

        //  Skips last (continuation), and comments and other non-code tokens.
        int index = tokens.size() - 2;
        while (index >= 0 && !codeToken) {
            prevToken = tokens.get(index);
            type = prevToken.getType();
            if (type == CobolType.COMMENT || type == CobolType.NEW_PAGE || type == CobolType.SPECIAL_LINE) {
                index--;
            } else {
                codeToken = true;
            }
        }

        if (codeToken && type == token.getType()) {
            //  Delete last token (of type CobolType.CONTINUATION);
            tokens.remove(tokens.size() - 1);
            //  Join two tokens.
            int row = prevToken.getRow();
            int col = prevToken.getCol();
            String text = prevToken.getText();
            String text2= token.getText();
            if (type == CobolType.STRING) {
                //  Delete the initial quote/semiquote.
                text2 = text2.substring(1);
                }
            CobolToken joinedToken = new CobolToken(row, col, text + text2, type);
            tokens.set(index, joinedToken);
        }
        else {
            //  Source code is bad; just append the token.
            tokens.add(token);
        }
    }