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 }); }
public ForParser() : base("^ /(|tabs| 'for') /b") { parser = new FieldListParser(); freeParser = new FreeParser(); }
public IterateParser() : base("^ /(|tabs| 'iterate') /b") { parser = new FieldListParser(); freeParser = new FreeParser(); }
public ArraySubComprehensionParser() : base($"^ ' '* /({REGEX_VARIABLE})") { fieldListParser = new FieldListParser(); freeParser = new FreeParser(); }
public InnerComprehensionParser() : base($"^ |sp| /({REGEX_VARIABLE})") { fieldListParser = new FieldListParser(); freeParser = new FreeParser(); }