private bool ParseListObject(ParseNode parent, InternalParserFunction function) { ParseNode next = new ParseNode("<list_object>"); if (!function(next)) { return(false); } parent.AddChild(next); return(true); }
private bool ParseListMore(ParseNode parent, InternalParserFunction function, string seperator) { ParseNode next = new ParseNode("<list_more>"); if (ConsumePattern(seperator)) { if (!ParseList(next, function, seperator)) { return(false); } } parent.AddChild(next); return(true); }
private bool ParseListMore(ParseNode parent, InternalParserFunction function) { ParseNode next = new ParseNode("<list_more>"); if (ConsumeChar(',')) { if (!ParseList(next, function)) { return(false); } } parent.AddChild(next); return(true); }
/// <summary> /// In form object sepeator object sepeator ... /// </summary> /// <param name="parent"></param> /// <param name="function"></param> /// <param name="seperator"></param> /// <returns></returns> public bool ParseList(ParseNode parent, InternalParserFunction function, string seperator = ",") { ParseNode next = new ParseNode($"<list_{lowerCamelCaseToLowerSeperated(function.Method.Name.Replace("Parse",""))}>"); if (ParseListObject(next, function)) { if (!ParseListMore(next, function, seperator)) { return(false); } } else { next.AddChild(new ParseNode("empty")); } parent.AddChild(next); return(true); }