Пример #1
0
        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
            });
        }
Пример #2
0
        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");
            }
        }
Пример #3
0
 public PListElement(string key, PListValue value, params PListAttribute[] attrs)
     : this(key, value)
 {
     //@todo attrs
 }
Пример #4
0
 public PListElement(string key, PListValue value)
     : this(key)
 {
     this.Value = value;
 }
Пример #5
0
 public PListNode(PListString key, PListValue val)
 {
     Key   = key;
     Value = val;
 }