// Have a look at the .gm + .grg, the ExternalFiltersAndSequencesActionsExternalFunctions.cs,
        // and the ExternalFiltersAndSequencesActionsExternalFunctionsImpl.cs files.
        // They show how to declare external match filters and external sequences in the rules file, 
        // and how to use them in the sequences in the rule file or the shell script file.
        // The generated XXXExternalFunctions.cs file contains the partial classes of the filters and sequences
        // and the manually coded XXXExternalFunctionsImpl.cs file exemplifies how to implement these external functions.
        void DoEFS()
        {
            graph = new ExternalFiltersAndSequencesGraph();
            actions = new ExternalFiltersAndSequencesActions(graph);
            procEnv = new LGSPGraphProcessingEnvironment(graph, actions);

            // use graph rewrite sequence
            procEnv.ApplyGraphRewriteSequence("(::n)=init");

            Console.WriteLine(procEnv.PerformanceInfo.MatchesFound + " matches found.");
            Console.WriteLine(procEnv.PerformanceInfo.RewritesPerformed + " rewrites performed.");
            procEnv.PerformanceInfo.Reset();

            // use new 2.5 exact interface
            IMatchesExact<Rule_r.IMatch_r> matchesExact = actions.r.Match(procEnv, 0);
            Console.WriteLine(matchesExact.Count + " matches found.");
            actions.r.Modify(procEnv, matchesExact.FirstExact);

            procEnv.ApplyGraphRewriteSequence("(::x,::y,::z,::u,::v)=foo(42, 3.141, Enu::hurz, \"S21-heiteitei\", true)");
            procEnv.ApplyGraphRewriteSequence("filterBase\\f1");
        }
Example #2
0
        // Have a look at the .gm + .grg, the ExternalFiltersAndSequencesActionsExternalFunctions.cs,
        // and the ExternalFiltersAndSequencesActionsExternalFunctionsImpl.cs files.
        // They show how to declare external match filters and external sequences in the rules file,
        // and how to use them in the sequences in the rule file or the shell script file.
        // The generated XXXExternalFunctions.cs file contains the partial classes of the filters and sequences
        // and the manually coded XXXExternalFunctionsImpl.cs file exemplifies how to implement these external functions.
        void DoEFS()
        {
            graph   = new ExternalFiltersAndSequencesGraph();
            actions = new ExternalFiltersAndSequencesActions(graph);
            procEnv = new LGSPGraphProcessingEnvironment(graph, actions);

            // use graph rewrite sequence
            procEnv.ApplyGraphRewriteSequence("(::n)=init");

            Console.WriteLine(procEnv.PerformanceInfo.MatchesFound + " matches found.");
            Console.WriteLine(procEnv.PerformanceInfo.RewritesPerformed + " rewrites performed.");
            procEnv.PerformanceInfo.Reset();

            // use new 2.5 exact interface
            IMatchesExact <Rule_r.IMatch_r> matchesExact = actions.r.Match(procEnv, 0);

            Console.WriteLine(matchesExact.Count + " matches found.");
            actions.r.Modify(procEnv, matchesExact.FirstExact);

            procEnv.ApplyGraphRewriteSequence("(::x,::y,::z,::u,::v)=foo(42, 3.141, Enu::hurz, \"S21-heiteitei\", true)");
            procEnv.ApplyGraphRewriteSequence("filterBase\\f1");
        }