Example #1
0
 public void Execute()
 {
     var xExpression = ParseExpression();
     while (mToken != null)
     {
         xExpression = ParseExpression(xExpression);
     }
     Expression = xExpression;
     if (mToken != null)
     {
         throw new Exception("Not at end of statement! (Next token: " + mToken + ")");
     }
 }
Example #2
0
 private void ParseExpression()
 {
     #if DEBUG
     if (!ParsingHelper.MayDoResolution)
     {
         throw new Exception("May not yet parse expression!");
     }
     #endif
     var xStatementParser = new StatementParser(Tokens, ParsingContexts, MethodBody.MethodDefinition);
     xStatementParser.Execute();
     mValueExpression = xStatementParser.Expression;
     if (mValueExpression == null)
     {
         throw new Exception("Expression syntax error");
     }
 }
Example #3
0
 private Expression ParseExpression(Expression rightExpression)
 {
     if (IsMatch('+'))
     {
         Move();
         var xExpressionLeft = ParseExpression();
         return new Addition(mContainingMethod.DeclaringType.Assembly.Host)
         {
             Left = xExpressionLeft,
             Right = rightExpression
         };
     }
     throw new Exception("Token not supported: " + mToken);
 }