Exemplo n.º 1
0
 /// <summary>
 /// Raises the <see cref="Wilco.SyntaxHighlighting.XmlScanner.Match"/> event.
 /// </summary>
 /// <param name="e">An <see cref="System.EventArgs"/> object that contains the event data.</param>
 protected void OnMatch(MatchEventArgs e)
 {
     if (this.Match != null)
     {
         this.Match(this, e);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Handles the match event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void xmlScanner_Match(object sender, MatchEventArgs e)
 {
     if (e.Type == MatchType.StartIdentifier)
     {
         this.inScriptBlock = true;
     }
     else if (e.Type == MatchType.EndIdentifier)
     {
         this.inScriptBlock = false;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the match event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void xmlScanner_Match(object sender, MatchEventArgs e)
        {
            if (e.Tag != null && e.Tag.ToLower() == "script")
            {
                if (e.Type == MatchType.StartTag)
                {
                    this.language = e.Attributes["lang"];
                    if (this.language == null)
                    {
                        this.language = e.Attributes["language"];
                    }

                    if (this.language != null)
                    {
                        this.language = this.language.Replace("\"", "").Replace("'", "");
                        if (this.language.Length == 0)
                        {
                            this.language = null;
                        }
                    }

                    if (this.language != null)
                    {
                        HighlighterBase highlighter = Register.Instance.Highlighters[this.language];
                        if (highlighter != null)
                        {
                            highlighter        = highlighter.Create();
                            highlighter.Parser = this.parser;
                            this.Child         = highlighter.BuildEntryPointScanner(this.Tokenizer, this.ScannerResult);
                        }
                        else
                        {
                            this.language = null;
                        }
                    }
                }
                else if (e.Type == MatchType.EndTag)
                {
                    this.language = null;
                }
            }
        }