example/public/ueditor/third-party/SyntaxHighlighter/shCore.js
function(matches)
        {
            // Optimized by Jose Prado (http://joseprado.com)
            for (var i = 0; i < matches.length; i++)
            {
                if (matches[i] === null)
                    continue;

                var itemI = matches[i],
                    itemIEndPos = itemI.index + itemI.length
                    ;

                for (var j = i + 1; j < matches.length && matches[i] !== null; j++)
                {
                    var itemJ = matches[j];

                    if (itemJ === null)
                        continue;
                    else if (itemJ.index > itemIEndPos)
                        break;
                    else if (itemJ.index == itemI.index && itemJ.length > itemI.length)
                        matches[i] = null;
                    else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos)
                        matches[j] = null;
                }
            }

            return matches;
        }
function(matches)
        {
            // Optimized by Jose Prado (http://joseprado.com)
            for (var i = 0; i < matches.length; i++)
            {
                if (matches[i] === null)
                    continue;

                var itemI = matches[i],
                    itemIEndPos = itemI.index + itemI.length
                    ;

                for (var j = i + 1; j < matches.length && matches[i] !== null; j++)
                {
                    var itemJ = matches[j];

                    if (itemJ === null)
                        continue;
                    else if (itemJ.index > itemIEndPos)
                        break;
                    else if (itemJ.index == itemI.index && itemJ.length > itemI.length)
                        matches[i] = null;
                    else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos)
                        matches[j] = null;
                }
            }

            return matches;
        }
function ( matches ) { // Optimized by Jose Prado (http://joseprado.com) for ( var i = 0 ; i < matches . length ; i ++ ) { if ( matches [ i ] === null ) continue ; var itemI = matches [ i ] , itemIEndPos = itemI . index + itemI . length ; for ( var j = i + 1 ; j < matches . length && matches [ i ] !== null ; j ++ ) { var itemJ = matches [ j ] ; if ( itemJ === null ) continue ; else if ( itemJ . index > itemIEndPos ) break ; else if ( itemJ . index == itemI . index && itemJ . length > itemI . length ) matches [ i ] = null ; else if ( itemJ . index >= itemI . index && itemJ . index < itemIEndPos ) matches [ j ] = null ; } } return matches ; }
Checks to see if any of the matches are inside of other matches.
This process would get rid of highligted strings inside comments,
keywords inside strings and so on.
Checks to see if any of the matches are inside of other matches . This process would get rid of highligted strings inside comments keywords inside strings and so on .