Пример #1
0
 public static IExpression BuildDeepExpression(IExpression expr, TokenList tokens)
 {
     if (tokens.Current.TokenType == TokenType.GroupStart)
     {
         Token t = tokens.Current;
         ArgumentsOfExpression ax = new ArgumentsOfExpression(expr, t, BuildArgumentList(tokens));
         return(BuildDeepExpression(ax, tokens));
     }
     else if (tokens.Current.TokenType == TokenType.PropertyDesignator)
     {
         tokens.Advance();                 // past the property designator
         if (tokens.Current.TokenType != TokenType.Word)
         {
             throw new TokenParserException("This bit should be a word naming which property of thing thing before it that you are trying to evaluate.", tokens.Current);
         }
         PropertyOfExpression px = new PropertyOfExpression(expr, tokens.Current);
         tokens.Advance();                 // past the property name
         return(BuildDeepExpression(px, tokens));
     }
     else
     {
         return(expr);
     }
 }
Пример #2
0
 public static IExpression BuildDeepExpression(IExpression expr, TokenList tokens)
 {
     if (tokens.Current.TokenType == TokenType.GroupStart)
     {
         Token t = tokens.Current;
         ArgumentsOfExpression ax = new ArgumentsOfExpression(expr, t, BuildArgumentList(tokens));
         return BuildDeepExpression(ax, tokens);
     }
     else if (tokens.Current.TokenType == TokenType.PropertyDesignator)
     {
         tokens.Advance(); // past the property designator
         if (tokens.Current.TokenType != TokenType.Word)
             throw new TokenParserException("This bit should be a word naming which property of thing thing before it that you are trying to evaluate.", tokens.Current);
         PropertyOfExpression px = new PropertyOfExpression(expr, tokens.Current);
         tokens.Advance(); // past the property name
         return BuildDeepExpression(px, tokens);
     }
     else
         return expr;
 }