private PListNode ReadNode() { if (token.Type != LexemType.String) { throw new Exception("Node key expected"); } PListString key = (PListString)ReadValue(); List <PListAttribute> Attrs = null; if (token.Value == "{") { Attrs = ReadAttributes(); } if (token.Value != "=") { throw new Exception("'=' expected"); } Next(); PListValue val = null; if (token.Value != ";") { val = ReadValue(); if (token.Value != ";") { throw new Exception("';' expected"); } Next(); } return(new PListNode(key, val) { Attributes = Attrs }); }
private PListAttribute ReadAttribute() { if (token.Type != LexemType.String) { throw new Exception("Attribute key expected"); } PListString key = (PListString)ReadValue(); if (token.Value != "=") { throw new Exception("'=' expected"); } Next(); PListValue val = ReadValue(); if (val is PListString) { return(new PListAttribute(key, val as PListString)); } else { throw new Exception("invalid attribute value"); } }
public PListElement(string key, PListValue value, params PListAttribute[] attrs) : this(key, value) { //@todo attrs }
public PListElement(string key, PListValue value) : this(key) { this.Value = value; }
public PListNode(PListString key, PListValue val) { Key = key; Value = val; }