Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Using {@Whitespace} to Count Indentation
      '// A common use case for parsing structured text (like Python or YAML)
      '// is capturing the exact whitespace at the start of a line.
      
      uc.DefineVariable("IndentLen")
      
      Dim t = uc.NewTransformer()
      t.Text = "    Item 1" '// Indented by 4 spaces
      
      '// Capture the leading whitespace into 'w' and evaluate its length
      t.FromTo("{@Whitespace:w} Item {id}", "<{@Self}>{@Exec: IndentLen = Length(w)}")
      t.Transform()
      '// We can now analyze the captured whitespace
      Console.WriteLine($"Indentation length: {uc.EvalStr("IndentLen")}")
   End Sub
End Module