コード例 #1
0
        private IMessage ParseDelimitedMessage()
        {
            Token token = this.NextToken();

            while (token != null && token.TokenType == TokenType.Terminator)
            {
                token = this.NextToken();
            }

            if (token == null)
            {
                return(null);
            }

            this.PushToken(token);

            if (IsCommaOrRightParenthesis(token))
            {
                return(null);
            }

            IMessage msg = this.ParseSimpleMessage(true, true);

            token = this.NextToken();

            if (IsTerminator(token))
            {
                this.PushToken(token);
                return(msg);
            }

            if (IsCommaOrRightParenthesis(token))
            {
                this.PushToken(token);
                return(msg);
            }

            this.PushToken(token);

            MessageChain messages = new MessageChain(msg);

            messages.AddMessage(this.ParseSimpleMessage(true, false));

            token = this.NextToken();

            while (!IsTerminator(token))
            {
                this.PushToken(token);

                if (IsCommaOrRightParenthesis(token))
                {
                    break;
                }

                messages.AddMessage(this.ParseSimpleMessage(true, false));
                token = this.NextToken();
            }

            if (IsTerminator(token))
            {
                this.PushToken(token);
            }

            return(messages);
        }