コード例 #1
0
        protected virtual BinaryArgumentNode ParseBinaryArgument(BinaryMessageNode parent, Token token)
        {
            // PARSE: <binary argument> ::= <primary> <unary message>*
            BinaryArgumentNode result = new BinaryArgumentNode(parent);

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

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

            token = this.GetNextTokenxx(Preference.Default);

            UnaryMessageSequenceNode messages = null;

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

            result.SetContents(primary, messages);
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Visits the Binary Message Argument node.
        /// </summary>
        /// <param name="node">The node to visit.</param>
        public virtual TResult VisitBinaryArgument(BinaryArgumentNode node)
        {
            if (node.Primary != null)
            {
                node.Primary.Accept(this);
            }

            if (node.Messages != null)
            {
                node.Messages.Accept(this);
            }

            return(default(TResult));            // The default naive implementation
        }
コード例 #3
0
        protected virtual BinaryMessageNode ParseBinaryMessage(MessageSequenceBase parent, BinarySelectorToken selector)
        {
            // PARSE: <binary message> ::= binarySelector <binary argument>
            BinaryMessageNode result = new BinaryMessageNode(parent, selector);

            Token token = this.GetNextTokenxx(Preference.NegativeSign);
            // Parse the binary argument ... ParseBinaryArgument() does not fail and reports errors self.
            BinaryArgumentNode argument = this.ParseBinaryArgument(result, token);

            if (argument != null)
            {
                result.SetContents(argument);
            }
            return(result);
        }
コード例 #4
0
        /// <summary>
        /// Visits the Binary Message Argument node.
        /// </summary>
        /// <param name="node">The node to visit.</param>
        public override bool VisitBinaryArgument(BinaryArgumentNode node)
        {
            if (node.Parent == null)
            {
                return(false);
            }

            if ((node.Primary == null) || !node.Primary.Accept(this))
            {
                return(false);
            }
            if ((node.Messages != null) && !node.Messages.Accept(this))
            {
                return(false);
            }

            return(true);
        }
コード例 #5
0
 /// <summary>
 /// Visits the Binary Message Argument node.
 /// </summary>
 /// <param name="node">The node to visit.</param>
 public virtual TResult VisitBinaryArgument(BinaryArgumentNode node)
 {
     throw new NotImplementedException();
 }