Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Create a transformer with a custom comment token definition
      Dim t_source As New uCalc.Transformer()
      Dim commentToken = t_source.Tokens.Add("/\*([\s\S]*?)\*/", TokenType.Whitespace)
      commentToken.Description = "C-style block comment"
      
      '// Create a second transformer that will do replacements
      Dim t_replacer As New uCalc.Transformer()
      t_replacer.FromTo("secret", "REDACTED")
      
      Dim sourceText = "a secret /* contains another secret */ value"
      
      Console.WriteLine("--- Before Importing Comment Token ---")
      '// Without knowing about comments, t_replacer incorrectly modifies the text inside the comment.
      Console.WriteLine(t_replacer.Transform(sourceText))
      Console.WriteLine("")
      
      Console.WriteLine("--- After Importing Comment Token ---")
      '// Import the comment token definition. Now, the comment block is treated as a single whitespace token.
      t_replacer.Tokens.Add(commentToken)
      '// The transformer must be reset with the original text for the new token to apply.
      t_replacer.Text = sourceText
      Console.WriteLine(t_replacer.Transform())
   End Sub
End Module