Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            //if ((args != null && args.Length > 0) || BuildPerlesqueOverride) {
            var largs = args.ToList();
            //if (largs.Contains("build0") || BuildPerlesqueOverride) {
            //var sw = new Stopwatch();
            //sw.Start();
            var g = Perlesque.BuildPerlesque("perlesque", SaveStage1AssemblyToDisk, SaveStage2AssemblyToDisk);
            //sw.Stop();
            //Console.WriteLine(sw.Elapsed);
            UTF32String input;

            if (RunIndividualTest)
            {
                input = new UTF32String(settingString + System.IO.File.ReadAllText(@"..\..\t\" + TestFileToRun));
            }
            else if (largs.Count > 0)
            {
                if (largs.Count > 1 && args[0] == "-e" && args[1] != "")
                {
                    input = new UTF32String(settingString + args[1]);
                }
                else
                {
                    input = new UTF32String(settingString + System.IO.File.ReadAllText(args[0]));
                }
            }
            else
            {
                input = new UTF32String(settingString +
                                        ""
                                        );
            }
            //sw.Reset();
            //sw.Start();
            var match2 = g.Parse(input);

            //sw.Stop();
            //Console.WriteLine(sw.Elapsed);
            //sw.Reset();
            //sw.Start();
            if (!match2.Success)
            {
                Console.WriteLine("parsefail");
            }
            //for (var i = 10; --i > 0; ) {
            //    g.Parse(input);
            //}

            //Console.WriteLine(sw.Elapsed);
            //}
            //} else {
            //Blah4();
            //Blah7.Run();
            //}
        }
Ejemplo n.º 2
0
        public string Matches(UTF32String input)
        {
            var sb = new StringBuilder();

            Keys.ToList().ForEach((string s) => {
                foreach (var mi in Matches(s))
                {
                    sb.Append(s + ": " + input.ToString().Substring(mi.Start, mi.End - mi.Start) + "\n");
                }
            });
            return(sb.ToString());
        }
Ejemplo n.º 3
0
        public int InjectFileContent(int offset, string injectionFile)
        {
            var innerString     = new UTF32String(";" + File.ReadAllText(injectionFile));
            var innerCodepoints = innerString.Chars;
            var newCodepoints   = new uint[Length + innerString.Length];
            var oldCodepoints   = Chars;

            Array.Copy(oldCodepoints, newCodepoints, offset);
            Array.Copy(innerCodepoints, 0, newCodepoints, offset, innerString.Length);
            if (offset < Length)
            {
                Array.Copy(oldCodepoints, offset, newCodepoints, offset + innerString.Length, Length - offset);
            }
            Length += innerString.Length;
            Chars   = newCodepoints;
            //Console.WriteLine(Match(new Match(null, 0, Length - 1)));
            return(Length);
        }
Ejemplo n.º 4
0
 public string SubStringOf(UTF32String input)
 {
     return(input.Match(this));
 }
Ejemplo n.º 5
0
 public Lookbehind(string target)
 {
     Target      = target;
     UTF32Target = new UTF32String(target);
 }
Ejemplo n.º 6
0
 public Literal(string target)
 {
     Target      = target;
     UTF32Target = new UTF32String(target);
 }
Ejemplo n.º 7
0
 public CircumfixGoal(string goalText, CircumfixGoal parent)
 {
     GoalText = new UTF32String(goalText);
     Parent   = parent;
 }
Ejemplo n.º 8
0
 Match Grammar.IParser.Parse(Matcher M, UTF32String IN, int o, uint b, State s)
 {
     return(null);
 }