Exemple #1
0
        public Scanner(Parsers.Position initialPosition, TextReader /*!*/ reader, SourceUnit /*!*/ sourceUnit,
                       ErrorSink /*!*/ errors, ICommentsSink commentsSink, LanguageFeatures features)
            : base(reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (sourceUnit == null)
            {
                throw new ArgumentNullException("sourceUnit");
            }
            if (errors == null)
            {
                throw new ArgumentNullException("errors");
            }

            this.lineShift   = initialPosition.FirstLine;
            this.columnShift = initialPosition.FirstColumn;
            this.offsetShift = initialPosition.FirstOffset;

            this.errors       = errors;
            this.commentsSink = commentsSink ?? new _NullCommentsSink();
            this.features     = features;
            this.sourceUnit   = sourceUnit;

            this.streamOffset = 0;
            this.pure         = sourceUnit.CompilationUnit.IsPure;
            this.encoding     = sourceUnit.Encoding;

            AllowAspTags   = (features & LanguageFeatures.AspTags) != 0;
            AllowShortTags = (features & LanguageFeatures.ShortOpenTags) != 0;
        }
Exemple #2
0
        public Scanner(TextReader /*!*/ reader, SourceUnit /*!*/ sourceUnit,
                       ErrorSink /*!*/ errors, ICommentsSink commentsSink, IScannerHandler scannerHandler,
                       LanguageFeatures features, int positionShift)
            : base(reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (sourceUnit == null)
            {
                throw new ArgumentNullException("sourceUnit");
            }
            if (errors == null)
            {
                throw new ArgumentNullException("errors");
            }

            this.errors         = errors;
            this.commentsSink   = commentsSink ?? new NullCommentsSink();
            this.scannerHandler = scannerHandler ?? new NullScannerHandler();
            this.features       = features;
            this.sourceUnit     = sourceUnit;
            this.charOffset     = positionShift;

            this.AllowAspTags   = (features & LanguageFeatures.AspTags) != 0;
            this.AllowShortTags = (features & LanguageFeatures.ShortOpenTags) != 0;
        }