예제 #1
0
 protected IReaderResult<Expression, TokenStream> ParseFirstExpression(
     Expression left, int priority, TokenStream stream)
 {
     for (var level = 0; level < priority; level++)
     {
         foreach (var parser in ParsersPriorityList[level])
         {
             var result = parser.Parse(this, left, level, stream);
             if (result != null) return result;
         }
     }
     return null;
 }
예제 #2
0
 public IReaderResult<Expression, TokenStream> Parse(Expression left, int priority, TokenStream stream)
 {
     IReaderResult<Expression, TokenStream> lastResult = null;
     while (true)
     {
         var result = ParseFirstExpression(lastResult?.Value ?? left, priority, stream);
         if (result != null)
         {
             lastResult = result;
             stream = result.Stream;
         }
         else
         {
             return lastResult;
         }
     }
 }
예제 #3
0
 public FieldStatement(TypeStatement type, LiteralToken name, Expression expression)
 {
     Type = type;
     Name = name;
     Expression = expression;
 }
예제 #4
0
 public ParenthesisExpression(OperatorToken left, Expression expression, OperatorToken right)
 {
     Left = left;
     Expression = expression;
     Right = right;
 }