Пример #1
0
 public static void Run(string source, TextWriter tw = null, string cs_master_file = "", string filename = "pgm.fast")
 {
     if (tw == null)
     {
         tw = Console.Out;
     }
     try
     {
         var pgm = FastPgmParser.Parse(source, filename);
         FastTransducerInstance fti = FastTransducerInstance.MkFastTransducerInstance(pgm, tw, LogLevel.Minimal);
         FastTransducerInstance.DisposeZ3P();
     }
     catch (FastParseException e)
     {
         tw.WriteLine(e.ToString());
         return;
     }
     catch (FastAssertException e)
     {
         tw.WriteLine("{3}({0},{1}): error : AssertionViolated, {2}", min1(e.line), min1(e.pos), e.Message, filename);
         return;
     }
     catch (FastException e)
     {
         tw.WriteLine("{3}({0},{1}): error : FastError, {2}", 1, 1, e.Message, filename);
         return;
     }
     catch (Exception e)
     {
         tw.WriteLine("{3}({0},{1}): error : InternalError, {2}", 1, 1, filename);
         return;
     }
 }
Пример #2
0
        public void TestOperators()
        {
            var pgm = Parser.ParseFromFile(srcDirectory + "Fast.Tests/FastSamples/operators.fast");

            FastTransducerInstance fti = FastTransducerInstance.MkFastTransducerInstance(pgm);

            FastTransducerInstance.DisposeZ3P();
        }
Пример #3
0
        public void TestHtmlSanitizer()
        {
            var pgm = Parser.ParseFromFile(srcDirectory + "Fast.Tests/FastSamples/htmlSanitizer.fast");

            FastTransducerInstance fti = FastTransducerInstance.MkFastTransducerInstance(pgm);

            FastTransducerInstance.DisposeZ3P();
        }
Пример #4
0
        public void TestConstants()
        {
            var pgm = Parser.ParseFromFile(srcDirectory + "Fast.Tests/FastSamples/constants.fast");

            FastTransducerInstance fti = FastTransducerInstance.MkFastTransducerInstance(pgm);

            FastTransducerInstance.DisposeZ3P();

            Assert.IsTrue(pgm.defs.Count == 8);

            StringBuilder sb = new StringBuilder();

            //fti.ToFast(sb);

            //pgm = Parser.ParseFromString(sb.ToString());

            //bool b = CsharpGenerator.GenerateCode(pgm, "../../../src/Fast.Tests/GeneratedCS/constants.cs", "Microsoft.Fast.Tests.Constants");
        }