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; }
// Initializes the node after being parsed by the parser. protected internal void SetContents(BinarySelectorToken openingDelimiter, BinarySelectorToken closingDelimiter, KeywordToken apiConvention, IEnumerable<IPrimitiveCallParameterToken> parameters) { this.OpeningDelimiter = openingDelimiter; this.ClosingDelimiter = closingDelimiter; this.ApiConvention = apiConvention; this.ApiParameters.Clear(); foreach (IPrimitiveCallParameterToken param in parameters) this.ApiParameters.Add(param); }
protected virtual KeywordMessageNode ParseKeywordMessage(MessageSequenceNode parent, KeywordToken selector) { // PARSE: <keyword message> ::= (keyword <keyword argument> )+ KeywordMessageNode result = new KeywordMessageNode(parent); List<KeywordToken> selectorTokens = new List<KeywordToken>(); List<KeywordArgumentNode> arguments = new List<KeywordArgumentNode>(); Token token = this.GetNextTokenxx(Preference.NegativeSign); selectorTokens.Add(selector); arguments.Add(this.ParseKeywordArgument(result, token)); // NB: ParseKeywordArgument() may not fail. token = this.GetNextTokenxx(Preference.Default); while (token is KeywordToken) { selectorTokens.Add((KeywordToken)token); token = this.GetNextTokenxx(Preference.NegativeSign); arguments.Add(this.ParseKeywordArgument(result, token)); // NB: ParseKeywordArgument() may not fail. token = this.GetNextTokenxx(Preference.Default); } result.SetContents(selectorTokens, arguments); this.ResidueToken = token; return result; }