Ejemplo n.º 1
0
        public virtual bool EscapeChar(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
        {
            OMetaList <HostExpression> c = null;

            modifiedStream = inputStream;
            if (!MetaRules.Apply(
                    delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\\").AsHostExpressionList()))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                if (!MetaRules.Apply(Character, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                c = result2;
                result2 = (c).AsHostExpressionList();
                return(MetaRules.Success());
            }, modifiedStream, out result, out modifiedStream))
            {
                return(MetaRules.Fail(out result, out modifiedStream));
            }
            return(MetaRules.Success());
        }
Ejemplo n.º 2
0
        public virtual bool FullFile(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
        {
            OMetaList <HostExpression> files = null;

            modifiedStream = inputStream;
            if (!MetaRules.Apply(
                    delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.Many1(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Apply(FileStats, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    return(MetaRules.Success());
                }
                        , modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                files = result2;
                result2 = (files).AsHostExpressionList();
                return(MetaRules.Success());
            }, modifiedStream, out result, out modifiedStream))
            {
                return(MetaRules.Fail(out result, out modifiedStream));
            }
            return(MetaRules.Success());
        }
Ejemplo n.º 3
0
 public virtual bool FileStats(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> lines = null;
     OMetaList<HostExpression> name = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Apply(LineStats, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             lines = result2;
             if(!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\t").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(Filename, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             name = result2;
             if(!MetaRules.Apply(NewLine, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             result2 = ( new FileStats(lines[0].As<int>(), lines[1].As<int>(), name.As<string>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 4
0
 public virtual bool AdditionSnippet(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> lines = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(AdditionLine, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             lines = result2;
             result2 = ( new AdditionSnippet(lines.ToIEnumerable<ILine>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 5
0
 public virtual bool AdditionLine(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> value = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.ApplyWithArgs(Token, modifiedStream2, out result2, out modifiedStream2, ("+").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(Line, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             value = result2;
             result2 = ( new AdditionLine(value.As<string>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 6
0
        public virtual bool LineStats(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
        {
            OMetaList <HostExpression> adds = null;
            OMetaList <HostExpression> subs = null;

            modifiedStream = inputStream;
            if (!MetaRules.Apply(
                    delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.Apply(Number, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                adds = result2;
                if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\t").AsHostExpressionList()))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                if (!MetaRules.Apply(Number, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                subs = result2;
                result2 = (Sugar.Cons(adds, subs)).AsHostExpressionList();
                return(MetaRules.Success());
            }, modifiedStream, out result, out modifiedStream))
            {
                return(MetaRules.Fail(out result, out modifiedStream));
            }
            return(MetaRules.Success());
        }
Ejemplo n.º 7
0
    static int Main()
    {
        var f = new OMetaParser();
        var m = typeof(OMetaParser).GetMethod("NameFirst");

        var arg0 = new OMetaStream <char> ();
        var arg1 = new OMetaList <HostExpression> ();

        bool res = (bool)m.Invoke(f, new object[] { arg0, arg1 });

        return(res ? 0 : 1);
    }
Ejemplo n.º 8
0
        public virtual bool Filename(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
        {
            OMetaList <HostExpression> name = null;
            OMetaList <HostExpression> ext  = null;

            modifiedStream = inputStream;
            if (!MetaRules.Apply(
                    delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.Many1(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Apply(LetterOrDigit, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    return(MetaRules.Success());
                }
                        , modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                name = result2;
                if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, (".").AsHostExpressionList()))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                if (!MetaRules.Many1(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Apply(LetterOrDigit, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    return(MetaRules.Success());
                }
                        , modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                ext = result2;
                result2 = (name.As <string>() + "." + ext.As <string>()).AsHostExpressionList();
                return(MetaRules.Success());
            }, modifiedStream, out result, out modifiedStream))
            {
                return(MetaRules.Fail(out result, out modifiedStream));
            }
            return(MetaRules.Success());
        }
Ejemplo n.º 9
0
 public virtual bool Filename(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> name = null;
     OMetaList<HostExpression> ext = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(LetterOrDigit, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             name = result2;
             if(!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, (".").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(LetterOrDigit, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             ext = result2;
             result2 = ( name.As<string>() + "." + ext.As<string>() ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 10
0
 public virtual bool AnyLine(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(ContextLine, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(AdditionLine, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(SubtractionLine, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(NoNewLineAtEOFLine, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 11
0
 public virtual bool Number(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     modifiedStream = inputStream;
     if (!MetaRules.Many1(
             delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if (!MetaRules.Apply(Digit, modifiedStream2, out result2, out modifiedStream2))
         {
             return(MetaRules.Fail(out result2, out modifiedStream2));
         }
         return(MetaRules.Success());
     }
             , modifiedStream, out result, out modifiedStream))
     {
         return(MetaRules.Fail(out result, out modifiedStream));
     }
     return(MetaRules.Success());
 }
Ejemplo n.º 12
0
        public virtual bool List(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
        {
            OMetaList <HostExpression> xs = null;

            modifiedStream = inputStream;
            if (!MetaRules.Apply(
                    delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("(").AsHostExpressionList()))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                if (!MetaRules.Many(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Apply(SExpression, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    return(MetaRules.Success());
                }
                        , modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                xs = result2;
                if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, (")").AsHostExpressionList()))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                result2 = (new SExprList(xs.ToIEnumerable <ISExpression>())).AsHostExpressionList();
                return(MetaRules.Success());
            }, modifiedStream, out result, out modifiedStream))
            {
                return(MetaRules.Fail(out result, out modifiedStream));
            }
            return(MetaRules.Success());
        }
Ejemplo n.º 13
0
 public virtual bool NewLine(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     modifiedStream = inputStream;
     if (!MetaRules.Apply(
             delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\r").AsHostExpressionList()))
         {
             return(MetaRules.Fail(out result2, out modifiedStream2));
         }
         if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\n").AsHostExpressionList()))
         {
             return(MetaRules.Fail(out result2, out modifiedStream2));
         }
         return(MetaRules.Success());
     }, modifiedStream, out result, out modifiedStream))
     {
         return(MetaRules.Fail(out result, out modifiedStream));
     }
     return(MetaRules.Success());
 }
Ejemplo n.º 14
0
        public virtual bool FileStats(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
        {
            OMetaList <HostExpression> lines = null;
            OMetaList <HostExpression> name  = null;

            modifiedStream = inputStream;
            if (!MetaRules.Apply(
                    delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.Apply(LineStats, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                lines = result2;
                if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\t").AsHostExpressionList()))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                if (!MetaRules.Apply(Filename, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                name = result2;
                if (!MetaRules.Apply(NewLine, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                result2 = (new FileStats(lines[0].As <int>(), lines[1].As <int>(), name.As <string>())).AsHostExpressionList();
                return(MetaRules.Success());
            }, modifiedStream, out result, out modifiedStream))
            {
                return(MetaRules.Fail(out result, out modifiedStream));
            }
            return(MetaRules.Success());
        }
Ejemplo n.º 15
0
 public virtual bool ChangeRange(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> line = null;
     OMetaList<HostExpression> affected = null;
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Or(modifiedStream3, out result3, out modifiedStream3,
                 delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                 {
                     modifiedStream4 = inputStream4;
                     if(!MetaRules.ApplyWithArgs(Token, modifiedStream4, out result4, out modifiedStream4, ("+").AsHostExpressionList()))
                     {
                         return MetaRules.Fail(out result4, out modifiedStream4);
                     }
                     return MetaRules.Success();
                 }
                 ,delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                 {
                     modifiedStream4 = inputStream4;
                     if(!MetaRules.ApplyWithArgs(Token, modifiedStream4, out result4, out modifiedStream4, ("-").AsHostExpressionList()))
                     {
                         return MetaRules.Fail(out result4, out modifiedStream4);
                     }
                     return MetaRules.Success();
                 }
                 ))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Number, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 line = result3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, (",").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Number, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 affected = result3;
                 result3 = ( new ChangeRange(line.As<int>(), affected.As<int>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Or(modifiedStream3, out result3, out modifiedStream3,
                 delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                 {
                     modifiedStream4 = inputStream4;
                     if(!MetaRules.ApplyWithArgs(Token, modifiedStream4, out result4, out modifiedStream4, ("+").AsHostExpressionList()))
                     {
                         return MetaRules.Fail(out result4, out modifiedStream4);
                     }
                     return MetaRules.Success();
                 }
                 ,delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                 {
                     modifiedStream4 = inputStream4;
                     if(!MetaRules.ApplyWithArgs(Token, modifiedStream4, out result4, out modifiedStream4, ("-").AsHostExpressionList()))
                     {
                         return MetaRules.Fail(out result4, out modifiedStream4);
                     }
                     return MetaRules.Success();
                 }
                 ))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Number, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 line = result3;
                 result3 = ( new ChangeRange(line.As<int>(), 1) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 16
0
 public virtual bool Diffs(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> diffs = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(
                         delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                         {
                             modifiedStream4 = inputStream4;
                             if(!MetaRules.Or(modifiedStream4, out result4, out modifiedStream4,
                             delegate(OMetaStream<char> inputStream5, out OMetaList<HostExpression> result5, out OMetaStream <char> modifiedStream5)
                             {
                                 modifiedStream5 = inputStream5;
                                 if(!MetaRules.Apply(NewLine, modifiedStream5, out result5, out modifiedStream5))
                                 {
                                     return MetaRules.Fail(out result5, out modifiedStream5);
                                 }
                                 return MetaRules.Success();
                             }
                             ,delegate(OMetaStream<char> inputStream5, out OMetaList<HostExpression> result5, out OMetaStream <char> modifiedStream5)
                             {
                                 modifiedStream5 = inputStream5;
                                 if(!MetaRules.Apply(Empty, modifiedStream5, out result5, out modifiedStream5))
                                 {
                                     return MetaRules.Fail(out result5, out modifiedStream5);
                                 }
                                 return MetaRules.Success();
                             }
                             ))
                             {
                                 return MetaRules.Fail(out result4, out modifiedStream4);
                             }
                             if(!MetaRules.Apply(Diff, modifiedStream4, out result4, out modifiedStream4))
                             {
                                 return MetaRules.Fail(out result4, out modifiedStream4);
                             }
                             return MetaRules.Success();
                         }, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             diffs = result2;
             result2 = ( diffs ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 17
0
 public virtual bool FullFile(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> files = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(FileStats, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             files = result2;
             result2 = ( files ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 18
0
 public virtual bool CopyRenameHeader(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> transaction = null;
     OMetaList<HostExpression> direction = null;
     OMetaList<HostExpression> filename = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Or(modifiedStream2, out result2, out modifiedStream2,
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("copy").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ,delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("rename").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             transaction = result2;
             if(!MetaRules.Apply(Space, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Or(modifiedStream2, out result2, out modifiedStream2,
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("from").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ,delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("to").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             direction = result2;
             if(!MetaRules.Apply(Space, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(Text, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             filename = result2;
             result2 = ( new CopyRenameHeader(transaction.As<string>(), direction.As<string>(), filename.As<string>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 19
0
 public virtual bool DiffHeader(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> format = null;
     OMetaList<HostExpression> rawFileDefs = null;
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("diff").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Space, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(DiffFormatType, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 format = result3;
                 if(!MetaRules.Apply(Space, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Text, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 rawFileDefs = result3;
                 result3 = ( new DiffHeader(format.As<DiffFormatType>(), rawFileDefs.As<string>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("diff").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Space, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(DiffFormatType, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 format = result3;
                 result3 = ( new DiffHeader(format.As<DiffFormatType>(), (string)null) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 20
0
 public virtual bool NewLine(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\r").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\n").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 21
0
 public virtual bool ContextSnippet(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> lines = null;
     OMetaList<HostExpression> eof = null;
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Many1(
                     delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                     {
                         modifiedStream4 = inputStream4;
                         if(!MetaRules.Apply(ContextLine, modifiedStream4, out result4, out modifiedStream4))
                         {
                             return MetaRules.Fail(out result4, out modifiedStream4);
                         }
                         return MetaRules.Success();
                     }
                 , modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 lines = result3;
                 if(!MetaRules.Apply(NoNewLineAtEOFLine, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 eof = result3;
                 result3 = ( new ContextSnippet(lines.ToIEnumerable<ILine>().Concat(new ILine[]{eof.As<ILine>()})) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Many1(
                     delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                     {
                         modifiedStream4 = inputStream4;
                         if(!MetaRules.Apply(ContextLine, modifiedStream4, out result4, out modifiedStream4))
                         {
                             return MetaRules.Fail(out result4, out modifiedStream4);
                         }
                         return MetaRules.Success();
                     }
                 , modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 lines = result3;
                 result3 = ( new ContextSnippet(lines.ToIEnumerable<ILine>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 22
0
 public virtual bool Filename(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> filename = null;
     OMetaList<HostExpression> extension = null;
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Many1(
                     delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                     {
                         modifiedStream4 = inputStream4;
                         if(!MetaRules.Apply(
                             delegate(OMetaStream<char> inputStream5, out OMetaList<HostExpression> result5, out OMetaStream <char> modifiedStream5)
                             {
                                 modifiedStream5 = inputStream5;
                                 if(!MetaRules.Not(
                                     delegate(OMetaStream<char> inputStream6, out OMetaList<HostExpression> result6, out OMetaStream <char> modifiedStream6)
                                     {
                                         modifiedStream6 = inputStream6;
                                         if(!MetaRules.Apply(Space, modifiedStream6, out result6, out modifiedStream6))
                                         {
                                             return MetaRules.Fail(out result6, out modifiedStream6);
                                         }
                                         return MetaRules.Success();
                                     }
                                 , modifiedStream5, out result5, out modifiedStream5))
                                 {
                                     return MetaRules.Fail(out result5, out modifiedStream5);
                                 }
                                 if(!MetaRules.Not(
                                     delegate(OMetaStream<char> inputStream6, out OMetaList<HostExpression> result6, out OMetaStream <char> modifiedStream6)
                                     {
                                         modifiedStream6 = inputStream6;
                                         if(!MetaRules.Apply(NewLine, modifiedStream6, out result6, out modifiedStream6))
                                         {
                                             return MetaRules.Fail(out result6, out modifiedStream6);
                                         }
                                         return MetaRules.Success();
                                     }
                                 , modifiedStream5, out result5, out modifiedStream5))
                                 {
                                     return MetaRules.Fail(out result5, out modifiedStream5);
                                 }
                                 if(!MetaRules.Apply(Character, modifiedStream5, out result5, out modifiedStream5))
                                 {
                                     return MetaRules.Fail(out result5, out modifiedStream5);
                                 }
                                 return MetaRules.Success();
                             }, modifiedStream4, out result4, out modifiedStream4))
                         {
                             return MetaRules.Fail(out result4, out modifiedStream4);
                         }
                         return MetaRules.Success();
                     }
                 , modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 filename = result3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, (".").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Many1(
                     delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                     {
                         modifiedStream4 = inputStream4;
                         if(!MetaRules.Apply(LetterOrDigit, modifiedStream4, out result4, out modifiedStream4))
                         {
                             return MetaRules.Fail(out result4, out modifiedStream4);
                         }
                         return MetaRules.Success();
                     }
                 , modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 extension = result3;
                 result3 = ( filename + "." + extension ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Many1(
                     delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                     {
                         modifiedStream4 = inputStream4;
                         if(!MetaRules.Apply(
                             delegate(OMetaStream<char> inputStream5, out OMetaList<HostExpression> result5, out OMetaStream <char> modifiedStream5)
                             {
                                 modifiedStream5 = inputStream5;
                                 if(!MetaRules.Not(
                                     delegate(OMetaStream<char> inputStream6, out OMetaList<HostExpression> result6, out OMetaStream <char> modifiedStream6)
                                     {
                                         modifiedStream6 = inputStream6;
                                         if(!MetaRules.Apply(Space, modifiedStream6, out result6, out modifiedStream6))
                                         {
                                             return MetaRules.Fail(out result6, out modifiedStream6);
                                         }
                                         return MetaRules.Success();
                                     }
                                 , modifiedStream5, out result5, out modifiedStream5))
                                 {
                                     return MetaRules.Fail(out result5, out modifiedStream5);
                                 }
                                 if(!MetaRules.Not(
                                     delegate(OMetaStream<char> inputStream6, out OMetaList<HostExpression> result6, out OMetaStream <char> modifiedStream6)
                                     {
                                         modifiedStream6 = inputStream6;
                                         if(!MetaRules.Apply(NewLine, modifiedStream6, out result6, out modifiedStream6))
                                         {
                                             return MetaRules.Fail(out result6, out modifiedStream6);
                                         }
                                         return MetaRules.Success();
                                     }
                                 , modifiedStream5, out result5, out modifiedStream5))
                                 {
                                     return MetaRules.Fail(out result5, out modifiedStream5);
                                 }
                                 if(!MetaRules.Apply(Character, modifiedStream5, out result5, out modifiedStream5))
                                 {
                                     return MetaRules.Fail(out result5, out modifiedStream5);
                                 }
                                 return MetaRules.Success();
                             }, modifiedStream4, out result4, out modifiedStream4))
                         {
                             return MetaRules.Fail(out result4, out modifiedStream4);
                         }
                         return MetaRules.Success();
                     }
                 , modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 filename = result3;
                 result3 = ( filename ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 23
0
 public virtual bool NoNewLineAtEOFLine(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Exactly, modifiedStream3, out result3, out modifiedStream3, ("\\").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Space, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("No newline at end of file").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(NewLine, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 result3 = ( new NoNewLineAtEOFLine() ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Exactly, modifiedStream3, out result3, out modifiedStream3, ("\\").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Space, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("No newline at end of file").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 result3 = ( new NoNewLineAtEOFLine() ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 24
0
        public virtual bool SExpression(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
        {
            OMetaList <HostExpression> a = null;
            OMetaList <HostExpression> l = null;

            modifiedStream = inputStream;
            if (!MetaRules.Or(modifiedStream, out result, out modifiedStream,
                              delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.Apply(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Apply(Spaces, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    if (!MetaRules.Apply(Atom, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    a = result3;
                    if (!MetaRules.Apply(Spaces, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    result3 = (a).AsHostExpressionList();
                    return(MetaRules.Success());
                }, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                return(MetaRules.Success());
            }
                              , delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.Apply(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Apply(Spaces, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    if (!MetaRules.Apply(List, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    l = result3;
                    if (!MetaRules.Apply(Spaces, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    result3 = (l.As <SExprList>()).AsHostExpressionList();
                    return(MetaRules.Success());
                }, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                return(MetaRules.Success());
            }
                              ))
            {
                return(MetaRules.Fail(out result, out modifiedStream));
            }
            return(MetaRules.Success());
        }
Ejemplo n.º 25
0
 public virtual bool Line(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> value = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Or(modifiedStream2, out result2, out modifiedStream2,
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(Text, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ,delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(
                     delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                     {
                         modifiedStream4 = inputStream4;
                         if(!MetaRules.Apply(Empty, modifiedStream4, out result4, out modifiedStream4))
                         {
                             return MetaRules.Fail(out result4, out modifiedStream4);
                         }
                         result4 = ( "" ).AsHostExpressionList();
                         return MetaRules.Success();
                     }, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             value = result2;
             if(!MetaRules.Apply(NewLine, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             result2 = ( value.As<string>() ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 26
0
 public virtual bool IndexHeader(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> range = null;
     OMetaList<HostExpression> mode = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.ApplyWithArgs(Token, modifiedStream2, out result2, out modifiedStream2, ("index").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(Space, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(HashRange, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             range = result2;
             if(!MetaRules.Apply(Space, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(Number, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             mode = result2;
             result2 = ( new IndexHeader(range.As<HashRange>(), mode.As<int>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 27
0
 public virtual bool HashRange(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> first = null;
     OMetaList<HostExpression> second = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(LetterOrDigit, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             first = result2;
             if(!MetaRules.ApplyWithArgs(Token, modifiedStream2, out result2, out modifiedStream2, ("..").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(LetterOrDigit, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             second = result2;
             result2 = ( new HashRange(first.As<string>(), second.As<string>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 28
0
 public virtual bool Symbol(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     modifiedStream = inputStream;
     if (!MetaRules.Or(modifiedStream, out result, out modifiedStream,
                       delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if (!MetaRules.ApplyWithArgs(FirstAndRest, modifiedStream2, out result2, out modifiedStream2, ("Letter").AsHostExpressionList(), ("LetterOrDigit").AsHostExpressionList()))
         {
             return(MetaRules.Fail(out result2, out modifiedStream2));
         }
         return(MetaRules.Success());
     }
                       , delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("+").AsHostExpressionList()))
         {
             return(MetaRules.Fail(out result2, out modifiedStream2));
         }
         return(MetaRules.Success());
     }
                       , delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("-").AsHostExpressionList()))
         {
             return(MetaRules.Fail(out result2, out modifiedStream2));
         }
         return(MetaRules.Success());
     }
                       , delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("*").AsHostExpressionList()))
         {
             return(MetaRules.Fail(out result2, out modifiedStream2));
         }
         return(MetaRules.Success());
     }
                       , delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("/").AsHostExpressionList()))
         {
             return(MetaRules.Fail(out result2, out modifiedStream2));
         }
         return(MetaRules.Success());
     }
                       , delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("^").AsHostExpressionList()))
         {
             return(MetaRules.Fail(out result2, out modifiedStream2));
         }
         return(MetaRules.Success());
     }
                       ))
     {
         return(MetaRules.Fail(out result, out modifiedStream));
     }
     return(MetaRules.Success());
 }
Ejemplo n.º 29
0
 public virtual bool Text(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> t = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(
                         delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                         {
                             modifiedStream4 = inputStream4;
                             if(!MetaRules.Not(
                                 delegate(OMetaStream<char> inputStream5, out OMetaList<HostExpression> result5, out OMetaStream <char> modifiedStream5)
                                 {
                                     modifiedStream5 = inputStream5;
                                     if(!MetaRules.Apply(NewLine, modifiedStream5, out result5, out modifiedStream5))
                                     {
                                         return MetaRules.Fail(out result5, out modifiedStream5);
                                     }
                                     return MetaRules.Success();
                                 }
                             , modifiedStream4, out result4, out modifiedStream4))
                             {
                                 return MetaRules.Fail(out result4, out modifiedStream4);
                             }
                             if(!MetaRules.Apply(Character, modifiedStream4, out result4, out modifiedStream4))
                             {
                                 return MetaRules.Fail(out result4, out modifiedStream4);
                             }
                             return MetaRules.Success();
                         }, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             t = result2;
             result2 = ( t.As<string>() ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 30
0
 public virtual bool FileDef(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> letter = null;
     OMetaList<HostExpression> filename = null;
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(Space, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Letter, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 letter = result3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("/").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Filename, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 filename = result3;
                 result3 = ( new File(letter.As<char>(), filename.As<string>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(Letter, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 letter = result3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("/").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Filename, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 filename = result3;
                 result3 = ( new File(letter.As<char>(), filename.As<string>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("/dev/null").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 result3 = ( new NullFile() ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 31
0
 public virtual bool Chunk(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> range = null;
     OMetaList<HostExpression> snippets = null;
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(ChunkRange, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 range = result3;
                 if(!MetaRules.Many1(
                     delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                     {
                         modifiedStream4 = inputStream4;
                         if(!MetaRules.Apply(Snippet, modifiedStream4, out result4, out modifiedStream4))
                         {
                             return MetaRules.Fail(out result4, out modifiedStream4);
                         }
                         return MetaRules.Success();
                     }
                 , modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 snippets = result3;
                 if(!MetaRules.Or(modifiedStream3, out result3, out modifiedStream3,
                 delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                 {
                     modifiedStream4 = inputStream4;
                     if(!MetaRules.Apply(NewLine, modifiedStream4, out result4, out modifiedStream4))
                     {
                         return MetaRules.Fail(out result4, out modifiedStream4);
                     }
                     return MetaRules.Success();
                 }
                 ,delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                 {
                     modifiedStream4 = inputStream4;
                     if(!MetaRules.Apply(Empty, modifiedStream4, out result4, out modifiedStream4))
                     {
                         return MetaRules.Fail(out result4, out modifiedStream4);
                     }
                     return MetaRules.Success();
                 }
                 ))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 result3 = ( new Chunk(range.As<ChunkRange>(), snippets.ToIEnumerable<ISnippet>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(ChunkRange, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 range = result3;
                 if(!MetaRules.Or(modifiedStream3, out result3, out modifiedStream3,
                 delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                 {
                     modifiedStream4 = inputStream4;
                     if(!MetaRules.Apply(NewLine, modifiedStream4, out result4, out modifiedStream4))
                     {
                         return MetaRules.Fail(out result4, out modifiedStream4);
                     }
                     return MetaRules.Success();
                 }
                 ,delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                 {
                     modifiedStream4 = inputStream4;
                     if(!MetaRules.Apply(Empty, modifiedStream4, out result4, out modifiedStream4))
                     {
                         return MetaRules.Fail(out result4, out modifiedStream4);
                     }
                     return MetaRules.Success();
                 }
                 ))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 result3 = ( new Chunk(range.As<ChunkRange>(), new List<ISnippet>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 32
0
        public virtual bool Atom(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
        {
            OMetaList <HostExpression> s  = null;
            OMetaList <HostExpression> n  = null;
            OMetaList <HostExpression> sy = null;

            modifiedStream = inputStream;
            if (!MetaRules.Or(modifiedStream, out result, out modifiedStream,
                              delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.Apply(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Apply(String, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    s = result3;
                    result3 = (new SExprAtomString(s.ToString())).AsHostExpressionList();
                    return(MetaRules.Success());
                }, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                return(MetaRules.Success());
            }
                              , delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.Apply(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Apply(Number, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    n = result3;
                    result3 = (new SExprAtomNumber(n.ToString())).AsHostExpressionList();
                    return(MetaRules.Success());
                }, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                return(MetaRules.Success());
            }
                              , delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.Apply(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Apply(Symbol, modifiedStream3, out result3, out modifiedStream3))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    sy = result3;
                    result3 = (new SExprAtomSymbol(sy.ToString())).AsHostExpressionList();
                    return(MetaRules.Success());
                }, modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                return(MetaRules.Success());
            }
                              ))
            {
                return(MetaRules.Fail(out result, out modifiedStream));
            }
            return(MetaRules.Success());
        }
Ejemplo n.º 33
0
 public virtual bool ChunkHeader(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> originalFile = null;
     OMetaList<HostExpression> newFile = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.ApplyWithArgs(Token, modifiedStream2, out result2, out modifiedStream2, ("---").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(FileDef, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             originalFile = result2;
             if(!MetaRules.Apply(NewLine, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.ApplyWithArgs(Token, modifiedStream2, out result2, out modifiedStream2, ("+++").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(FileDef, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             newFile = result2;
             result2 = ( new ChunkHeader(originalFile.As<IFile>(), newFile.As<IFile>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 34
0
 public virtual bool LineStats(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> adds = null;
     OMetaList<HostExpression> subs = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Apply(Number, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             adds = result2;
             if(!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\t").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(Number, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             subs = result2;
             result2 = (Sugar.Cons(adds,subs)).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 35
0
 public virtual bool ChunkRange(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> originalRange = null;
     OMetaList<HostExpression> newRange = null;
     OMetaList<HostExpression> value = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.ApplyWithArgs(Token, modifiedStream2, out result2, out modifiedStream2, ("@@").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(Space, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(ChangeRange, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             originalRange = result2;
             if(!MetaRules.Apply(Space, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(ChangeRange, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             newRange = result2;
             if(!MetaRules.Apply(Space, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.ApplyWithArgs(Token, modifiedStream2, out result2, out modifiedStream2, ("@@").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Or(modifiedStream2, out result2, out modifiedStream2,
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(Text, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ,delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(
                     delegate(OMetaStream<char> inputStream4, out OMetaList<HostExpression> result4, out OMetaStream <char> modifiedStream4)
                     {
                         modifiedStream4 = inputStream4;
                         if(!MetaRules.Apply(Empty, modifiedStream4, out result4, out modifiedStream4))
                         {
                             return MetaRules.Fail(out result4, out modifiedStream4);
                         }
                         result4 = ( "" ).AsHostExpressionList();
                         return MetaRules.Success();
                     }, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             value = result2;
             if(!MetaRules.Or(modifiedStream2, out result2, out modifiedStream2,
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(NewLine, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ,delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(Empty, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 return MetaRules.Success();
             }
             ))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             result2 = ( new ChunkRange(originalRange.As<ChangeRange>(), newRange.As<ChangeRange>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 36
0
 public virtual bool DiffFormatType(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> format = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.ApplyWithArgs(Token, modifiedStream2, out result2, out modifiedStream2, ("--").AsHostExpressionList()))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(LetterOrDigit, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             format = result2;
             result2 = ( new DiffFormatType(format.As<string>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 37
0
        public virtual bool String(OMetaStream <char> inputStream, out OMetaList <HostExpression> result, out OMetaStream <char> modifiedStream)
        {
            OMetaList <HostExpression> s = null;

            modifiedStream = inputStream;
            if (!MetaRules.Apply(
                    delegate(OMetaStream <char> inputStream2, out OMetaList <HostExpression> result2, out OMetaStream <char> modifiedStream2)
            {
                modifiedStream2 = inputStream2;
                if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\"").AsHostExpressionList()))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                if (!MetaRules.Many(
                        delegate(OMetaStream <char> inputStream3, out OMetaList <HostExpression> result3, out OMetaStream <char> modifiedStream3)
                {
                    modifiedStream3 = inputStream3;
                    if (!MetaRules.Or(modifiedStream3, out result3, out modifiedStream3,
                                      delegate(OMetaStream <char> inputStream4, out OMetaList <HostExpression> result4, out OMetaStream <char> modifiedStream4)
                    {
                        modifiedStream4 = inputStream4;
                        if (!MetaRules.Apply(EscapeChar, modifiedStream4, out result4, out modifiedStream4))
                        {
                            return(MetaRules.Fail(out result4, out modifiedStream4));
                        }
                        return(MetaRules.Success());
                    }
                                      , delegate(OMetaStream <char> inputStream4, out OMetaList <HostExpression> result4, out OMetaStream <char> modifiedStream4)
                    {
                        modifiedStream4 = inputStream4;
                        if (!MetaRules.Apply(
                                delegate(OMetaStream <char> inputStream5, out OMetaList <HostExpression> result5, out OMetaStream <char> modifiedStream5)
                        {
                            modifiedStream5 = inputStream5;
                            if (!MetaRules.Not(
                                    delegate(OMetaStream <char> inputStream6, out OMetaList <HostExpression> result6, out OMetaStream <char> modifiedStream6)
                            {
                                modifiedStream6 = inputStream6;
                                if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream6, out result6, out modifiedStream6, ("\"").AsHostExpressionList()))
                                {
                                    return(MetaRules.Fail(out result6, out modifiedStream6));
                                }
                                return(MetaRules.Success());
                            }
                                    , modifiedStream5, out result5, out modifiedStream5))
                            {
                                return(MetaRules.Fail(out result5, out modifiedStream5));
                            }
                            if (!MetaRules.Apply(Character, modifiedStream5, out result5, out modifiedStream5))
                            {
                                return(MetaRules.Fail(out result5, out modifiedStream5));
                            }
                            return(MetaRules.Success());
                        }, modifiedStream4, out result4, out modifiedStream4))
                        {
                            return(MetaRules.Fail(out result4, out modifiedStream4));
                        }
                        return(MetaRules.Success());
                    }
                                      ))
                    {
                        return(MetaRules.Fail(out result3, out modifiedStream3));
                    }
                    return(MetaRules.Success());
                }
                        , modifiedStream2, out result2, out modifiedStream2))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                s = result2;
                if (!MetaRules.ApplyWithArgs(Exactly, modifiedStream2, out result2, out modifiedStream2, ("\"").AsHostExpressionList()))
                {
                    return(MetaRules.Fail(out result2, out modifiedStream2));
                }
                result2 = (s).AsHostExpressionList();
                return(MetaRules.Success());
            }, modifiedStream, out result, out modifiedStream))
            {
                return(MetaRules.Fail(out result, out modifiedStream));
            }
            return(MetaRules.Success());
        }
Ejemplo n.º 38
0
 public virtual bool Diff(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> diffHeader = null;
     OMetaList<HostExpression> headers = null;
     OMetaList<HostExpression> chunksHeader = null;
     OMetaList<HostExpression> chunks = null;
     OMetaList<HostExpression> binaryFiles = null;
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(DiffHeader, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 diffHeader = result3;
                 if(!MetaRules.Apply(NewLine, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Headers, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 headers = result3;
                 if(!MetaRules.Apply(ChunksHeader, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 chunksHeader = result3;
                 if(!MetaRules.Apply(NewLine, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Chunks, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 chunks = result3;
                 result3 = ( new Diff(diffHeader.As<DiffHeader>(), headers.ToIEnumerable<IHeader>(), chunksHeader.As<ChunksHeader>(), chunks.ToIEnumerable<Chunk>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.Apply(DiffHeader, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 diffHeader = result3;
                 if(!MetaRules.Apply(NewLine, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Headers, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 headers = result3;
                 if(!MetaRules.Apply(BinaryFiles, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 binaryFiles = result3;
                 result3 = ( new Diff(diffHeader.As<DiffHeader>(), headers.ToIEnumerable<IHeader>(), binaryFiles.As<BinaryFiles>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 39
0
 public virtual bool Diff(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> header = null;
     OMetaList<HostExpression> chunks = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Apply(Header, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             header = result2;
             if(!MetaRules.Apply(NewLine, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(IndexHeader, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(NewLine, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             if(!MetaRules.Apply(Chunks, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             chunks = result2;
             result2 = ( new Diff(header.As<Header>(), chunks.ToIEnumerable<Chunk>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 40
0
 public override bool Number(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     Rule<char> __baseRule__ = base.Number;
     OMetaList<HostExpression> ds = null;
     modifiedStream = inputStream;
     if(!MetaRules.Apply(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Many1(
                 delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
                 {
                     modifiedStream3 = inputStream3;
                     if(!MetaRules.Apply(Digit, modifiedStream3, out result3, out modifiedStream3))
                     {
                         return MetaRules.Fail(out result3, out modifiedStream3);
                     }
                     return MetaRules.Success();
                 }
             , modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             ds = result2;
             result2 = ( int.Parse(ds.As<string>()) ).AsHostExpressionList();
             return MetaRules.Success();
         }, modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 41
0
 public virtual bool Header(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> format = null;
     OMetaList<HostExpression> files = null;
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("diff").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Space, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(FormatType, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 format = result3;
                 if(!MetaRules.Apply(FileDefs, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 files = result3;
                 result3 = ( new Header(format.As<FormatType>(), files.ToIEnumerable<IFile>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(
             delegate(OMetaStream<char> inputStream3, out OMetaList<HostExpression> result3, out OMetaStream <char> modifiedStream3)
             {
                 modifiedStream3 = inputStream3;
                 if(!MetaRules.ApplyWithArgs(Token, modifiedStream3, out result3, out modifiedStream3, ("diff").AsHostExpressionList()))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(Space, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 if(!MetaRules.Apply(FormatType, modifiedStream3, out result3, out modifiedStream3))
                 {
                     return MetaRules.Fail(out result3, out modifiedStream3);
                 }
                 format = result3;
                 result3 = ( new Header(format.As<FormatType>()) ).AsHostExpressionList();
                 return MetaRules.Success();
             }, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 42
0
 public virtual bool Snippet(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     modifiedStream = inputStream;
     if(!MetaRules.Or(modifiedStream, out result, out modifiedStream,
     delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(ContextSnippet, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(ModificationSnippet, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(AdditionSnippet, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ,delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
     {
         modifiedStream2 = inputStream2;
         if(!MetaRules.Apply(SubtractionSnippet, modifiedStream2, out result2, out modifiedStream2))
         {
             return MetaRules.Fail(out result2, out modifiedStream2);
         }
         return MetaRules.Success();
     }
     ))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     return MetaRules.Success();
 }
Ejemplo n.º 43
0
 public virtual bool Chunks(OMetaStream<char> inputStream, out OMetaList<HostExpression> result, out OMetaStream <char> modifiedStream)
 {
     OMetaList<HostExpression> chunks = null;
     modifiedStream = inputStream;
     if(!MetaRules.Many1(
         delegate(OMetaStream<char> inputStream2, out OMetaList<HostExpression> result2, out OMetaStream <char> modifiedStream2)
         {
             modifiedStream2 = inputStream2;
             if(!MetaRules.Apply(Chunk, modifiedStream2, out result2, out modifiedStream2))
             {
                 return MetaRules.Fail(out result2, out modifiedStream2);
             }
             return MetaRules.Success();
         }
     , modifiedStream, out result, out modifiedStream))
     {
         return MetaRules.Fail(out result, out modifiedStream);
     }
     chunks = result;
     return MetaRules.Success();
 }