Exemplo n.º 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);
        }
Exemplo n.º 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(";");
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 static void ParseEnumValueOptions(string key, string val, ProtoEnumValue f)
 {
     //TODO
 }
Exemplo n.º 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(";");
        }
Exemplo n.º 6
0
 static void ParseEnumValueOptions(string key, string val, ProtoEnumValue f)
 {
     //TODO
 }