예제 #1
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.PHPScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 public PHPScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult) : base(tokenizer, scannerResult)
 {
     this.scannerResult     = scannerResult;
     this.xmlScanner        = new XmlScanner(this.Tokenizer, this.scannerResult);
     this.xmlScanner.Match += new MatchEventHandler(this.xmlScanner_Match);
     this.SetID("PHPScanner");
 }
예제 #2
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();

            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);
        }
예제 #3
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);
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.ScannerBase"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 public ScannerBase(TokenizerBase tokenizer, OccurrenceCollection scannerResult)
 {
     this.dependencies  = new ScannerCollection();
     this.enabled       = true;
     this.id            = "Unnamed";
     this.tokenizer     = tokenizer;
     this.scannerResult = scannerResult;
 }
예제 #5
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;

            // We don't know yet what the chain of scanners will be.
            return(null);
        }
예제 #6
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;

            ASPXScanner aspxScanner = new ASPXScanner(this.Tokenizer, this.ScannerResult);

            return(aspxScanner);
        }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.ASPXScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 /// <param name="aspxNode">A <see cref="Wilco.SyntaxHighlighting.ASPXNode"/> object.</param>
 public ASPXScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult, ASPXNode aspxNode)
     : base(tokenizer, scannerResult)
 {
     this.aspxNode           = aspxNode;
     this.aspxNode.BackColor = System.Drawing.Color.Yellow;
     this.xmlScanner         = new XmlScanner(this.Tokenizer, this.ScannerResult);
     this.xmlScanner.Match  += new MatchEventHandler(this.xmlScanner_Match);
     this.parser             = new HtmlParser();
     this.SetID("ASPXScanner");
 }
예제 #8
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;

            CssScanner cssScanner = new CssScanner(this.Tokenizer, this.ScannerResult);

            cssScanner.Child = this.BuildCommentBlockScanner();
            return(cssScanner);
        }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of an <see cref="Wilco.SyntaxHighlighting.CssScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 public CssScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult) : base(tokenizer, scannerResult)
 {
     this.cssSelectorNameNode             = new CssAttributeNameNode();
     this.cssSelectorNameNode.ForeColor   = System.Drawing.Color.Maroon;
     this.cssAttributeNameNode            = new CssAttributeNameNode();
     this.cssAttributeNameNode.ForeColor  = System.Drawing.Color.Red;
     this.cssAttributeValueNode           = new CssAttributeValueNode();
     this.cssAttributeValueNode.ForeColor = System.Drawing.Color.Blue;
     this.SetID("CssScanner");
 }
예제 #10
0
파일: Register.cs 프로젝트: Verlic/BlueMoon
 /// <summary>
 /// Registers the scanners.
 /// </summary>
 private void InitializeScanners(TokenizerBase tokenizer)
 {
     this.scanners.Add(new CommentBlockScanner());
     this.scanners.Add(new CommentLineScanner());
     this.scanners.Add(new StringBlockScanner());
     this.scanners.Add(new StringLineScanner());
     this.scanners.Add(new WordScanner());
     this.scanners.Add(new XmlScanner());
     this.scanners.Add(new ASPXScanner());
     this.scanners.Add(new PHPScanner());
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of an <see cref="Wilco.SyntaxHighlighting.XmlScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 public XmlScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult) : base(tokenizer, scannerResult)
 {
     this.xmlSpecialCharNode           = new XmlSpecialCharNode();
     this.xmlSpecialCharNode.ForeColor = System.Drawing.Color.Blue;
     this.xmlTagNode                      = new XmlTagNode();
     this.xmlTagNode.ForeColor            = System.Drawing.Color.Maroon;
     this.xmlNamespaceNode                = new XmlNamespaceNode();
     this.xmlNamespaceNode.ForeColor      = System.Drawing.Color.MediumVioletRed;
     this.xmlCommentNode                  = new XmlCommentNode();
     this.xmlCommentNode.ForeColor        = System.Drawing.Color.Green;
     this.xmlAttributeNameNode            = new XmlAttributeNameNode();
     this.xmlAttributeNameNode.ForeColor  = System.Drawing.Color.Red;
     this.xmlAttributeValueNode           = new XmlAttributeValueNode();
     this.xmlAttributeValueNode.ForeColor = System.Drawing.Color.Blue;
     this.SetID("XmlScanner");
 }
예제 #12
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 virtual IScanner BuildEntryPointScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult)
        {
            this.tokenizer     = tokenizer;
            this.scannerResult = scannerResult;

            IScanner wordScanner = this.BuildWordScanner();

            IScanner stringScanner = this.BuildStringScanner();

            stringScanner.Child = wordScanner;

            IScanner commentLineScanner = this.BuildCommentLineScanner();

            commentLineScanner.Child = stringScanner;

            IScanner commentBlockScanner = this.BuildCommentBlockScanner();

            commentBlockScanner.Child = commentLineScanner;

            return(commentBlockScanner);
        }
