public override DeclareStatement Execute()
        {
            if (Tokenizer.HasMoreTokens)
            {
                var parser = new VariableDefinitionParser(Tokenizer);
                _statement.Definitions = parser.Execute();
            }

            if (_statement.Definitions.Count == 0)
            {
                throw new SyntaxException("DECLARE requires at least one variable declaration");
            }

            return(_statement);
        }
예제 #2
0
        public override CreateProcedureStatement Execute()
        {
            _statement = new CreateProcedureStatement()
            {
                Name = GetDotNotationIdentifier(), IsAlter = IsAlter, IsShortForm = IsShortForm
            };

            if (!Tokenizer.IsNextToken(Constants.As))
            {
                var parser = new VariableDefinitionParser(Tokenizer);

                if (Tokenizer.IsNextToken(Constants.OpenBracket))
                {
                    using (Tokenizer.ExpectBrackets())
                    {
                        _statement.Arguments = parser.Execute();

                        if (_statement.Arguments.Count == 0)
                        {
                            throw new SyntaxException("expected 1 or more arguments");
                        }
                    }
                    _statement.HasBracketedArguments = true;
                }
                else
                {
                    _statement.Arguments = parser.Execute();
                }
            }

            ExpectToken(Constants.As);

            _statement.Definition = ParserFactory.Execute(Tokenizer, true).Single();

            return(_statement);
        }