示例#1
0
        public static IList <TomlKey> Apply(TokenBuffer tokens)
        {
            List <TomlKey> keyChain = new List <TomlKey>();
            var            key      = KeyProduction.Apply(tokens);

            keyChain.Add(key);

            while (tokens.TryExpect(TokenType.Dot))
            {
                tokens.Consume();
                keyChain.Add(KeyProduction.TryApply(tokens));
            }

            return(keyChain);
        }
示例#2
0
        public static Tuple <TomlKey, TomlObject> Apply(ITomlRoot root, TokenBuffer tokens)
        {
            var key = KeyProduction.Apply(tokens);

            tokens.ExpectAndConsume(TokenType.Assign);

            var inlineTableArray = InlineTableArrayProduction.TryApply(root, tokens);

            if (inlineTableArray != null)
            {
                return(new Tuple <TomlKey, TomlObject>(key, inlineTableArray));
            }

            var inlineTable = InlineTableProduction.TryApply(root, tokens);

            if (inlineTable != null)
            {
                return(new Tuple <TomlKey, TomlObject>(key, inlineTable));
            }

            var value = ValueProduction.Apply(root, tokens);

            return(Tuple.Create(key, value));
        }