summaryrefslogtreecommitdiff
path: root/src/ExprIntrp/ExprIntrp_GenExp.cxx
blob: a743aaa3eb418fd8ff0dcc8c417f26638b9ba5eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//static const char* sccsid = "@(#)ExprIntrp_GenExp.cxx	3.2 95/01/10"; // Do not delete this line. Used by sccs.
// Copyright: 	Matra-Datavision 1991
// File:	ExprIntrp_GenExp.cxx
// Created:	Thu Aug  8 10:15:28 1991
// Author:	Arnaud BOUZY
//		<adn>

#include <ExprIntrp_GenExp.ixx>
#include <ExprIntrp.hxx>
#include <ExprIntrp_yaccanal.hxx>
#include <Standard_NoSuchObject.hxx>

ExprIntrp_GenExp::ExprIntrp_GenExp ()
{
  done = Standard_False;
}

Handle( ExprIntrp_GenExp ) ExprIntrp_GenExp::Create()
{
  return new ExprIntrp_GenExp();
}

void ExprIntrp_GenExp::Process (const TCollection_AsciiString& str)
{
  Handle(ExprIntrp_GenExp) me = this;
  done = Standard_False;
  if (ExprIntrp::Parse(me,str)) {
    if (!ExprIntrp_Recept.IsExpStackEmpty()) {
      myExpression = ExprIntrp_Recept.Pop();
      done = Standard_True;
    }
    else {
      myExpression.Nullify();
      done = Standard_True;
    }
  }
  else {
    myExpression.Nullify();
  }
}
 
Standard_Boolean ExprIntrp_GenExp::IsDone() const
{
  return done;
}

Handle(Expr_GeneralExpression) ExprIntrp_GenExp::Expression () const
{
  if (!done) {
    Standard_NoSuchObject::Raise();
  }
  return myExpression;
}