private void calculatePositions() {
        positions.clear();
        cNextPos = fOffset;

        try {
            recursiveTokens(0);
        } catch (BadLocationException e) {
            e.printStackTrace();
        }
        // Collections.sort(positions, new RangeTokenComparator());

        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                editor.updateFoldingStructure(positions);
            }

        });
    }
uses {@link #document}, {@link #fOffset} and {@link #fRangeEnd} to
calculate {@link #positions}. About syntax errors: this method is not a
validator, it is useful.
plugins/org.jkiss.dbeaver.ui.editors.xml/src/org/jkiss/dbeaver/ui/editors/xml/XMLReconcilingStrategy.java