示例#1
0
        public ParserContext(ITextDocument source, ParserBase codeParser, ParserBase markupParser, ParserBase activeParser)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (codeParser == null)
            {
                throw new ArgumentNullException("codeParser");
            }
            if (markupParser == null)
            {
                throw new ArgumentNullException("markupParser");
            }
            if (activeParser == null)
            {
                throw new ArgumentNullException("activeParser");
            }
            if (activeParser != codeParser && activeParser != markupParser)
            {
                throw new ArgumentException(RazorResources.ActiveParser_Must_Be_Code_Or_Markup_Parser, "activeParser");
            }

            CaptureOwnerTask();

            Source = new TextDocumentReader(source);
            CodeParser = codeParser;
            MarkupParser = markupParser;
            ActiveParser = activeParser;
            Errors = new List<RazorError>();
        }
示例#2
0
        public ParserContext(ITextDocument source,
                             ParserBase codeParser,
                             ParserBase markupParser,
                             ParserBase activeParser,
                             ErrorSink errorSink)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (codeParser == null)
            {
                throw new ArgumentNullException(nameof(codeParser));
            }

            if (markupParser == null)
            {
                throw new ArgumentNullException(nameof(markupParser));
            }

            if (activeParser == null)
            {
                throw new ArgumentNullException(nameof(activeParser));
            }

            if (errorSink == null)
            {
                throw new ArgumentNullException(nameof(errorSink));
            }

            if (activeParser != codeParser && activeParser != markupParser)
            {
                throw new ArgumentException(RazorResources.ActiveParser_Must_Be_Code_Or_Markup_Parser, nameof(activeParser));
            }

            CaptureOwnerTask();

            Source = new TextDocumentReader(source);
            CodeParser = codeParser;
            MarkupParser = markupParser;
            ActiveParser = activeParser;
            _errorSink = errorSink;
        }
示例#3
0
        public ParserContext([NotNull] ITextDocument source,
                             [NotNull] ParserBase codeParser,
                             [NotNull] ParserBase markupParser,
                             [NotNull] ParserBase activeParser,
                             [NotNull] ParserErrorSink errorSink)
        {
            if (activeParser != codeParser && activeParser != markupParser)
            {
                throw new ArgumentException(RazorResources.ActiveParser_Must_Be_Code_Or_Markup_Parser, "activeParser");
            }

            CaptureOwnerTask();

            Source = new TextDocumentReader(source);
            CodeParser = codeParser;
            MarkupParser = markupParser;
            ActiveParser = activeParser;
            _errorSink = errorSink;
        }