/// <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(); IScanner stringLineScanner = this.BuildStringScanner(); stringLineScanner.Child = wordScanner; IScanner stringBlockScanner = this.BuildStringBlockScanner(); stringBlockScanner.Child = stringLineScanner; IScanner commentLineScanner = this.BuildCommentLineScanner(); commentLineScanner.Child = stringBlockScanner; CommentLineScanner xmlCommentLineScanner = new CommentLineScanner(this.Tokenizer, this.ScannerResult); xmlCommentLineScanner.CommentLineNode.Entities.Add("///"); xmlCommentLineScanner.CommentLineNode.ForeColor = Color.Gray; xmlCommentLineScanner.Child = commentLineScanner; IScanner commentBlockScanner = this.BuildCommentBlockScanner(); commentBlockScanner.Child = xmlCommentLineScanner; return(commentBlockScanner); }
/// <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); }
/// <summary> /// Builds a comment line scanner. /// </summary> /// <returns></returns> protected override IScanner BuildCommentLineScanner() { CommentLineScanner scanner = new CommentLineScanner(this.Tokenizer, this.ScannerResult); scanner.CommentLineNode.ForeColor = Color.Green; scanner.CommentLineNode.Entities.Add("'"); return(scanner); }
/// <summary> /// Builds a comment line scanner. /// </summary> /// <returns>A <see cref="Wilco.SyntaxHighlighting.CommentLineScanner"/> object.</returns> protected virtual IScanner BuildCommentLineScanner() { CommentLineScanner scanner = new CommentLineScanner(this.tokenizer, this.scannerResult); scanner.CommentLineNode.ForeColor = Color.Green; scanner.CommentLineNode.Entities.Add("//"); return(scanner); }