Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Internal Test: Verifies precedence and tag retrieval via NextOverload
      Dim t As New uCalc.Transformer()
      t.Text = "Testing (a b c) Testing x y z! Testing 1 2 3."
      
      '// Rules defined last have higher precedence for the same anchor ("Testing")
      Dim p1 = t.Pattern("Testing {etc}.").SetTag(111)
      Dim p2 = t.Pattern("Testing {etc}!").SetTag(222)
      Dim p3 = t.Pattern("Testing ({etc})").SetTag(333)
      
      '// Get the highest precedence rule via Pattern's return value
      Dim highestPriorityRule = p3
      Console.WriteLine($"Highest priority rule tag: {highestPriorityRule.Tag}")
      
      '// Walk the overload chain
      Dim midPriorityRule = highestPriorityRule.NextOverload()
      Console.WriteLine($"Mid priority rule tag: {midPriorityRule.Tag}")
      
      Dim lowPriorityRule = midPriorityRule.NextOverload()
      Console.WriteLine($"Low priority rule tag: {lowPriorityRule.Tag}")
      
      '// The end of the chain should have a tag of 0 (default)
      Dim endOfChain = lowPriorityRule.NextOverload()
      Console.WriteLine($"End of chain tag: {endOfChain.Tag}")
   End Sub
End Module