예제 #1
0
 public void Consume()
 {
     for (int i = 0; i < _Depth - 1; i++)
     {
         // oldvalue = newvalue
         _Buffer[i] = _Buffer[i + 1];
     }
     try {
         // set new value
         if (_Pos == _Code.Length)
         {
             // read next symbol frm buffer
             // end buffers
             _Buffer[_Depth - 1] = 0;
         }
         else
         {
             _Buffer[_Depth - 1] = _Code[_Pos++];
         }
     }
     catch (Exception e)
     {
         ApprenticeObject.ReportException(e);
     }
 }
예제 #2
0
 public void consume()
 {
     for (int i = 0; i < k - 1; i++)
     {
         _TokenStack[i] = _TokenStack[i + 1];
     }
     try {
         _TokenStack[k - 1] = _Lexer.GetToken();
         //Console.WriteLine("Token    ={0}",buf[k-1].Text);
     }
     catch (Exception e)
     {
         ApprenticeObject.ReportException(e);
     }
 }
예제 #3
0
 public TokenBuffer(Lexer oLexer, int k)
 {
     this.k      = k;
     _TokenStack = new Token[k];
     _Lexer      = oLexer;
     try {
         for (int i = 0; i < k; i++)
         {
             _TokenStack[i] = _Lexer.GetToken();
         }
     }
     catch (Exception e)
     {
         ApprenticeObject.ReportException(e);
     }
 }
예제 #4
0
 public Operator ReadArgument()
 {
     try
     {
         //string sBuffer = BufferConsumed();
         Operator op = ReadLogicalOr();
         return(op);
     }
     // catch(ApprenticeSyntaxException eSyntax)
     // {
     //  throw eSyntax;
     // }
     catch (Exception e)
     {
         ApprenticeObject.ReportException(e);
         return(null);
     }
 }
예제 #5
0
 public Operator ReadFormula()
 {
     try
     {
         ClearLeadingAndOR();
         var op = ReadLogicalOr();
         CheckThatBufferIsEmpty();
         return(op);
     }
     // catch(ApprenticeSyntaxException eSyntax)
     // {
     //  throw(eSyntax);
     // }
     catch (Exception e)
     {
         ApprenticeObject.ReportException(e);
         return(null);
     }
 }