Beispiel #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);
        }
        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(";");
        }
Beispiel #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);
        }
Beispiel #4
0
 static void ParseEnumValueOptions(string key, string val, ProtoEnumValue f)
 {
     //TODO
 }
Beispiel #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(";");
        }
 static void ParseEnumValueOptions(string key, string val, ProtoEnumValue f)
 {
     //TODO
 }