示例#1
0
        static void ParseEnumValue(TokenReader tr, ProtoEnum parent, string name)
        {
            if (tr.ReadNext() != "=")
            {
                throw new ProtoFormatException("Expected: =", tr);
            }

            int id = ParseInt(tr);

            var value = new ProtoEnumValue(name, id, lastComment);

            parent.Enums.Add(value);

            string extra = tr.ReadNext();

            if (extra == ";")
            {
                return;
            }

            if (extra != "[")
            {
                throw new ProtoFormatException("Expected: ; or [", tr);
            }

            ParseEnumValueOptions(tr);
        }
示例#2
0
        static void ParseEnumValueOptions(TokenReader tr, ProtoEnumValue evalue)
        {
            while (true)
            {
                string key = tr.ReadNext();
                tr.ReadNextOrThrow("=");
                string val = tr.ReadNext();

                ParseEnumValueOptions(key, val, evalue);
                string optionSep = tr.ReadNext();
                if (optionSep == "]")
                    break;
                if (optionSep == ",")
                    continue;
                throw new ProtoFormatException(@"Expected "","" or ""]"" got " + tr.NextCharacter, tr);
            }
            tr.ReadNextOrThrow(";");
        }
示例#3
0
        static void ParseEnumValue(TokenReader tr, ProtoEnum parent, string name)
        {
            if (tr.ReadNext() != "=")
                throw new ProtoFormatException("Expected: =", tr);

            int id = int.Parse(tr.ReadNext());

            var value = new ProtoEnumValue(name, id, lastComment);
            parent.Enums.Add(value);

            string extra = tr.ReadNext();

            if (extra == ";")
                return;

            if (extra != "[")
                throw new ProtoFormatException("Expected: ; or [", tr);

            ParseEnumValueOptions(tr, value);
        }
示例#4
0
 static void ParseEnumValueOptions(string key, string val, ProtoEnumValue f)
 {
     //TODO
 }
示例#5
0
        static void ParseEnumValueOptions(TokenReader tr, ProtoEnumValue evalue)
        {
            while (true)
            {
                string key = tr.ReadNext();
                tr.ReadNextOrThrow("=");
                string val = tr.ReadNext();

                ParseEnumValueOptions(key, val, evalue);
                string optionSep = tr.ReadNext();
                if (optionSep == "]")
                    break;
                if (optionSep == ",")
                    continue;
                throw new ProtoFormatException(@"Expected "","" or ""]"" got " + tr.NextCharacter, tr);
            }
            tr.ReadNextOrThrow(";");
        }
示例#6
0
 static void ParseEnumValueOptions(string key, string val, ProtoEnumValue f)
 {
     //TODO
 }