public AssignmentStatementRule(TerminalNode identifier, TerminalNode assignmentOperator, ExpressionRule expression, TerminalNode semicolon) { Identifier = Guard.OneOf(() => identifier, Token.Identifier); AssignmentOperator = Guard.OneOf(() => assignmentOperator, Token.Assignment); Expression = expression; Semicolon = Guard.OneOf(() => semicolon, Token.Semicolon); }
//public methods public Expression Apply(Expression exp, ExpressionRule rule) { if (_matcher.Match(exp, rule.From, out _dict)) { if (rule.Predicate == null || rule.Predicate(_dict)) { return(Visit(rule.To.Body)); } } return(exp); }
public IdOrAssignmentRule(TerminalNode identifier, TerminalNode assignmentOperator, ExpressionRule expression) { Identifier = Guard.OneOf(() => identifier, Token.Identifier); AssignmentOperator = Guard.OneOf(() => assignmentOperator, Token.Assignment); Expression = Guard.NonNull(() => expression); }
public MainFunctionBuilder WithReturnExpression(ExpressionRule expressionRule) { _mainFunctionRule.FunctionBody.ReturnStatement.Expression = expressionRule; return(this); }
public WriteStatementRule(TerminalNode write, ExpressionRule expression, TerminalNode semicolon) { Write = Guard.OneOf(() => write, Token.Write); Expression = Guard.NonNull(() => expression); Semicolon = Guard.OneOf(() => semicolon, Token.Semicolon); }
public void Add(ExpressionRule rule) { rules.Add(rule); }
public void Remove(ExpressionRule rule) { rules.Remove(rule); }
public ReturnStatementRule(TerminalNode @return, ExpressionRule expression, TerminalNode semicolon) { Return = Guard.OneOf(() => @return, Token.Return); Expression = Guard.NonNull(() => expression); Semicolon = Guard.OneOf(() => semicolon, Token.Semicolon); }