protected virtual MessageSequenceNode ParseMessages(IMessageSequenceParentNode parent, Token token, MessageType type) { // <messages> ::= // (<unary message>+ <binary message>* [<keyword message>] ) | // (<binary message>+ [<keyword message>] ) | // <keyword message> // <unary message> ::= unarySelector // <binary message> ::= binarySelector <binary argument> // <binary argument> ::= <primary> <unary message>* // <keyword message> ::= (keyword <keyword argument> )+ // <keyword argument> ::= <primary> <unary message>* <binary message>* if ((token is IdentifierToken) && ((type & MessageType.Unary) != 0)) { // (<unary message>+ <binary message>* [<keyword message>] ) return(this.ParseUnaryBinaryKeywordMessageSequence(parent, (IdentifierToken)token)); } if ((token is BinarySelectorToken) && ((type & MessageType.Binary) != 0)) { // (<binary message>+ [<keyword message>] ) return(this.ParseBinaryKeywordMessageSequence(parent, (BinarySelectorToken)token)); } if ((token is KeywordToken) && ((type & MessageType.Keyword) != 0)) { // <keyword message> return(this.ParseKeywordMessageSequence(parent, (KeywordToken)token)); } this.ResidueToken = token; // Not for us ... let others give it a try. return(null); }
/// <summary> /// Create a new message sequence. /// </summary> /// <param name="parent">Parent node that defines this parse node.</param> protected MessageSequenceBase(IMessageSequenceParentNode parent) { #if DEBUG if (parent == null) { throw new ArgumentNullException("parent"); } #endif this.Parent = parent; }
protected virtual KeywordMessageSequenceNode ParseKeywordMessageSequence(IMessageSequenceParentNode parent, KeywordToken token) { // PARSE: <keyword message> KeywordMessageSequenceNode result = new KeywordMessageSequenceNode(parent); // NB: ParseKeywordMessage() cannot fail, so we don't check result KeywordMessageNode message = this.ParseKeywordMessage(result, token); result.SetContents(message); return(result); }
protected virtual BinaryMessageSequenceNode ParseBinaryMessageSequence(IMessageSequenceParentNode parent, BinarySelectorToken selector) { // PARSE: <binary message>* BinaryMessageSequenceNode result = new BinaryMessageSequenceNode(parent); // NB: ParseBinaryMessage() cannot fail, so we don't check result BinaryMessageNode message = this.ParseBinaryMessage(result, selector); Token token = this.GetNextTokenxx(Preference.Default); BinaryMessageSequenceNode nextMessage = null; if (token is BinarySelectorToken) { nextMessage = this.ParseBinaryMessageSequence(result, (BinarySelectorToken)token); } else { this.ResidueToken = token; } result.SetContents(message, nextMessage); return(result); }
protected virtual BinaryKeywordMessageSequenceNode ParseBinaryKeywordMessageSequence(IMessageSequenceParentNode parent, BinarySelectorToken selector) { // PARSE: <binary message>+ [<keyword message>] BinaryKeywordMessageSequenceNode result = new BinaryKeywordMessageSequenceNode(parent); // NB: ParseBinaryMessage() cannot fail, so we don't check result BinaryMessageNode message = this.ParseBinaryMessage(result, selector); Token token = this.GetNextTokenxx(Preference.Default); BinaryKeywordOrKeywordMessageSequenceNode nextMessage = (BinaryKeywordOrKeywordMessageSequenceNode) this.ParseMessages(result, token, MessageType.Binary | MessageType.Keyword); result.SetContents(message, nextMessage); return(result); }
protected virtual UnaryBinaryKeywordMessageSequenceNode ParseUnaryBinaryKeywordMessageSequence(IMessageSequenceParentNode parent, IdentifierToken selector) { // PARSE: // <unary message>+ <binary message>* [<keyword message>] UnaryBinaryKeywordMessageSequenceNode result = new UnaryBinaryKeywordMessageSequenceNode(parent); // NB: ParseUnaryMessage() cannot fail, so we don't check result UnaryMessageNode message = this.ParseUnaryMessage(result, selector); Token token = this.GetNextTokenxx(Preference.Default); MessageSequenceNode nextMessage = this.ParseMessages(result, token, MessageType.All); result.SetContents(message, nextMessage); return(result); }
/// <summary> /// Create a new message sequence with a keyword message. /// </summary> /// <param name="parent">Parent node that defines this parse node.</param> protected internal KeywordMessageSequenceNode(IMessageSequenceParentNode parent) : base(parent) { }
/// <summary> /// Create a new message sequence. /// </summary> /// <param name="parent">Parent node that defines this parse node.</param> protected BinaryOrBinaryUnaryMessageSequenceNode(IMessageSequenceParentNode parent) : base(parent) { }
/// <summary> /// Create a new message sequence. /// </summary> /// <param name="parent">Parent node that defines this parse node.</param> protected MessageSequenceNode(IMessageSequenceParentNode parent) : base(parent) { }
/// <summary> /// Create a new message sequence. /// </summary> /// <param name="parent">Parent node that defines this parse node.</param> protected BinaryKeywordOrKeywordMessageSequenceNode(IMessageSequenceParentNode parent) : base(parent) { }
protected virtual UnaryBinaryKeywordMessageSequenceNode ParseUnaryBinaryKeywordMessageSequence(IMessageSequenceParentNode parent, IdentifierToken selector) { // PARSE: // <unary message>+ <binary message>* [<keyword message>] UnaryBinaryKeywordMessageSequenceNode result = new UnaryBinaryKeywordMessageSequenceNode(parent); // NB: ParseUnaryMessage() cannot fail, so we don't check result UnaryMessageNode message = this.ParseUnaryMessage(result, selector); Token token = this.GetNextTokenxx(Preference.Default); MessageSequenceNode nextMessage = this.ParseMessages(result, token, MessageType.All); result.SetContents(message, nextMessage); return result; }
protected virtual MessageSequenceNode ParseMessages(IMessageSequenceParentNode parent, Token token, MessageType type) { // <messages> ::= // (<unary message>+ <binary message>* [<keyword message>] ) | // (<binary message>+ [<keyword message>] ) | // <keyword message> // <unary message> ::= unarySelector // <binary message> ::= binarySelector <binary argument> // <binary argument> ::= <primary> <unary message>* // <keyword message> ::= (keyword <keyword argument> )+ // <keyword argument> ::= <primary> <unary message>* <binary message>* if ((token is IdentifierToken) && ((type & MessageType.Unary) != 0)) // (<unary message>+ <binary message>* [<keyword message>] ) return this.ParseUnaryBinaryKeywordMessageSequence(parent, (IdentifierToken)token); if ((token is BinarySelectorToken) && ((type & MessageType.Binary) != 0)) // (<binary message>+ [<keyword message>] ) return this.ParseBinaryKeywordMessageSequence(parent, (BinarySelectorToken)token); if ((token is KeywordToken) && ((type & MessageType.Keyword) != 0)) // <keyword message> return this.ParseKeywordMessageSequence(parent, (KeywordToken)token); this.ResidueToken = token; // Not for us ... let others give it a try. return null; }
/// <summary> /// Parses a message sequence as defined in X3J20 "3.4.5.3 Messages". /// </summary> /// <param name="parent"></param> /// <param name="token">First token of the message node. If the token is message token, it is returned in the residueToken parameter.</param> /// <returns>Message sequence node or null if the given token is not a message token.</returns> /// <remarks> /// This mehtod does not registers errors if the given token is not a message token. /// The 'offending' token is returned in the residueToken parameter, and it is /// responsibility of the called to determine what to do. /// </remarks> protected virtual MessageSequenceNode ParseMessages(IMessageSequenceParentNode parent, Token token) { return this.ParseMessages(parent, token, MessageType.All); }
protected virtual KeywordMessageSequenceNode ParseKeywordMessageSequence(IMessageSequenceParentNode parent, KeywordToken token) { // PARSE: <keyword message> KeywordMessageSequenceNode result = new KeywordMessageSequenceNode(parent); // NB: ParseKeywordMessage() cannot fail, so we don't check result KeywordMessageNode message = this.ParseKeywordMessage(result, token); result.SetContents(message); return result; }
protected virtual BinaryKeywordMessageSequenceNode ParseBinaryKeywordMessageSequence(IMessageSequenceParentNode parent, BinarySelectorToken selector) { // PARSE: <binary message>+ [<keyword message>] BinaryKeywordMessageSequenceNode result = new BinaryKeywordMessageSequenceNode(parent); // NB: ParseBinaryMessage() cannot fail, so we don't check result BinaryMessageNode message = this.ParseBinaryMessage(result, selector); Token token = this.GetNextTokenxx(Preference.Default); BinaryKeywordOrKeywordMessageSequenceNode nextMessage = (BinaryKeywordOrKeywordMessageSequenceNode) this.ParseMessages(result, token, MessageType.Binary | MessageType.Keyword); result.SetContents(message, nextMessage); return result; }
protected virtual UnaryBinaryMessageSequenceNode ParseUnaryBinaryMessageSequence(IMessageSequenceParentNode parent, IdentifierToken selector) { // PARSE: <unary message>* <binary message>* UnaryBinaryMessageSequenceNode result = new UnaryBinaryMessageSequenceNode(parent); // NB: ParseUnaryMessage() cannot fail, so we don't check result UnaryMessageNode message = this.ParseUnaryMessage(result, selector); Token token = this.GetNextTokenxx(Preference.Default); BinaryOrBinaryUnaryMessageSequenceNode nextMessage = null; if (token is IdentifierToken) // <unary message>* nextMessage = this.ParseUnaryBinaryMessageSequence(result, (IdentifierToken)token); else if (token is BinarySelectorToken) // <binary message>* nextMessage = this.ParseBinaryMessageSequence(result, (BinarySelectorToken)token); else this.ResidueToken = token; result.SetContents(message, nextMessage); return result; }
/// <summary> /// Create a new message sequence. /// </summary> /// <param name="parent">Parent node that defines this parse node.</param> protected MessageSequenceBase(IMessageSequenceParentNode parent) { #if DEBUG if (parent == null) throw new ArgumentNullException("parent"); #endif this.Parent = parent; }
/// <summary> /// Create a new message sequence starting with a unary message. /// </summary> /// <param name="parent">Parent node that defines this parse node.</param> protected internal UnaryMessageSequenceNode(IMessageSequenceParentNode parent) : base(parent) { }
/// <summary> /// Create a new message sequence starting with a binary message. /// </summary> /// <param name="parent">Parent node that defines this parse node.</param> protected internal BinaryKeywordMessageSequenceNode(IMessageSequenceParentNode parent) : base(parent) { }
/// <summary> /// Parses a message sequence as defined in X3J20 "3.4.5.3 Messages". /// </summary> /// <param name="parent"></param> /// <param name="token">First token of the message node. If the token is message token, it is returned in the residueToken parameter.</param> /// <returns>Message sequence node or null if the given token is not a message token.</returns> /// <remarks> /// This method does not registers errors if the given token is not a message token. /// The 'offending' token is returned in the residueToken parameter, and it is /// responsibility of the called to determine what to do. /// </remarks> protected virtual MessageSequenceNode ParseMessages(IMessageSequenceParentNode parent, Token token) { return(this.ParseMessages(parent, token, MessageType.All)); }
/// <summary> /// Create a new message sequence starting with a binary message. /// </summary> /// <param name="parent">Parent node that defines this parse node.</param> protected internal BinaryMessageSequenceNode(IMessageSequenceParentNode parent) : base(parent) { }