internal TokenBase(int lbp) { this.LBP = lbp; this.Nud = NudError; this.Led = LedError; }
private void RegisterToken(Int32 leftBindingPower, Func <Int32, Expression, Expression> leftDenotation, params TokenType[] tokens) { var denotation = new LeftDenotation(leftBindingPower, leftDenotation); foreach (TokenType tokenType in tokens) { _leftDenotations.Add(tokenType, denotation); } }
private Expression ParseExpression(Int32 leftBindingPower) { NullDenotation nullDenotation = _nullDenotations[_lookahead.Type]; Expression expression = nullDenotation.Invoke(); LeftDenotation leftDenotation = _leftDenotations[_lookahead.Type]; while (leftDenotation != null && leftDenotation.LeftBindingPower > leftBindingPower) { expression = leftDenotation.Invoke(expression); leftDenotation = _leftDenotations[_lookahead.Type]; } return(expression); }