예제 #13
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.StringLineScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 /// <param name="stringNode">A <see cref="Wilco.SyntaxHighlighting.StringNode"/> object.</param>
 public StringLineScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult, StringNode stringNode) : base(tokenizer, scannerResult)
 {
     this.ScannerResult = scannerResult;
     this.stringNode    = stringNode;
     this.SetID("StringLineScanner");
 }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.IScanner"/> implementation class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 /// <returns>A new instance of a <see cref="Wilco.SyntaxHighlighting.IScanner"/> implementation class.</returns>
 public override IScanner Create(TokenizerBase tokenizer, OccurrenceCollection scannerResult)
 {
     return(new StringBlockScanner(tokenizer, scannerResult));
 }
예제 #15
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.StringBlockScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 /// <param name="stringNode">A <see cref="Wilco.SyntaxHighlighting.StringNode"/> object.</param>
 public StringBlockScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult, StringNode stringNode) : base(tokenizer, scannerResult)
 {
     this.stringNode = stringNode;
     this.lastToken  = null;
     this.SetID("StringBlockScanner");
 }
예제 #16
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.StringBlockScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 public StringBlockScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult) : this(tokenizer, scannerResult, new StringNode())
 {
     //
 }
예제 #17
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.ASPXScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 public ASPXScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult)
     : this(tokenizer, scannerResult, new ASPXNode())
 {
     //
 }
예제 #18
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.CommentBlockScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 /// <param name="commentBlockNode">A <see cref="Wilco.SyntaxHighlighting.CommentBlockNode"/> object.</param>
 public CommentBlockScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult, CommentBlockNode commentBlockNode) : base(tokenizer, scannerResult)
 {
     this.commentBlockNode = commentBlockNode;
     this.SetID("CommentBlockScanner");
 }
예제 #19
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.CommentBlockScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 public CommentBlockScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult) : this(tokenizer, scannerResult, new CommentBlockNode())
 {
     //
 }
예제 #20
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.WordScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 /// <param name="wordNodes">An array of <see cref="Wilco.SyntaxHighlighting.WordNode"/> objects.</param>
 public WordScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult, WordNode[] wordNodes) : base(tokenizer, scannerResult)
 {
     this.wordNodes = wordNodes;
     this.SetID("WordScanner");
 }
예제 #21
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.IScanner"/> implementation class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 /// <returns>A new instance of a <see cref="Wilco.SyntaxHighlighting.IScanner"/> implementation class.</returns>
 public abstract IScanner Create(TokenizerBase tokenizer, OccurrenceCollection scannerResult);
예제 #22
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.IScanner"/> implementation class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 /// <returns>A new instance of a <see cref="Wilco.SyntaxHighlighting.IScanner"/> implementation class.</returns>
 public override IScanner Create(TokenizerBase tokenizer, OccurrenceCollection scannerResult)
 {
     return(new CommentLineScanner(tokenizer, scannerResult));
 }
예제 #23
0
 /// <summary>
 /// Initializes a new instance of a <see cref="Wilco.SyntaxHighlighting.WordScanner"/> class.
 /// </summary>
 /// <param name="tokenizer">The <see cref="Wilco.SyntaxHighlighting.TokenizerBase"/> which is used to tokenize the source code.</param>
 /// <param name="scannerResult">The <see cref="Wilco.SyntaxHighlighting.OccurrenceCollection"/> which will contain the scanner result.</param>
 public WordScanner(TokenizerBase tokenizer, OccurrenceCollection scannerResult) : this(tokenizer, scannerResult, new WordNode[0])
 {
     //
 }