Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// 1. Create a "base" HTML transformer template
      Dim baseHtmlParser As New uCalc.Transformer()
      baseHtmlParser.Description = "Base HTML Parser"
      '// Rule to skip over comments
      baseHtmlParser.SkipOver("<!--{body}->")
      '// Rule to find any tag
      baseHtmlParser.Pattern("<{tag}>")
      baseHtmlParser.DefaultRuleSet.SetStatementSensitive(false)
      
      '// 2. Create a specialized clone to find only image tags
      Dim imageParser = baseHtmlParser.Clone()
      imageParser.Description = "Image Tag Finder"
      imageParser.FromTo("<img {attribs} />", "FOUND_IMG_TAG")
      
      Dim html As String = " <body> <img src='a.jpg' /> <!-- <img src='b.jpg' /> --> </body> "
      
      '// The clone inherits the SkipOver rule from the base, so the commented img tag is ignored.
      Console.WriteLine(imageParser.Transform(html))
      
      imageParser.Release()
      baseHtmlParser.Release()
   End Sub
End Module