private void fixListEnvironmentContent(EnvironmentToken environmentToken)
            throws SnuggleParseException {
        List<FlowToken> contents = environmentToken.getContent().getContents();
        List<FlowToken> itemBuilder = new ArrayList<FlowToken>();
        List<FlowToken> resultBuilder = new ArrayList<FlowToken>();
        
        /* Go through contents, building up item groups */
        FlowToken token;
        boolean foundItem = false;
        for (int i=0, size=contents.size(); i<size; i++) {
            token = contents.get(i);
            if (token.isCommand(CorePackageDefinitions.CMD_ITEM)) {
                /* Old-style \item. Stop building up content (if appropriate) and replace with
                 * new LIST_ITEM command */
                if (foundItem) {
                    CommandToken itemBefore = buildGroupedCommandToken(environmentToken, CorePackageDefinitions.CMD_LIST_ITEM, itemBuilder);
                    resultBuilder.add(itemBefore);
                }
                foundItem = true;
                continue;
            }
            else if (!foundItem) {
                /* Found stuff before first \item. The only thing we allow is whitespace text */
                if (token.getType()==TokenType.TEXT_MODE_TEXT && token.getSlice().isWhitespace()
                        || token.getType()==TokenType.NEW_PARAGRAPH) {
                    /* This is whitespace, so we'll just ignore this token */
                }
                else {
                    /* Error: (non-trivial) content before first \item */
                    resultBuilder.add(createError(token, CoreErrorCode.TFEL00));
                }
            }
            else {
                /* Add to current item */
                itemBuilder.add(token);
            }
        }
        /* At end, finish off last item */
        if (foundItem) {
            resultBuilder.add(buildGroupedCommandToken(environmentToken, CorePackageDefinitions.CMD_LIST_ITEM, itemBuilder));
        }
        
        /* Replace content */
        contents.clear();
        contents.addAll(resultBuilder);
    }