Ejemplo n.º 1
0
        List <InternalObject> InternalParseIncremental(
            IncrementalParserState oldParserState, ITextSource newTextSource, out IncrementalParserState newParserState,
            bool collapseProperlyNestedElements, CancellationToken cancellationToken)
        {
            var reader = new TagReader(this, newTextSource, collapseProperlyNestedElements);
            ITextSourceVersion newVersion = newTextSource.Version;
            var reuseMap = oldParserState != null?oldParserState.GetReuseMapTo(newVersion) : null;

            List <InternalObject> internalObjects;

            if (reuseMap != null)
            {
                internalObjects = reader.ReadAllObjectsIncremental(oldParserState.Objects, reuseMap, cancellationToken);
            }
            else
            {
                internalObjects = reader.ReadAllObjects(cancellationToken);
            }

            if (newVersion != null)
            {
                newParserState = new IncrementalParserState(newTextSource.TextLength, newVersion, internalObjects.ToArray());
            }
            else
            {
                newParserState = null;
            }

            return(internalObjects);
        }
Ejemplo n.º 2
0
        List<InternalObject> InternalParseIncremental(
			IncrementalParserState oldParserState, ITextSource newTextSource, out IncrementalParserState newParserState,
			bool collapseProperlyNestedElements, CancellationToken cancellationToken)
        {
            var reader = new TagReader(this, newTextSource, collapseProperlyNestedElements);
            ITextSourceVersion newVersion = newTextSource.Version;
            var reuseMap = oldParserState != null ? oldParserState.GetReuseMapTo(newVersion) : null;

            List<InternalObject> internalObjects;
            if (reuseMap != null)
                internalObjects = reader.ReadAllObjectsIncremental(oldParserState.Objects, reuseMap, cancellationToken);
            else
                internalObjects = reader.ReadAllObjects(cancellationToken);

            if (newVersion != null)
                newParserState = new IncrementalParserState(newTextSource.TextLength, newVersion, internalObjects.ToArray());
            else
                newParserState = null;

            return internalObjects;
        }