Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      
      '// Define a custom string literal using pipe characters `|...|`.
      '// The regex `\|([^\|]*)\|` captures the inner content in group 1.
      '// We set `subMatchGroup` to 1 to use this group as the token's value.
      Dim pipeStringToken = t.Tokens.Add("\|([^\|]*)\|", TokenType.Literal, "", 1)
      
      '// Complete the definition by setting the data type and QuotedText property.
      pipeStringToken.DataType = uc.DataTypeOf("String")
      pipeStringToken.IsProperty(ItemIs.QuotedText, true)
      
      '// Define a simple rule to prove the token works.
      t.FromTo("Test: {@String:s}", "Found: {s(0)} | Content: {s(1)}")
      
      '// The transformer now recognizes |...| as a string literal.
      Console.WriteLine(t.Transform("Test: |hello|"))
   End Sub
End Module