Practical: Shows how disabling statement sensitivity is essential for parsing multi-line HTML/XML blocks.

ID: 989

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
var source = """
<data>
  content spans
  multiple lines
</data>
""";

// This rule must disable StatementSensitive to capture the multi-line body,
// otherwise the first newline would terminate the {body} variable.
var rule = t.FromTo("<data>{body}</data>", "Body: [{body}]");
rule.StatementSensitive = false;

Console.WriteLine(t.Transform(source));
				
			
Body: [
  content spans
  multiple lines
]
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   auto source = R"(<data>
  content spans
  multiple lines
</data>)";

   // This rule must disable StatementSensitive to capture the multi-line body,
   // otherwise the first newline would terminate the {body} variable.
   auto rule = t.FromTo("<data>{body}</data>", "Body: [{body}]");
   rule.StatementSensitive(false);

   cout << t.Transform(source) << endl;
}
				
			
Body: [
  content spans
  multiple lines
]
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      Dim source = "<data>
  content spans
  multiple lines
</data>"
      
      '// This rule must disable StatementSensitive to capture the multi-line body,
      '// otherwise the first newline would terminate the {body} variable.
      Dim rule = t.FromTo("<data>{body}</data>", "Body: [{body}]")
      rule.StatementSensitive = false
      
      Console.WriteLine(t.Transform(source))
   End Sub
End Module
				
			
Body: [
  content spans
  multiple lines
]