Esempio n. 1
0
 public override void WriteContents(TextParserWriterArgs args, GroupParser parser, string name)
 {
     base.WriteContents(args, parser, name);
     if (parser.Start != null)
     {
         args.Output.WriteLine("{0}.Start = {1};", name, args.Write(parser.Start));
     }
     if (parser.End != null)
     {
         args.Output.WriteLine("{0}.End = {1};", name, args.Write(parser.End));
     }
     if (parser.Line != null)
     {
         args.Output.WriteLine("{0}.Line = {1};", name, args.Write(parser.Line));
     }
 }
Esempio n. 2
0
 public override void WriteContents(TextParserWriterArgs args, ListParser parser, string name)
 {
     foreach (var item in parser.Items)
     {
         args.Write(item);
     }
 }
Esempio n. 3
0
        public override void WriteContents(TextParserWriterArgs args, T parser, string name)
        {
            base.WriteContents(args, parser, name);
            var items = new List <string>(parser.Items.Select(r => r != null ? args.Write(r) : "null"));

            args.Output.WriteLine("{0}.Items.AddRange(new Eto.Parse.Parser[] {{ {1} }});", name, string.Join(", ", items));
        }
Esempio n. 4
0
 public override void WriteObject(TextParserWriterArgs args, SequenceParser parser, string name)
 {
     base.WriteObject(args, parser, name);
     if (parser.Separator != null)
     {
         args.Output.WriteLine("{0}.Separator = {1};", name, args.Write(parser.Separator));
     }
 }
Esempio n. 5
0
 public override void WriteContents(TextParserWriterArgs args, ExceptParser parser, string name)
 {
     base.WriteContents(args, parser, name);
     if (parser.Except != null)
     {
         args.Output.WriteLine("{0}.Except = {1};", name, args.Write(parser.Except));
     }
 }
Esempio n. 6
0
 public override void WriteObject(TextParserWriterArgs args, RepeatParser parser, string name)
 {
     base.WriteObject(args, parser, name);
     args.Output.WriteLine("{0}.Minimum = {1};", name, parser.Minimum);
     if (parser.Maximum != Int32.MaxValue)
     {
         args.Output.WriteLine("{0}.Maximum = {1};", name, parser.Maximum);
     }
     if (parser.Until != null)
     {
         args.Output.WriteLine("{0}.Until = {1};", name, args.Write(parser.Until));
     }
     if (parser.Separator != null)
     {
         args.Output.WriteLine("{0}.Separator = {1};", name, args.Write(parser.Separator));
     }
 }
Esempio n. 7
0
 public override void WriteContents(TextParserWriterArgs args, T parser, string name)
 {
     base.WriteContents(args, parser, name);
     if (parser.Inner != null)
     {
         var child = args.Write(parser.Inner);
         args.Output.WriteLine("{0}.Inner = {1};", name, child);
     }
 }
Esempio n. 8
0
        public override void WriteContents(TextParserWriterArgs args, ListParser parser, string name)
        {
            var count = parser.Items.Count;

            for (int i = 0; i < count; i++)
            {
                var item = parser.Items[i];
                args.Write(item);
            }
        }
Esempio n. 9
0
        public override void WriteContents(TextParserWriterArgs args, T parser, string name)
        {
            base.WriteContents(args, parser, name);
            var items = new List <string>();

            foreach (var r in parser.Items)
            {
                var child = r != null?args.Write(r) : "null";

                items.Add(child);
            }
            ;
            args.Output.WriteLine("{0}.Items.AddRange(new Eto.Parse.Parser[] {{ {1} }});", name, string.Join(", ", items));
        }
Esempio n. 10
0
        public override void WriteContents(TextParserWriterArgs args, StringParser parser, string name)
        {
            base.WriteContents(args, parser, name);

            string quoteChars = null;

            if (parser.QuoteCharacters == null)
            {
                quoteChars = "null";
            }
            else if (parser.QuoteCharacters.Length != 2 || parser.QuoteCharacters[0] != '\"' || parser.QuoteCharacters[0] != '\'')
            {
                quoteChars = string.Format("new char[] {{ {0} }}", string.Join(", ", parser.QuoteCharacters.Select(r => string.Format("(char)0x{0:x}", (int)r))));
            }
            if (quoteChars != null)
            {
                args.Output.WriteLine("{0}.QuoteCharacters = {1};", name, quoteChars);
            }

            if (parser.AllowEscapeCharacters)
            {
                args.Output.WriteLine("{0}.AllowEscapeCharacters = {1};", name, parser.AllowEscapeCharacters.ToString().ToLower());
            }

            if (parser.AllowDoubleQuote)
            {
                args.Output.WriteLine("{0}.AllowDoubleQuote = {1};", name, parser.AllowDoubleQuote.ToString().ToLower());
            }

            if (parser.AllowNonQuoted)
            {
                args.Output.WriteLine("{0}.AllowNonQuoted = {1};", name, parser.AllowNonQuoted.ToString().ToLower());
            }

            if (parser.NonQuotedLetter == null || parser.NonQuotedLetter is CharTerminal)
            {
                args.Output.WriteLine("{0}.NonQuotedLetter = {1};", name, args.Write(parser.NonQuotedLetter));
            }
        }
Esempio n. 11
0
 public override void WriteContents(TextParserWriterArgs args, T parser, string name)
 {
     args.Write(parser.Inner);
 }
Esempio n. 12
0
 public override void WriteContents(TextParserWriterArgs args, ListParser parser, string name)
 {
     parser.Items.ForEach(r => args.Write(r));
 }