summaryrefslogtreecommitdiff
path: root/src/ExprIntrp/ExprIntrp.cxx
blob: 5708101f4a1fe1403ad774a28b6eee222e3ab5e0 (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
//static const char* sccsid = "@(#)ExprIntrp.cxx	3.2 95/01/10"; // Do not delete this line. Used by sccs.
// Copyright: 	Matra-Datavision 1992
// File:	ExprIntrp.cxx
// Created:	Mon Aug 17 18:40:44 1992
// Author:	Arnaud BOUZY
//		<adn>

#include <ExprIntrp.ixx>
#include <ExprIntrp_yaccintrf.hxx>
#include <ExprIntrp_yaccanal.hxx>
#include <Standard_ErrorHandler.hxx>
#include <ExprIntrp_SyntaxError.hxx>

TCollection_AsciiString ExprIntrp_thestring;
Standard_Integer ExprIntrp_thecurchar=0;

Standard_Boolean ExprIntrp::Parse(const Handle(ExprIntrp_Generator)& gen, const TCollection_AsciiString& str)
{
  ExprIntrp_Recept.SetMaster(gen);
  ExprIntrp_thecurchar = 0;
  if (str.Length() == 0) return Standard_False;
  ExprIntrp_thestring = str;
  ExprIntrp_start_string(ExprIntrp_thestring.ToCString());

  int kerror=1;

  {
    try {
      OCC_CATCH_SIGNALS
      while (kerror!=0) {
	kerror = ExprIntrpparse();
      }
      return Standard_True;
    }
    catch (Standard_Failure) {

#if defined(NO_CXX_EXCEPTION) || defined(OCC_CONVERT_SIGNALS)
      return Standard_False;
#endif

    }
  }

#if defined(NO_CXX_EXCEPTION) || defined(OCC_CONVERT_SIGNALS)
  return Standard_False;
#endif
}