コード例 #1
0
ファイル: EvoQL.parser.cs プロジェクト: yonglehou/Bermuda
	void Unary(MultiNodeTree parent, bool? isAsOptional) {
		ExpressionTreeBase addTo = parent; SingleNodeTree condition = null; ConditionalExpression lastOperation = null; 
		while (StartOf(4)) {
			lastOperation = lastOperation ?? new AndCondition();
			MultiAdd(addTo, lastOperation);
			addTo = lastOperation;
			
			if (la.kind == 6 || la.kind == 36) {
				if (la.kind == 6) {
					Get();
				} else {
					Get();
				}
				if (la.kind == 17) {
					Get();
				}
				NotCondition not = new NotCondition(); lastOperation.SetChild(not); lastOperation = not; 
			}
			if (StartOf(6)) {
				Condition(lastOperation, null, isAsOptional);
			} else if (la.kind == 7) {
				ConditionGroup(lastOperation, isAsOptional);
			} else SynErr(45);
			if (la.kind == 13 || la.kind == 14) {
				Operation(out lastOperation);
			}
			else { lastOperation = null; } 
		}
		if (lastOperation != null && lastOperation.Child == null) SemErr("Invalid Condition"); 
	}
コード例 #2
0
ファイル: EvoQL.parser.cs プロジェクト: yonglehou/Bermuda
	void ComplexCondition(SingleNodeTree parent, SelectorExpression selector, bool? isAsOptional) {
		ConditionGroup group = new ConditionGroup(); parent.SetChild(group); ExpressionTreeBase addTo = group; SingleNodeTree condition = null; ConditionalExpression lastOperation = null; 
		Expect(7);
		while (StartOf(4)) {
			lastOperation = lastOperation ?? new AndCondition();
			MultiAdd(addTo, lastOperation);
			addTo = lastOperation;
			var nestedselector = new SelectorExpression(selector.NodeType, selector.Modifier, selector.Left);
			
			if (la.kind == 6 || la.kind == 36) {
				if (la.kind == 6) {
					Get();
				} else {
					Get();
				}
				if (la.kind == 17) {
					Get();
				}
				NotCondition not = new NotCondition(); lastOperation.SetChild(not); lastOperation = not; 
			}
			if (la.kind == 7) {
				ComplexCondition(lastOperation, nestedselector, isAsOptional);
			} else if (StartOf(6)) {
				Condition(lastOperation, nestedselector, isAsOptional);
			} else SynErr(56);
			if (la.kind == 13 || la.kind == 14) {
				Operation(out lastOperation);
			}
			else { lastOperation = null; } 
		}
		Expect(8);
	}