Adds a C-style single-line comment token and categorizes it as whitespace to be ignored by other rules.

ID: 1135

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("this", "THAT");

string text = "transform this but not // this in a comment";

Console.WriteLine("--- Before --- ");
// Initially, the comment is treated as regular text.
Console.WriteLine(t.Transform(text));

// Add a token for C-style comments and classify it as whitespace.
t.Tokens.Add("//.*", TokenType.Whitespace);

Console.WriteLine("");
Console.WriteLine("--- After --- ");
// Re-run the transform. The comment is now ignored.
Console.WriteLine(t.Transform(text));
				
			
--- Before --- 
transform THAT but not // THAT in a comment

--- After --- 
transform THAT but not // this in a comment
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   t.FromTo("this", "THAT");

   string text = "transform this but not // this in a comment";

   cout << "--- Before --- " << endl;
   // Initially, the comment is treated as regular text.
   cout << t.Transform(text) << endl;

   // Add a token for C-style comments and classify it as whitespace.
   t.Tokens().Add("//.*", TokenType::Whitespace);

   cout << "" << endl;
   cout << "--- After --- " << endl;
   // Re-run the transform. The comment is now ignored.
   cout << t.Transform(text) << endl;
}
				
			
--- Before --- 
transform THAT but not // THAT in a comment

--- After --- 
transform THAT but not // this in a comment
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      t.FromTo("this", "THAT")
      
      Dim text As String = "transform this but not // this in a comment"
      
      Console.WriteLine("--- Before --- ")
      '// Initially, the comment is treated as regular text.
      Console.WriteLine(t.Transform(text))
      
      '// Add a token for C-style comments and classify it as whitespace.
      t.Tokens.Add("//.*", TokenType.Whitespace)
      
      Console.WriteLine("")
      Console.WriteLine("--- After --- ")
      '// Re-run the transform. The comment is now ignored.
      Console.WriteLine(t.Transform(text))
   End Sub
End Module
				
			
--- Before --- 
transform THAT but not // THAT in a comment

--- After --- 
transform THAT but not // this in a comment