Exemplo n.º 1
0
        private ParsedDocument ParseContent(string content, [NotNull] SerializableDocumentDescriptor descriptorToUpdate)
        {
            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(content)))
            {
                var tokens  = new List <Token>();
                var context = new ExecutionContextImplementation(this.session.Context, this.Filename);
                var root    = ConnectQlContext.Parse(stream, context.NodeData, context.Messages, true, tokens);

                descriptorToUpdate.Tokens = Classifier.Classify(tokens).Select(token => new SerializableToken(token)).ToArray();

                return(new ParsedDocument(context, root));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="EvaluationResult" /> class.
 /// </summary>
 /// <param name="context">
 ///     The context.
 /// </param>
 /// <param name="tokens">
 ///     The tokens.
 /// </param>
 public EvaluationResult(ExecutionContextImplementation context, IReadOnlyList <IClassifiedToken> tokens)
 {
     this.context = context;
     this.tokens  = tokens;
 }