Exemplo n.º 1
0
        /// <summary>
        /// Builds a new chain of scanners.
        /// </summary>
        /// <param name="tokenizer">The tokenizer used by the scanners.</param>
        /// <param name="scannerResult">The scanner result.</param>
        /// <returns>
        /// The scanner at the start of the chain.
        /// </returns>
        public override IScanner BuildEntryPointScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult)
        {
            this.Tokenizer     = tokenizer;
            this.ScannerResult = scannerResult;

            IScanner wordScanner = this.BuildWordScanner();

            StringLineScanner stringScanner = (StringLineScanner)this.BuildStringScanner();

            stringScanner.StringNode.Entities.Add(new StringEntity("'", "'", "\\"));
            stringScanner.Child = wordScanner;

            CommentLineScanner commentLineScanner = (CommentLineScanner)this.BuildCommentLineScanner();

            commentLineScanner.CommentLineNode.Entities.Add("#");
            commentLineScanner.Child = stringScanner;

            IScanner commentBlockScanner = this.BuildCommentBlockScanner();

            commentBlockScanner.Child = commentLineScanner;

            PHPScanner phpScanner = new PHPScanner(this.Tokenizer, this.ScannerResult);

            phpScanner.Child = commentBlockScanner;

            return(phpScanner);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Builds a string scanner.
        /// </summary>
        /// <returns>A <see cref="Wilco.SyntaxHighlighting.StringLineScanner"/> object.</returns>
        protected virtual IScanner BuildStringScanner()
        {
            StringLineScanner scanner = new StringLineScanner(this.tokenizer, this.scannerResult);

            scanner.StringNode.ForeColor = Color.DarkRed;
            scanner.StringNode.Entities.Add(new StringEntity("\"", "\"", "\\"));
            return(scanner);
        }