Пример #1
0
        public override Verb CreateVerb(string[] tokens)
        {
            var visibility = ParseVisibility(tokens[2].Trim());
            var type       = tokens[3];
            var fieldName  = tokens[5];
            var readOnly   = type == "val";

            Color(position, tokens[1].Length, Whitespaces);
            Color(tokens[2].Length, KeyWords);
            Color(type.Length, KeyWords);
            Color(tokens[4].Length, Whitespaces);
            Color(fieldName.Length, Variables);
            if (parser.Scan(source, NextPosition, "^ /s* ','"))
            {
                var fieldListParser = new FieldListParser();
                if (fieldListParser.Parse(source, parser.Position).If(out var fieldNames, out var index))
                {
                    overridePosition = index;
                    var fields = new string[fieldNames.Length + 1];
                    System.Array.Copy(fieldNames, 0, fields, 1, fieldNames.Length);
                    fields[0] = fieldName;
                    return(new CreateFields(readOnly, fields, visibility)
                    {
                        Index = position
                    });
                }
                return(null);
            }
            return(new CreateField(readOnly, fieldName, visibility)
            {
                Index = position
            });
        }
Пример #2
0
 public ForParser()
     : base("^ /(|tabs| 'for') /b")
 {
     parser     = new FieldListParser();
     freeParser = new FreeParser();
 }
Пример #3
0
 public IterateParser() : base("^ /(|tabs| 'iterate') /b")
 {
     parser     = new FieldListParser();
     freeParser = new FreeParser();
 }
Пример #4
0
 public ArraySubComprehensionParser()
     : base($"^ ' '* /({REGEX_VARIABLE})")
 {
     fieldListParser = new FieldListParser();
     freeParser      = new FreeParser();
 }
Пример #5
0
 public InnerComprehensionParser()
     : base($"^ |sp| /({REGEX_VARIABLE})")
 {
     fieldListParser = new FieldListParser();
     freeParser      = new FreeParser();
 }