StatementSensitive()

ID: 140

				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
t.Text = "x = 1; if (true) func1(3+4); else func2(x*y); y = x + 2";
var p = t.Pattern("if {etc}");

Console.WriteLine($"Input: {t.Text}");
Console.WriteLine($"Pattern: {p.Pattern}");
Console.WriteLine("");

t.Find();
Console.WriteLine($"StatementSensitive: {t.DefaultRuleSet.StatementSensitive}");
Console.WriteLine(t.Matches.Text);
Console.WriteLine("");

t.DefaultRuleSet.StatementSensitive = false;
t.Find();
Console.WriteLine($"StatementSensitive: {t.DefaultRuleSet.StatementSensitive}");
Console.WriteLine(t.Matches.Text);
				
			
Input: x = 1; if (true) func1(3+4); else func2(x*y); y = x + 2
Pattern: if {etc}

StatementSensitive: True
if (true) func1(3+4)

StatementSensitive: False
if (true) func1(3+4); else func2(x*y); y = x + 2
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

#define tf(IsTrue) ((IsTrue) ? "True" : "False")

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   t.Text("x = 1; if (true) func1(3+4); else func2(x*y); y = x + 2");
   auto p = t.Pattern("if {etc}");

   cout << "Input: " << t.Text() << endl;
   cout << "Pattern: " << p.Pattern() << endl;
   cout << "" << endl;

   t.Find();
   cout << "StatementSensitive: " << tf(t.DefaultRuleSet().StatementSensitive()) << endl;
   cout << t.Matches().Text() << endl;
   cout << "" << endl;

   t.DefaultRuleSet().StatementSensitive(false);
   t.Find();
   cout << "StatementSensitive: " << tf(t.DefaultRuleSet().StatementSensitive()) << endl;
   cout << t.Matches().Text() << endl;
}
				
			
Input: x = 1; if (true) func1(3+4); else func2(x*y); y = x + 2
Pattern: if {etc}

StatementSensitive: True
if (true) func1(3+4)

StatementSensitive: False
if (true) func1(3+4); else func2(x*y); y = x + 2
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      t.Text = "x = 1; if (true) func1(3+4); else func2(x*y); y = x + 2"
      Dim p = t.Pattern("if {etc}")
      
      Console.WriteLine($"Input: {t.Text}")
      Console.WriteLine($"Pattern: {p.Pattern}")
      Console.WriteLine("")
      
      t.Find()
      Console.WriteLine($"StatementSensitive: {t.DefaultRuleSet.StatementSensitive}")
      Console.WriteLine(t.Matches.Text)
      Console.WriteLine("")
      
      t.DefaultRuleSet.StatementSensitive = false
      t.Find()
      Console.WriteLine($"StatementSensitive: {t.DefaultRuleSet.StatementSensitive}")
      Console.WriteLine(t.Matches.Text)
   End Sub
End Module
				
			
Input: x = 1; if (true) func1(3+4); else func2(x*y); y = x + 2
Pattern: if {etc}

StatementSensitive: True
if (true) func1(3+4)

StatementSensitive: False
if (true) func1(3+4); else func2(x*y); y = x + 2