public static IList <TomlKey> Apply(TokenBuffer tokens)
        {
            tokens.ExpectAndConsume(TokenType.LBrac);
            tokens.ExpectAndConsume(TokenType.LBrac);

            var key = TableKeyProduction.Apply(tokens);

            tokens.ExpectAndConsume(TokenType.RBrac);
            tokens.ExpectAndConsume(TokenType.RBrac);

            return(key);
        }
Example #2
0
        public static IList <TomlKey> Apply(TokenBuffer tokens)
        {
            tokens.ExpectAndConsume(TokenType.LBrac);
            IList <TomlKey> tableKeyChain = TableKeyProduction.Apply(tokens);

            tokens.ExpectAndConsume(TokenType.RBrac);

            if (!tokens.TryExpectAndConsume(TokenType.NewLine) && !tokens.TryExpectAndConsume(TokenType.Comment) && !tokens.End)
            {
                var msg = $"Expected newline after table specifier. "
                          + $"Token of type '{tokens.Peek().type}' with value '{tokens.Peek().value}' on same line.";
                throw Parser.CreateParseError(tokens.Peek(), msg);
            }

            return(tableKeyChain);
        }