public ILeftHandSideExpression Match <TFact>(Expression <Func <TFact> > alias, params Expression <Func <TFact, bool> >[] conditions) { var symbol = alias.ToParameterExpression(); var patternBuilder = _groupBuilder.Pattern(symbol.Type, symbol.Name); patternBuilder.DslConditions(_groupBuilder.Declarations, conditions); return(this); }
public ILeftHandSideExpression Match <TFact>(Expression <Func <TFact> > alias, params Expression <Func <TFact, bool> >[] conditions) { var symbol = alias.ToParameterExpression(); var patternBuilder = _builder.Pattern(symbol.Type, symbol.Name); patternBuilder.DslConditions(_symbolStack.Scope.Declarations, conditions); _symbolStack.Scope.Add(patternBuilder.Declaration); _currentPatternBuilder = patternBuilder; return(this); }
public override void EnterRuleFactMatch(RuleFactMatchContext context) { var patternTypeName = context.type().GetText(); var patternType = _parserContext.GetType(patternTypeName); var variableTypeName = context.local_variable_type().VAR() == null ? context.local_variable_type().type().GetText() : patternTypeName; var variableType = _parserContext.GetType(variableTypeName); var id = context.identifier().GetText(); _parserContext.Scope.Declare(variableType, id); var patternBuilder = _groupBuilder.Pattern(patternType, id); if (context.expression_list() != null) { foreach (var expressionContext in context.expression_list().expression()) { using (_parserContext.PushScope()) { var expressionParser = new ExpressionParser(_parserContext, patternType); var expression = (LambdaExpression)expressionParser.Visit(expressionContext); patternBuilder.DslConditions(_groupBuilder.Declarations, expression); } } } }