Esempio n. 1
0
		/// <summary>
		/// Matches a <c>ExpressionList</c> non-terminal.
		/// </summary>
		/// <returns><c>true</c> if the <c>ExpressionList</c> was matched successfully; otherwise, <c>false</c>.</returns>
		/// <remarks>
		/// The non-terminal can start with: <c>Function</c>, <c>OpenParenthesis</c>, <c>OpenCurlyBrace</c>, <c>Identifier</c>, <c>TripleDot</c>, <c>Nil</c>, <c>False</c>, <c>True</c>, <c>Number</c>, <c>Subtraction</c>, <c>Not</c>, <c>Hash</c>, <c>String</c>.
		/// </remarks>
		protected virtual bool MatchExpressionList(IAstNodeList expressions) {
			Expression expression = null;
			if (!this.MatchExpression(out expression))
				return false;
			expressions.Add( expression );
			while (this.TokenIs(this.LookAheadToken, LuatTokenId.Comma)) {
				if (!this.Match(LuatTokenId.Comma))
					return false;
				if (!this.MatchExpression(out expression))
					return false;
				expressions.Add( expression );
			}
			return true;
		}
Esempio n. 2
0
		/// <summary>
		/// Matches a <c>IdentifierList</c> non-terminal.
		/// </summary>
		/// <returns><c>true</c> if the <c>IdentifierList</c> was matched successfully; otherwise, <c>false</c>.</returns>
		/// <remarks>
		/// The non-terminal can start with: <c>Identifier</c>.
		/// </remarks>
		protected virtual bool MatchIdentifierList(IAstNodeList list) {
			Identifier identifier = null;
			if (!this.MatchIdentifier(out identifier))
				return false;
			list.Add( identifier );
			while (this.TokenIs(this.LookAheadToken, LuatTokenId.Comma)) {
				if (!this.Match(LuatTokenId.Comma))
					return false;
				if (!this.MatchIdentifier(out identifier))
					return false;
				list.Add( identifier );
			}
			return true;
		}
Esempio n. 3
0
		/// <summary>
		/// Matches a <c>VariableList</c> non-terminal.
		/// </summary>
		/// <returns><c>true</c> if the <c>VariableList</c> was matched successfully; otherwise, <c>false</c>.</returns>
		/// <remarks>
		/// The non-terminal can start with: <c>Identifier</c>.
		/// </remarks>
		protected virtual bool MatchVariableList(IAstNodeList variables) {
			Expression variable;
			if (!this.MatchVariable(out variable))
				return false;
			variables.Add( variable );
			while (this.TokenIs(this.LookAheadToken, LuatTokenId.Comma)) {
				if (!this.Match(LuatTokenId.Comma))
					return false;
				if (!this.MatchVariable(out variable))
					return false;
				variables.Add( variable );
			}
			return true;
		}
Esempio n. 4
0
		/// <summary>
		/// Matches a <c>FieldList</c> non-terminal.
		/// </summary>
		/// <returns><c>true</c> if the <c>FieldList</c> was matched successfully; otherwise, <c>false</c>.</returns>
		/// <remarks>
		/// The non-terminal can start with: <c>Function</c>, <c>OpenParenthesis</c>, <c>OpenCurlyBrace</c>, <c>OpenSquareBracket</c>, <c>Identifier</c>, <c>TripleDot</c>, <c>Nil</c>, <c>False</c>, <c>True</c>, <c>Number</c>, <c>Subtraction</c>, <c>Not</c>, <c>Hash</c>, <c>String</c>.
		/// </remarks>
		protected virtual bool MatchFieldList(IAstNodeList fields) {
			Field field;
			if (!this.MatchField(out field))
				return false;
			fields.Add( field );
			if (((this.TokenIs(this.LookAheadToken, LuatTokenId.SemiColon)) || (this.TokenIs(this.LookAheadToken, LuatTokenId.Comma)))) {
				if (!this.MatchFieldSep())
					return false;
				if (this.IsInMultiMatchSet(4, this.LookAheadToken)) {
					if (!this.MatchFieldList(fields))
						return false;
				}
			}
			return true;
		}