Example #1
0
        protected virtual KeywordArgumentNode ParseKeywordArgument(KeywordMessageNode parent, Token token)
        {
            // PARSE: <keyword argument> ::= <primary> <unary message>* <binary message>*
            KeywordArgumentNode result = new KeywordArgumentNode(parent);

            IPrimaryNode primary = this.ParsePrimary(result, token);

            if (primary == null)
            {
                this.ReportParserError(result, SemanticErrors.MissingPrimary, token);
                return(result);
            }

            token = this.GetNextTokenxx(Preference.Default);

            BinaryOrBinaryUnaryMessageSequenceNode messages = null;

            if (token is IdentifierToken)
            {
                // <unary message>*
                messages = this.ParseUnaryBinaryMessageSequence(result, (IdentifierToken)token);
            }
            else if (token is BinarySelectorToken)
            {
                messages = this.ParseBinaryMessageSequence(result, (BinarySelectorToken)token);
            }
            else
            {
                this.ResidueToken = token;
            }

            result.SetContents(primary, messages);
            return(result);
        }
 /// <summary>
 /// Initializes the node after being parsed by the parser.
 /// </summary>
 /// <param name="primary">Primary of the argument.</param>
 /// <param name="messages">Optional message or a sequence of messages sent to the primary.</param>
 protected internal void SetContents(IPrimaryNode primary, UnaryMessageSequenceNode messages)
 {
     if (primary == null)
     {
         throw new ArgumentNullException("primary");
     }
     this.Primary  = primary;
     this.Messages = messages; // OK if this is null
 }
 /// <summary>
 /// Initializes the node after being parsed by the parser.
 /// </summary>
 /// <param name="primary">The primary, or the receiver of the basic expression.</param>
 /// <param name="messages">Optional message or a sequence of messages sent to the primary of the expression.</param>
 /// <param name="cascadeMessages">Optional cascade messages sent to the primary of the expression.</param>
 protected internal void SetContents(IPrimaryNode primary, MessageSequenceNode messages, CascadeMessageSequenceNode cascadeMessages)
 {
     if (primary == null)
     {
         throw new ArgumentNullException("primary");
     }
     this.Primary         = primary;
     this.Messages        = messages;        // OK with null
     this.CascadeMessages = cascadeMessages; // OK with null
 }
Example #4
0
        protected virtual BasicExpressionNode ParseBasicExpression(SemanticNode parent, Token token)
        {
            // PARSE: <basic expression> ::= <primary> [<messages> <cascaded messages>]
            BasicExpressionNode result = new BasicExpressionNode(parent);

            IPrimaryNode primary = this.ParsePrimary(result, token);

            if (primary == null)
            {
                this.ReportParserError(result, SemanticErrors.MissingPrimary, token);
                return(result);
            }

            token = this.GetNextTokenxx(Preference.Default);
            this.ParseBaseicExpressionMessages(result, primary, token);
            return(result);
        }
 /// <summary>
 /// Initializes the node after being parsed by the parser.
 /// </summary>
 /// <param name="primary">The primary, or the receiver of the basic expression.</param>
 /// <param name="messages">Optional message or a sequence of messages sent to the primary of the expression.</param>
 /// <param name="cascadeMessages">Optional cascade messages sent to the primary of the expression.</param>
 protected internal void SetContents(IPrimaryNode primary, MessageSequenceNode messages, CascadeMessageSequenceNode cascadeMessages)
 {
     if (primary == null)
         throw new ArgumentNullException("primary");
     this.Primary = primary;
     this.Messages = messages; // OK with null
     this.CascadeMessages = cascadeMessages; // OK with null
 }
Example #6
0
        protected virtual void ParseBaseicExpressionMessages(BasicExpressionNode expression, IPrimaryNode primary, Token token)
        {
            MessageSequenceNode messages = this.ParseMessages(expression, token);

            if (messages == null)
            {
                expression.SetContents(primary, null, null);
                return;
            }

            token = this.GetNextTokenxx(Preference.Default);
            CascadeMessageSequenceNode cascadeMessages = this.ParseCascadeMessageSequenceNode(expression, token);

            expression.SetContents(primary, messages, cascadeMessages);
        }
 /// <summary>
 /// Initializes the node after being parsed by the parser.
 /// </summary>
 /// <param name="primary">Primary of the argument.</param>
 /// <param name="messages">Optional message or a sequence of messages sent to the primary.</param>
 protected internal void SetContents(IPrimaryNode primary, BinaryOrBinaryUnaryMessageSequenceNode messages)
 {
     if (primary == null)
         throw new ArgumentNullException("primary");
     this.Primary = primary;
     this.Messages = messages; // null is OK.
 }
Example #8
0
        protected virtual void ParseBaseicExpressionMessages(BasicExpressionNode expression, IPrimaryNode primary, Token token)
        {
            MessageSequenceNode messages = this.ParseMessages(expression, token);
            if (messages == null)
            {
                expression.SetContents(primary, null, null);
                return;
            }

            token = this.GetNextTokenxx(Preference.Default);
            CascadeMessageSequenceNode cascadeMessages = this.ParseCascadeMessageSequenceNode(expression, token);

            expression.SetContents(primary, messages, cascadeMessages);
        }