From d38eddc38fe88f2c2ee3780f515766ab02445cb6 Mon Sep 17 00:00:00 2001 From: imn Date: Wed, 6 Apr 2016 16:09:55 +0300 Subject: [PATCH] STEP - support C++ streams for import / export - New possibility to import STEP from stream. - Update STEP low-level parser, using bison/flex generator from C to C++. Add new method ReadStream(const Standard_CString filename, std::istream* istream) for all necessary classes to access main StepFile_Read() function with using stream. --- src/IFSelect/IFSelect_WorkLibrary.cxx | 9 + src/IFSelect/IFSelect_WorkLibrary.hxx | 9 + src/IFSelect/IFSelect_WorkSession.cxx | 38 +- src/IFSelect/IFSelect_WorkSession.hxx | 6 + src/StepFile/FILES | 15 +- src/StepFile/FlexLexer.h | 206 +++ src/StepFile/StepFile_CallFailure.cxx | 2 +- src/StepFile/StepFile_CallFailure.hxx | 2 +- src/StepFile/StepFile_Read.cxx | 57 +- src/StepFile/StepFile_Read.hxx | 7 + src/StepFile/lex.step.c | 1842 -------------------- src/StepFile/lex.step.cxx | 1920 +++++++++++++++++++++ src/StepFile/location.hh | 181 ++ src/StepFile/position.hh | 172 ++ src/StepFile/recfile.pc | 24 +- src/StepFile/scanner.hpp | 36 + src/StepFile/stack.hh | 137 ++ src/StepFile/step.lex | 85 +- src/StepFile/step.tab.c | 1799 ------------------- src/StepFile/step.tab.cxx | 1076 ++++++++++++ src/StepFile/step.tab.h | 93 - src/StepFile/step.tab.hxx | 285 +++ src/StepFile/step.yacc | 45 +- src/StepFile/{stepread.c => stepread.cxx} | 68 +- src/StepFile/stepread.ph | 29 +- src/StepSelect/StepSelect_WorkLibrary.cxx | 17 + src/StepSelect/StepSelect_WorkLibrary.hxx | 7 +- src/XSControl/XSControl_Reader.cxx | 16 +- src/XSControl/XSControl_Reader.hxx | 4 + 29 files changed, 4325 insertions(+), 3862 deletions(-) create mode 100644 src/StepFile/FlexLexer.h delete mode 100644 src/StepFile/lex.step.c create mode 100644 src/StepFile/lex.step.cxx create mode 100644 src/StepFile/location.hh create mode 100644 src/StepFile/position.hh create mode 100644 src/StepFile/scanner.hpp create mode 100644 src/StepFile/stack.hh delete mode 100644 src/StepFile/step.tab.c create mode 100644 src/StepFile/step.tab.cxx delete mode 100644 src/StepFile/step.tab.h create mode 100644 src/StepFile/step.tab.hxx rename src/StepFile/{stepread.c => stepread.cxx} (65%) diff --git a/src/IFSelect/IFSelect_WorkLibrary.cxx b/src/IFSelect/IFSelect_WorkLibrary.cxx index 49ed080769..6fbf98a4e0 100644 --- a/src/IFSelect/IFSelect_WorkLibrary.cxx +++ b/src/IFSelect/IFSelect_WorkLibrary.cxx @@ -89,3 +89,12 @@ IFSelect_WorkLibrary::IFSelect_WorkLibrary () { thelevdef = 0; } if (str.IsNull()) return ""; return str->ToCString(); } + +Standard_Integer IFSelect_WorkLibrary::ReadStream(const Standard_CString /*name*/, + std::istream* /*istream*/, + Handle(Interface_InterfaceModel)& /*model*/, + const Handle(Interface_Protocol)& /*protocol*/) const +{ + return 1; +} + diff --git a/src/IFSelect/IFSelect_WorkLibrary.hxx b/src/IFSelect/IFSelect_WorkLibrary.hxx index fa19ba190c..e58ffd95d2 100644 --- a/src/IFSelect/IFSelect_WorkLibrary.hxx +++ b/src/IFSelect/IFSelect_WorkLibrary.hxx @@ -63,6 +63,15 @@ public: //! and recognize the Entities) Standard_EXPORT virtual Standard_Integer ReadFile (const Standard_CString name, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const = 0; + //! Gives the way to Read a stream and transfer it to a Model + //! is the resulting Model, which has to be created by this + //! method. In case of error, must be returned Null + //! Return value is a status with free values. + //! Simply, 0 is for "Execution OK" + //! The Protocol can be used to work (e.g. create the Model, read + //! and recognize the Entities) + Standard_EXPORT virtual Standard_Integer ReadStream(const Standard_CString name, std::istream* istream, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const; + //! Gives the way to Write a File from a Model. //! contains all necessary informations : the model, the //! protocol, the file name, and the list of File Modifiers to be diff --git a/src/IFSelect/IFSelect_WorkSession.cxx b/src/IFSelect/IFSelect_WorkSession.cxx index 611bb30911..9d08c81767 100644 --- a/src/IFSelect/IFSelect_WorkSession.cxx +++ b/src/IFSelect/IFSelect_WorkSession.cxx @@ -207,8 +207,7 @@ void IFSelect_WorkSession::SetModel //purpose : //======================================================================= -IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile - (const Standard_CString filename) +IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile(const Standard_CString filename) { if (thelibrary.IsNull()) return IFSelect_RetVoid; if (theprotocol.IsNull()) return IFSelect_RetVoid; @@ -216,7 +215,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile IFSelect_ReturnStatus status = IFSelect_RetVoid; try { OCC_CATCH_SIGNALS - Standard_Integer stat = thelibrary->ReadFile (filename,model,theprotocol); + Standard_Integer stat = thelibrary->ReadFile(filename, model, theprotocol); if (stat == 0) status = IFSelect_RetDone; else if (stat < 0) status = IFSelect_RetError; else status = IFSelect_RetFail; @@ -235,6 +234,39 @@ IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile return status; } +//======================================================================= +//function : +//purpose : +//======================================================================= + +IFSelect_ReturnStatus IFSelect_WorkSession::ReadStream(const Standard_CString filename, + std::istream* istream) +{ + if (thelibrary.IsNull()) return IFSelect_RetVoid; + if (theprotocol.IsNull()) return IFSelect_RetVoid; + Handle(Interface_InterfaceModel) model; + IFSelect_ReturnStatus status = IFSelect_RetVoid; + try { + OCC_CATCH_SIGNALS + Standard_Integer stat = thelibrary->ReadStream(filename, istream, model, theprotocol); + if (stat == 0) status = IFSelect_RetDone; + else if (stat < 0) status = IFSelect_RetError; + else status = IFSelect_RetFail; + } + catch (Standard_Failure const& anException) { + Handle(Message_Messenger) sout = Message::DefaultMessenger(); + sout << " **** Interruption ReadFile par Exception : ****\n"; + sout << anException.GetMessageString(); + sout << "\n Abandon" << endl; + status = IFSelect_RetFail; + } + if (status != IFSelect_RetDone) return status; + if (model.IsNull()) return IFSelect_RetVoid; + SetModel(model); + SetLoadedFile(filename); + return status; +} + //======================================================================= //function : diff --git a/src/IFSelect/IFSelect_WorkSession.hxx b/src/IFSelect/IFSelect_WorkSession.hxx index bd9748939d..300bf48e2a 100644 --- a/src/IFSelect/IFSelect_WorkSession.hxx +++ b/src/IFSelect/IFSelect_WorkSession.hxx @@ -171,6 +171,12 @@ public: //! RetDone if OK, RetVoid if no Protocol not defined, //! RetError for file not found, RetFail if fail during read Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString filename); + + //! Reads a file from stream with the WorkLibrary (sets Model and LoadedFile) + //! Returns a integer status which can be : + //! RetDone if OK, RetVoid if no Protocol not defined, + //! RetError for file not found, RetFail if fail during read + Standard_EXPORT IFSelect_ReturnStatus ReadStream (const Standard_CString filename, std::istream* istream); //! Returns the count of Entities stored in the Model, or 0 Standard_EXPORT Standard_Integer NbStartingEntities() const; diff --git a/src/StepFile/FILES b/src/StepFile/FILES index 028955f57d..6110039e9e 100755 --- a/src/StepFile/FILES +++ b/src/StepFile/FILES @@ -1,12 +1,19 @@ -lex.step.c +lex.step.cxx recfile.pc recfile.ph -step.tab.c -step.tab.h +step.tab.cxx +step.tab.hxx StepFile_CallFailure.cxx StepFile_CallFailure.hxx StepFile_Read.cxx StepFile_Read.hxx StepFile_Transfer.hxx -stepread.c +stepread.cxx stepread.ph +step.lex +step.yacc +FlexLexer.h +location.hh +position.hh +stack.hh +scanner.hpp diff --git a/src/StepFile/FlexLexer.h b/src/StepFile/FlexLexer.h new file mode 100644 index 0000000000..bad4ce03fb --- /dev/null +++ b/src/StepFile/FlexLexer.h @@ -0,0 +1,206 @@ +// -*-C++-*- +// FlexLexer.h -- define interfaces for lexical analyzer classes generated +// by flex + +// Copyright (c) 1993 The Regents of the University of California. +// All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Kent Williams and Tom Epperly. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: + +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. + +// Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE. + +// This file defines FlexLexer, an abstract class which specifies the +// external interface provided to flex C++ lexer objects, and yyFlexLexer, +// which defines a particular lexer class. +// +// If you want to create multiple lexer classes, you use the -P flag +// to rename each yyFlexLexer to some other xxFlexLexer. You then +// include in your other sources once per lexer class: +// +// #undef yyFlexLexer +// #define yyFlexLexer xxFlexLexer +// #include +// +// #undef yyFlexLexer +// #define yyFlexLexer zzFlexLexer +// #include +// ... + +#ifndef __FLEX_LEXER_H +// Never included before - need to define base class. +#define __FLEX_LEXER_H + +#include +# ifndef FLEX_STD +# define FLEX_STD std:: +# endif + +extern "C++" { + +struct yy_buffer_state; +typedef int yy_state_type; + +class FlexLexer { +public: + virtual ~FlexLexer() { } + + const char* YYText() const { return yytext; } + int YYLeng() const { return yyleng; } + + virtual void + yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; + virtual struct yy_buffer_state* + yy_create_buffer( FLEX_STD istream* s, int size ) = 0; + virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; + virtual void yyrestart( FLEX_STD istream* s ) = 0; + + virtual int yylex() = 0; + + // Call yylex with new input/output sources. + int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 ) + { + switch_streams( new_in, new_out ); + return yylex(); + } + + // Switch to new input/output streams. A nil stream pointer + // indicates "keep the current one". + virtual void switch_streams( FLEX_STD istream* new_in = 0, + FLEX_STD ostream* new_out = 0 ) = 0; + + int lineno() const { return yylineno; } + + int debug() const { return yy_flex_debug; } + void set_debug( int flag ) { yy_flex_debug = flag; } + +protected: + char* yytext; + int yyleng; + int yylineno; // only maintained if you use %option yylineno + int yy_flex_debug; // only has effect with -d or "%option debug" +}; + +} +#endif // FLEXLEXER_H + +#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) +// Either this is the first time through (yyFlexLexerOnce not defined), +// or this is a repeated include to define a different flavor of +// yyFlexLexer, as discussed in the flex manual. +#define yyFlexLexerOnce + +extern "C++" { + +class yyFlexLexer : public FlexLexer { +public: + // arg_yyin and arg_yyout default to the cin and cout, but we + // only make that assignment when initializing in yylex(). + yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 ); + + virtual ~yyFlexLexer(); + + void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); + struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size ); + void yy_delete_buffer( struct yy_buffer_state* b ); + void yyrestart( FLEX_STD istream* s ); + + void yypush_buffer_state( struct yy_buffer_state* new_buffer ); + void yypop_buffer_state(); + + virtual int yylex(); + virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 ); + virtual int yywrap(); + +protected: + virtual int LexerInput( char* buf, int max_size ); + virtual void LexerOutput( const char* buf, int size ); + virtual void LexerError( const char* msg ); + + void yyunput( int c, char* buf_ptr ); + int yyinput(); + + void yy_load_buffer_state(); + void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s ); + void yy_flush_buffer( struct yy_buffer_state* b ); + + int yy_start_stack_ptr; + int yy_start_stack_depth; + int* yy_start_stack; + + void yy_push_state( int new_state ); + void yy_pop_state(); + int yy_top_state(); + + yy_state_type yy_get_previous_state(); + yy_state_type yy_try_NUL_trans( yy_state_type current_state ); + int yy_get_next_buffer(); + + FLEX_STD istream* yyin; // input source for default LexerInput + FLEX_STD ostream* yyout; // output sink for default LexerOutput + + // yy_hold_char holds the character lost when yytext is formed. + char yy_hold_char; + + // Number of characters read into yy_ch_buf. + int yy_n_chars; + + // Points to current character in buffer. + char* yy_c_buf_p; + + int yy_init; // whether we need to initialize + int yy_start; // start state number + + // Flag which is used to allow yywrap()'s to do buffer switches + // instead of setting up a fresh yyin. A bit of a hack ... + int yy_did_buffer_switch_on_eof; + + + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */ + void yyensure_buffer_stack(void); + + // The following are not always needed, but may be depending + // on use of certain flex features (like REJECT or yymore()). + + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + yy_state_type* yy_state_buf; + yy_state_type* yy_state_ptr; + + char* yy_full_match; + int* yy_full_state; + int yy_full_lp; + + int yy_lp; + int yy_looking_for_trail_begin; + + int yy_more_flag; + int yy_more_len; + int yy_more_offset; + int yy_prev_more_offset; +}; + +} + +#endif // yyFlexLexer || ! yyFlexLexerOnce + diff --git a/src/StepFile/StepFile_CallFailure.cxx b/src/StepFile/StepFile_CallFailure.cxx index aaff6f8bf7..183b19ba08 100644 --- a/src/StepFile/StepFile_CallFailure.cxx +++ b/src/StepFile/StepFile_CallFailure.cxx @@ -16,7 +16,7 @@ #include #include -void StepFile_CallFailure(char * const message) +void StepFile_CallFailure(const char * message) { throw Standard_Failure(message); } diff --git a/src/StepFile/StepFile_CallFailure.hxx b/src/StepFile/StepFile_CallFailure.hxx index 5481b3abe6..6c2e907bf7 100644 --- a/src/StepFile/StepFile_CallFailure.hxx +++ b/src/StepFile/StepFile_CallFailure.hxx @@ -14,4 +14,4 @@ #ifdef __cplusplus extern "C" #endif -void StepFile_CallFailure(char * const message); +void StepFile_CallFailure(const char * message); diff --git a/src/StepFile/StepFile_Read.cxx b/src/StepFile/StepFile_Read.cxx index 9ce43273dc..fbb5139fc6 100644 --- a/src/StepFile/StepFile_Read.cxx +++ b/src/StepFile/StepFile_Read.cxx @@ -25,13 +25,19 @@ // Compilation conditionnelle : concerne les mesures de performances - #include +#include #include "recfile.ph" #include "stepread.ph" -extern "C" void recfile_modeprint (int mode); // controle trace recfile - // recfile_modeprint est declare a part +#ifdef __cplusplus +extern "C" { +#endif +void recfile_modeprint (int mode); // controle trace recfile + // recfile_modeprint est declare a part +#ifdef __cplusplus +} +#endif #include #include #include @@ -65,9 +71,9 @@ void StepFile_ReadTrace (const Standard_Integer mode) modepr = mode; // recfile_modeprint est rappele a chaque lecture de fichier } - static Standard_Integer StepFile_Read (char* nomfic, + std::istream* istream, const Handle(StepData_StepModel)& stepmodel, const Handle(StepData_Protocol)& protocol, const Handle(StepData_FileRecognizer)& recoheader, @@ -81,7 +87,7 @@ Standard_Integer StepFile_Read const Handle(StepData_FileRecognizer)& recodata) { return StepFile_Read - (nomfic,stepmodel, + (nomfic,0,stepmodel, Handle(StepData_Protocol)::DownCast(Interface_Protocol::Active()), recoheader,recodata); } @@ -93,16 +99,26 @@ Standard_Integer StepFile_Read const Handle(StepData_Protocol)& protocol) { Handle(StepData_FileRecognizer) nulreco; - return StepFile_Read (nomfic,stepmodel,protocol,recoheader,nulreco); + return StepFile_Read (nomfic,0,stepmodel,protocol,recoheader,nulreco); +} + +Standard_Integer StepFile_Read + (char* nomfic, + const Handle(StepData_StepModel)& stepmodel, + const Handle(StepData_Protocol)& protocol) +{ + Handle(StepData_FileRecognizer) nulreco; + return StepFile_Read (nomfic,0,stepmodel,protocol,nulreco,nulreco); } Standard_Integer StepFile_Read (char* nomfic, + std::istream* istream, const Handle(StepData_StepModel)& stepmodel, const Handle(StepData_Protocol)& protocol) { Handle(StepData_FileRecognizer) nulreco; - return StepFile_Read (nomfic,stepmodel,protocol,nulreco,nulreco); + return StepFile_Read (nomfic,istream,stepmodel,protocol,nulreco,nulreco); } // ## ## ## ## ## ## Corps de la Routine ## ## ## ## ## ## @@ -111,6 +127,7 @@ static Interface_ParamType LesTypes[10]; // passage types (recstep/Interface) Standard_Integer StepFile_Read (char* nomfic, + std::istream* istream, const Handle(StepData_StepModel)& stepmodel, const Handle(StepData_Protocol)& protocol, const Handle(StepData_FileRecognizer)& recoheader, @@ -122,8 +139,12 @@ Standard_Integer StepFile_Read checkread->Clear(); recfile_modeprint ( (modepr > 0 ? modepr-1 : 0) ); - FILE* newin = stepread_setinput(ficnom); - if (!newin) return -1; + std::ifstream newifstream; + if (!istream) { + stepread_setinput(newifstream, ficnom); + istream = &newifstream; + } + if (!istream) return -1; #ifdef CHRONOMESURE Standard_Integer n ; OSD_Timer c ; @@ -134,7 +155,11 @@ Standard_Integer StepFile_Read try { OCC_CATCH_SIGNALS - if (stepread () != 0) { lir_file_fin(3); stepread_endinput (newin,ficnom); return 1; } + if (stepread(istream) != 0) { + lir_file_fin(3); + stepread_endinput(newifstream, ficnom); + return 1; + } } catch (Standard_Failure const& anException) { #ifdef OCCT_DEBUG @@ -144,17 +169,17 @@ Standard_Integer StepFile_Read #endif (void)anException; lir_file_fin(3); - stepread_endinput (newin,ficnom); + stepread_endinput(newifstream, ficnom); return 1; } - // Continue reading of file despite of possible fails - //if (checkread->HasFailed()) { lir_file_fin(3); stepread_endinput (newin,ficnom); return 1; } + +// Continue reading of file despite of possible fails +// if (checkread->HasFailed()) { lir_file_fin(3); stepread_endinput(newifstream, ficnom); return 1; } #ifdef CHRONOMESURE sout << " ... STEP File Read ... " << endl; c.Show(); #endif - // Creation du StepReaderData LesTypes[rec_argNondef] = Interface_ParamVoid ; @@ -224,8 +249,8 @@ Standard_Integer StepFile_Read n = stepmodel->NbEntities() ; sout << " STEP Loading done : " << n << " Entities" << endl; #endif - - stepread_endinput (newin,ficnom); return 0 ; + stepread_endinput(newifstream, ficnom); + return 0; } void StepFile_Interrupt (char* mess) diff --git a/src/StepFile/StepFile_Read.hxx b/src/StepFile/StepFile_Read.hxx index 6ee30cf997..aec7a4e13e 100644 --- a/src/StepFile/StepFile_Read.hxx +++ b/src/StepFile/StepFile_Read.hxx @@ -27,6 +27,7 @@ #ifndef StepFile_Read_HeaderFile #define StepFile_Read_HeaderFile +#include //# include : sauf recfile_modeprint, declare ici # include # include @@ -52,5 +53,11 @@ Standard_EXPORT Standard_Integer StepFile_Read (char* nomfic, const Handle(StepData_StepModel)& stepmodel, const Handle(StepData_Protocol)& protocol); // Header & Data + +Standard_EXPORT Standard_Integer StepFile_Read + (char* nomfic, + std::istream* istream, + const Handle(StepData_StepModel)& stepmodel, + const Handle(StepData_Protocol)& protocol); // Header & Data #endif diff --git a/src/StepFile/lex.step.c b/src/StepFile/lex.step.c deleted file mode 100644 index 66baa717ce..0000000000 --- a/src/StepFile/lex.step.c +++ /dev/null @@ -1,1842 +0,0 @@ -#define yy_create_buffer step_create_buffer -#define yy_delete_buffer step_delete_buffer -#define yy_scan_buffer step_scan_buffer -#define yy_scan_string step_scan_string -#define yy_scan_bytes step_scan_bytes -#define yy_flex_debug step_flex_debug -#define yy_init_buffer step_init_buffer -#define yy_flush_buffer step_flush_buffer -#define yy_load_buffer_state step_load_buffer_state -#define yy_switch_to_buffer step_switch_to_buffer -#define yyin stepin -#define yyleng stepleng -#define yylex steplex -#define yyout stepout -#define yyrestart steprestart -#define yytext steptext -#define yywrap stepwrap - -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.89 96/05/25 21:02:21 vern Exp $ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include - -#ifdef _MSC_VER -# include -# include -#endif /* _MSC_VER */ - - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - - -#define YY_USES_REJECT -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 37 -#define YY_END_OF_BUFFER 38 -static yyconst short int yy_acclist[146] = - { 0, - 38, 36, 37, 1, 36, 37, 3, 36, 37, 4, - 36, 37, 2, 36, 37, 36, 37, 36, 37, 36, - 37, 18, 36, 37, 36, 37, 36, 37, 15, 36, - 37, 16, 37, 36, 37, 9, 36, 37, 17, 36, - 37, 36, 37, 31, 36, 37, 9, 34, 36, 37, - 20, 36, 37, 19, 36, 37, 34, 36, 37, 34, - 36, 37, 34, 36, 37, 34, 36, 37, 34, 36, - 37, 34, 36, 37, 5, 36, 37, 35, 8,16391, - 12, 22, 10, 9, 10, 10, 21, 9, 10, 34, - 34, 34, 34, 34, 34, 34, 5, 13, 6, 8199, - - 10, 14, 14, 34, 34, 34, 34, 34, 34, 8199, - 11, 11, 11, 34, 34, 34, 34, 34, 30, 34, - 11, 11, 11, 34, 26, 34, 34, 34, 34, 23, - 32, 34, 34, 34, 34, 34, 25, 34, 24, 29, - 33, 34, 27, 28, 28 - } ; - -static yyconst short int yy_accept[109] = - { 0, - 1, 1, 1, 2, 4, 7, 10, 13, 16, 18, - 20, 22, 25, 27, 29, 32, 34, 36, 39, 42, - 44, 47, 51, 54, 57, 60, 63, 66, 69, 72, - 75, 78, 79, 79, 81, 81, 81, 81, 82, 83, - 84, 86, 87, 87, 88, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 99, 101, 101, 101, 103, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 111, 112, - 113, 115, 116, 116, 117, 118, 118, 119, 120, 121, - 121, 122, 123, 125, 126, 126, 127, 128, 129, 130, - 131, 132, 132, 133, 134, 135, 136, 136, 137, 138, - - 139, 140, 140, 141, 143, 145, 146, 146 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 6, 7, 8, 9, 10, 4, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 4, 22, 4, - 23, 4, 4, 4, 24, 25, 26, 27, 28, 25, - 29, 30, 31, 29, 29, 29, 29, 32, 33, 34, - 29, 35, 36, 37, 29, 29, 29, 29, 29, 29, - 4, 4, 4, 4, 29, 4, 38, 38, 38, 38, - - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 4, 4, 4, 4, 1, 1, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4 - } ; - -static yyconst int yy_meta[40] = - { 0, - 1, 2, 3, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, - 5, 2, 2, 5, 5, 5, 5, 5, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 7, 2 - } ; - -static yyconst short int yy_base[114] = - { 0, - 0, 0, 209, 210, 210, 210, 210, 210, 0, 0, - 187, 210, 171, 37, 210, 210, 186, 22, 210, 23, - 190, 26, 210, 210, 185, 27, 29, 31, 33, 34, - 164, 0, 194, 52, 175, 52, 53, 188, 210, 49, - 53, 57, 180, 210, 61, 179, 47, 60, 38, 64, - 67, 158, 210, 86, 210, 163, 75, 79, 83, 210, - 87, 91, 93, 94, 98, 99, 210, 161, 173, 103, - 104, 41, 158, 108, 107, 110, 0, 210, 118, 139, - 144, 120, 123, 210, 125, 119, 124, 127, 95, 210, - 210, 61, 128, 129, 130, 134, 136, 140, 210, 141, - - 210, 148, 210, 71, 0, 0, 210, 166, 62, 172, - 176, 179, 186 - } ; - -static yyconst short int yy_def[114] = - { 0, - 107, 1, 107, 107, 107, 107, 107, 107, 108, 109, - 107, 107, 107, 110, 107, 107, 107, 107, 107, 111, - 107, 112, 107, 107, 112, 112, 112, 112, 112, 112, - 107, 108, 109, 107, 107, 110, 110, 107, 107, 107, - 107, 111, 111, 107, 112, 112, 112, 112, 112, 112, - 112, 107, 107, 107, 107, 107, 107, 107, 111, 107, - 112, 112, 112, 112, 112, 112, 107, 107, 107, 111, - 112, 112, 107, 112, 112, 107, 65, 107, 112, 107, - 107, 111, 112, 107, 107, 112, 112, 112, 112, 107, - 107, 107, 112, 112, 112, 112, 107, 112, 107, 112, - - 107, 107, 107, 112, 113, 113, 0, 107, 107, 107, - 107, 107, 107 - } ; - -static yyconst short int yy_nxt[250] = - { 0, - 4, 5, 6, 4, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 18, 20, 21, - 22, 23, 24, 25, 25, 25, 26, 27, 25, 28, - 29, 25, 25, 25, 25, 30, 25, 25, 31, 37, - 40, 40, 41, 42, 40, 107, 45, 107, 38, 107, - 47, 107, 107, 54, 37, 37, 107, 54, 49, 107, - 48, 64, 84, 38, 38, 107, 33, 40, 50, 40, - 51, 40, 34, 41, 55, 58, 57, 42, 107, 40, - 57, 45, 107, 62, 59, 107, 63, 54, 61, 107, - 69, 54, 69, 97, 66, 69, 65, 40, 69, 40, - - 69, 60, 69, 70, 69, 107, 57, 71, 67, 107, - 73, 107, 107, 107, 72, 76, 107, 107, 77, 78, - 75, 60, 107, 82, 83, 107, 107, 76, 74, 96, - 76, 78, 79, 86, 89, 87, 107, 107, 60, 90, - 82, 107, 107, 83, 88, 107, 107, 107, 107, 94, - 99, 93, 107, 102, 95, 101, 102, 103, 107, 107, - 92, 98, 105, 100, 81, 102, 91, 104, 102, 103, - 32, 32, 32, 36, 36, 36, 36, 36, 36, 43, - 43, 43, 46, 46, 46, 46, 106, 106, 85, 106, - 106, 106, 106, 81, 80, 68, 52, 107, 60, 36, - - 56, 53, 52, 107, 44, 39, 35, 34, 107, 3, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107 - } ; - -static yyconst short int yy_chk[250] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, - 18, 20, 18, 20, 22, 26, 22, 27, 14, 28, - 26, 29, 30, 34, 36, 37, 49, 34, 28, 72, - 27, 49, 72, 36, 37, 47, 109, 40, 29, 40, - 30, 41, 34, 41, 34, 42, 40, 42, 48, 45, - 41, 45, 50, 47, 42, 51, 48, 54, 45, 104, - 57, 54, 57, 92, 51, 57, 50, 58, 59, 58, - - 59, 59, 61, 59, 61, 61, 58, 61, 54, 62, - 63, 63, 64, 89, 62, 65, 65, 66, 65, 65, - 64, 70, 71, 70, 71, 75, 74, 76, 63, 89, - 76, 76, 66, 74, 75, 74, 79, 86, 82, 79, - 82, 83, 87, 83, 74, 88, 93, 94, 95, 87, - 94, 86, 96, 97, 88, 96, 97, 97, 98, 100, - 85, 93, 100, 95, 81, 102, 80, 98, 102, 102, - 108, 108, 108, 110, 110, 110, 110, 110, 110, 111, - 111, 111, 112, 112, 112, 112, 113, 113, 73, 113, - 113, 113, 113, 69, 68, 56, 52, 46, 43, 38, - - 35, 33, 31, 25, 21, 17, 13, 11, 3, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107 - } ; - -static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; -static char *yy_full_match; -static int yy_lp; -static int yy_looking_for_trail_begin = 0; -static int yy_full_lp; -static int *yy_full_state; -#define YY_TRAILING_MASK 0x2000 -#define YY_TRAILING_HEAD_MASK 0x4000 -#define REJECT \ -{ \ -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ -yy_cp = yy_full_match; /* restore poss. backed-over text */ \ -yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \ -yy_state_ptr = yy_full_state; /* restore orig. state */ \ -yy_current_state = *yy_state_ptr; /* restore curr. state */ \ -++yy_lp; \ -goto find_rule; \ -} -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#define INITIAL 0 -/* - Copyright (c) 1999-2014 OPEN CASCADE SAS - - This file is part of Open CASCADE Technology software library. - - This library is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License version 2.1 as published - by the Free Software Foundation, with special exception defined in the file - OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT - distribution for complete text of the license and disclaimer of any warranty. - - Alternatively, this file may be used under the terms of Open CASCADE - commercial license or contractual agreement. -*/ -#include "step.tab.h" -#include "recfile.ph" -#include "stdio.h" -#include - -/* skl 31.01.2002 for OCC133(OCC96,97) - uncorrect -long string in files Henri.stp and 401.stp*/ -#define YY_FATAL_ERROR(msg) StepFile_CallFailure( msg ) - -/* abv 07.06.02: force inclusion of stdlib.h on WNT to avoid warnings */ -#include - -/* -void steperror ( FILE *input_file ); -void steprestart ( FILE *input_file ); -*/ -void rec_restext(char *newtext, int lentext); -void rec_typarg(int argtype); - - int steplineno; /* Comptage de ligne (ben oui, fait tout faire) */ - - int modcom = 0; /* Commentaires type C */ - int modend = 0; /* Flag for finishing of the STEP file */ - void resultat () /* Resultat alloue dynamiquement, "jete" une fois lu */ - { if (modcom == 0) rec_restext(yytext,yyleng); } - -// MSVC specifics -#ifdef _MSC_VER - -// disable MSVC warnings in flex code -// Note that Intel compiler also defines _MSC_VER but has different warning ids -#if defined(__INTEL_COMPILER) -#pragma warning(disable:177 1786 1736) -#else -#pragma warning(disable:4131 4244 4273 4267 4127) -#endif - -// Avoid includion of unistd.h if parser is generated on Linux (flex 2.5.35) -#define YY_NO_UNISTD_H - -#endif - -// disable GCC warnings in flex code -#ifdef __GNUC__ -#pragma GCC diagnostic ignored "-Wunused-function" -#endif - - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - - - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 108 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 210 ); - -yy_find_action: - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; -find_rule: /* we branch to this label when backing up */ - for ( ; ; ) /* until we find what rule we matched */ - { - if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) - { - yy_act = yy_acclist[yy_lp]; - if ( yy_act & YY_TRAILING_HEAD_MASK || - yy_looking_for_trail_begin ) - { - if ( yy_act == yy_looking_for_trail_begin ) - { - yy_looking_for_trail_begin = 0; - yy_act &= ~YY_TRAILING_HEAD_MASK; - break; - } - } - else if ( yy_act & YY_TRAILING_MASK ) - { - yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK; - yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK; - } - else - { - yy_full_match = yy_cp; - yy_full_state = yy_state_ptr; - yy_full_lp = yy_lp; - break; - } - ++yy_lp; - goto find_rule; - } - --yy_cp; - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ -case 1: -YY_RULE_SETUP -{;} - YY_BREAK -case 2: -YY_RULE_SETUP -{;} - YY_BREAK -case 3: -YY_RULE_SETUP -{ steplineno ++; } - YY_BREAK -case 4: -YY_RULE_SETUP -{;} /* abv 30.06.00: for reading DOS files */ - YY_BREAK -case 5: -YY_RULE_SETUP -{;} /* fix from C21. for test load e3i file with line 15 with null symbols */ - YY_BREAK -case 6: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ resultat(); if (modcom == 0) return(ENTITY); } - YY_BREAK -case 7: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) return(ENTITY); } - YY_BREAK -case 8: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) return(IDENT); } - YY_BREAK -case 9: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) { rec_typarg(rec_argInteger); return(QUID); } } - YY_BREAK -case 10: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) { rec_typarg(rec_argFloat); return(QUID); } } - YY_BREAK -case 11: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) { rec_typarg(rec_argFloat); return(QUID); } } - YY_BREAK -case 12: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) { rec_typarg(rec_argText); return(QUID); } } - YY_BREAK -case 13: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) { rec_typarg(rec_argHexa); return(QUID); } } - YY_BREAK -case 14: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) { rec_typarg(rec_argEnum); return(QUID); } } - YY_BREAK -case 15: -YY_RULE_SETUP -{ if (modcom == 0) return ('('); } - YY_BREAK -case 16: -YY_RULE_SETUP -{ if (modcom == 0) return (')'); } - YY_BREAK -case 17: -YY_RULE_SETUP -{ if (modcom == 0) return (','); } - YY_BREAK -case 18: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) { rec_typarg(rec_argNondef); return(QUID); } } - YY_BREAK -case 19: -YY_RULE_SETUP -{ if (modcom == 0) return ('='); } - YY_BREAK -case 20: -YY_RULE_SETUP -{ if (modcom == 0) return (';'); } - YY_BREAK -case 21: -YY_RULE_SETUP -{ modcom = 1; } - YY_BREAK -case 22: -YY_RULE_SETUP -{ if (modend == 0) modcom = 0; } - YY_BREAK -case 23: -YY_RULE_SETUP -{ if (modcom == 0) return(STEP); } - YY_BREAK -case 24: -YY_RULE_SETUP -{ if (modcom == 0) return(HEADER); } - YY_BREAK -case 25: -YY_RULE_SETUP -{ if (modcom == 0) return(ENDSEC); } - YY_BREAK -case 26: -YY_RULE_SETUP -{ if (modcom == 0) return(DATA); } - YY_BREAK -case 27: -YY_RULE_SETUP -{ if (modend == 0) {modcom = 0; return(ENDSTEP);} } - YY_BREAK -case 28: -YY_RULE_SETUP -{ if (modend == 0) {modcom = 0; return(ENDSTEP);} } - YY_BREAK -case 29: -YY_RULE_SETUP -{ modcom = 1; modend = 1; return(ENDSTEP); } - YY_BREAK -case 30: -YY_RULE_SETUP -{ if (modend == 0) {modcom = 0; return(STEP); } } - YY_BREAK -case 31: -YY_RULE_SETUP -{ if (modcom == 0) return ('/'); } - YY_BREAK -case 32: -YY_RULE_SETUP -{ if (modcom == 0) return(SCOPE); } - YY_BREAK -case 33: -YY_RULE_SETUP -{ if (modcom == 0) return(ENDSCOPE); } - YY_BREAK -case 34: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) return(TYPE); } - YY_BREAK -case 35: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) return(TYPE); } - YY_BREAK -case 36: -YY_RULE_SETUP -{ resultat(); if (modcom == 0) { rec_typarg(rec_argMisc); return(QUID); } } - YY_BREAK -case 37: -YY_RULE_SETUP -ECHO; - YY_BREAK - case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 39); - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 108 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - - register YY_CHAR yy_c = 39; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 108 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 107); - if ( ! yy_is_jam ) - *yy_state_ptr++ = yy_current_state; - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = yytext_ptr + offset; - return EOF; - } - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( - "unexpected last match in input()" ); -#endif - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *str ) -#else -YY_BUFFER_STATE yy_scan_string( str ) -yyconst char *str; -#endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; - - return yy_scan_bytes( str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif diff --git a/src/StepFile/lex.step.cxx b/src/StepFile/lex.step.cxx new file mode 100644 index 0000000000..93f5691988 --- /dev/null +++ b/src/StepFile/lex.step.cxx @@ -0,0 +1,1920 @@ +#line 2 "lex.step.cxx" + +#line 4 "lex.step.cxx" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 37 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + + /* The c++ scanner is a mess. The FlexLexer.h header file relies on the + * following macro. This is required in order to pass the c++-multiple-scanners + * test in the regression suite. We get reports that it breaks inheritance. + * We will address this in a future release of flex, or omit the C++ scanner + * altogether. + */ + #define yyFlexLexer yyFlexLexer + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C++ headers. */ +#include +#include +#include +#include +#include +/* end standard C++ headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +#if defined __cplusplus && 201103L <= __cplusplus +#define yyregister +#else +#define yyregister register +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t yyleng; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE yylex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + + std::istream* yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +#define yytext_ptr yytext +#define YY_INTERACTIVE + +#include + +int yyFlexLexer::yywrap() { return 1; } + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 37 +#define YY_END_OF_BUFFER 38 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_acclist[146] = + { 0, + 38, 36, 37, 1, 36, 37, 3, 36, 37, 4, + 36, 37, 2, 36, 37, 36, 37, 36, 37, 36, + 37, 18, 36, 37, 36, 37, 36, 37, 15, 36, + 37, 16, 37, 36, 37, 9, 36, 37, 17, 36, + 37, 36, 37, 31, 36, 37, 9, 34, 36, 37, + 20, 36, 37, 19, 36, 37, 34, 36, 37, 34, + 36, 37, 34, 36, 37, 34, 36, 37, 34, 36, + 37, 34, 36, 37, 5, 36, 37, 35, 8,16391, + 12, 22, 10, 9, 10, 10, 21, 9, 10, 34, + 34, 34, 34, 34, 34, 34, 5, 13, 6, 8199, + + 10, 14, 14, 34, 34, 34, 34, 34, 34, 8199, + 11, 11, 11, 34, 34, 34, 34, 34, 30, 34, + 11, 11, 11, 34, 26, 34, 34, 34, 34, 23, + 32, 34, 34, 34, 34, 34, 25, 34, 24, 29, + 33, 34, 27, 28, 28 + } ; + +static yyconst flex_int16_t yy_accept[109] = + { 0, + 1, 1, 1, 2, 4, 7, 10, 13, 16, 18, + 20, 22, 25, 27, 29, 32, 34, 36, 39, 42, + 44, 47, 51, 54, 57, 60, 63, 66, 69, 72, + 75, 78, 79, 79, 81, 81, 81, 81, 82, 83, + 84, 86, 87, 87, 88, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 99, 101, 101, 101, 103, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 111, 112, + 113, 115, 116, 116, 117, 118, 118, 119, 120, 121, + 121, 122, 123, 125, 126, 126, 127, 128, 129, 130, + 131, 132, 132, 133, 134, 135, 136, 136, 137, 138, + + 139, 140, 140, 141, 143, 145, 146, 146 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 6, 7, 8, 9, 10, 4, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 4, 22, 4, + 23, 4, 4, 4, 24, 25, 26, 27, 28, 25, + 29, 30, 31, 29, 29, 29, 29, 32, 33, 34, + 29, 35, 36, 37, 29, 29, 29, 29, 29, 29, + 4, 4, 4, 4, 29, 4, 38, 38, 38, 38, + + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 4, 4, 4, 4, 1, 1, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4 + } ; + +static yyconst flex_int32_t yy_meta[40] = + { 0, + 1, 2, 3, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, + 5, 2, 2, 5, 5, 5, 5, 5, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 7, 2 + } ; + +static yyconst flex_int16_t yy_base[114] = + { 0, + 0, 0, 209, 210, 210, 210, 210, 210, 0, 0, + 187, 210, 171, 37, 210, 210, 186, 22, 210, 23, + 190, 26, 210, 210, 185, 27, 29, 31, 33, 34, + 164, 0, 194, 52, 175, 52, 53, 188, 210, 49, + 53, 57, 180, 210, 61, 179, 47, 60, 38, 64, + 67, 158, 210, 86, 210, 163, 75, 79, 83, 210, + 87, 91, 93, 94, 98, 99, 210, 161, 173, 103, + 104, 41, 158, 108, 107, 110, 0, 210, 118, 139, + 144, 120, 123, 210, 125, 119, 124, 127, 95, 210, + 210, 61, 128, 129, 130, 134, 136, 140, 210, 141, + + 210, 148, 210, 71, 0, 0, 210, 166, 62, 172, + 176, 179, 186 + } ; + +static yyconst flex_int16_t yy_def[114] = + { 0, + 107, 1, 107, 107, 107, 107, 107, 107, 108, 109, + 107, 107, 107, 110, 107, 107, 107, 107, 107, 111, + 107, 112, 107, 107, 112, 112, 112, 112, 112, 112, + 107, 108, 109, 107, 107, 110, 110, 107, 107, 107, + 107, 111, 111, 107, 112, 112, 112, 112, 112, 112, + 112, 107, 107, 107, 107, 107, 107, 107, 111, 107, + 112, 112, 112, 112, 112, 112, 107, 107, 107, 111, + 112, 112, 107, 112, 112, 107, 65, 107, 112, 107, + 107, 111, 112, 107, 107, 112, 112, 112, 112, 107, + 107, 107, 112, 112, 112, 112, 107, 112, 107, 112, + + 107, 107, 107, 112, 113, 113, 0, 107, 107, 107, + 107, 107, 107 + } ; + +static yyconst flex_int16_t yy_nxt[250] = + { 0, + 4, 5, 6, 4, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 18, 20, 21, + 22, 23, 24, 25, 25, 25, 26, 27, 25, 28, + 29, 25, 25, 25, 25, 30, 25, 25, 31, 37, + 40, 40, 41, 42, 40, 107, 45, 107, 38, 107, + 47, 107, 107, 54, 37, 37, 107, 54, 49, 107, + 48, 64, 84, 38, 38, 107, 33, 40, 50, 40, + 51, 40, 34, 41, 55, 58, 57, 42, 107, 40, + 57, 45, 107, 62, 59, 107, 63, 54, 61, 107, + 69, 54, 69, 97, 66, 69, 65, 40, 69, 40, + + 69, 60, 69, 70, 69, 107, 57, 71, 67, 107, + 73, 107, 107, 107, 72, 76, 107, 107, 77, 78, + 75, 60, 107, 82, 83, 107, 107, 76, 74, 96, + 76, 78, 79, 86, 89, 87, 107, 107, 60, 90, + 82, 107, 107, 83, 88, 107, 107, 107, 107, 94, + 99, 93, 107, 102, 95, 101, 102, 103, 107, 107, + 92, 98, 105, 100, 81, 102, 91, 104, 102, 103, + 32, 32, 32, 36, 36, 36, 36, 36, 36, 43, + 43, 43, 46, 46, 46, 46, 106, 106, 85, 106, + 106, 106, 106, 81, 80, 68, 52, 107, 60, 36, + + 56, 53, 52, 107, 44, 39, 35, 34, 107, 3, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107 + } ; + +static yyconst flex_int16_t yy_chk[250] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, + 18, 20, 18, 20, 22, 26, 22, 27, 14, 28, + 26, 29, 30, 34, 36, 37, 49, 34, 28, 72, + 27, 49, 72, 36, 37, 47, 109, 40, 29, 40, + 30, 41, 34, 41, 34, 42, 40, 42, 48, 45, + 41, 45, 50, 47, 42, 51, 48, 54, 45, 104, + 57, 54, 57, 92, 51, 57, 50, 58, 59, 58, + + 59, 59, 61, 59, 61, 61, 58, 61, 54, 62, + 63, 63, 64, 89, 62, 65, 65, 66, 65, 65, + 64, 70, 71, 70, 71, 75, 74, 76, 63, 89, + 76, 76, 66, 74, 75, 74, 79, 86, 82, 79, + 82, 83, 87, 83, 74, 88, 93, 94, 95, 87, + 94, 86, 96, 97, 88, 96, 97, 97, 98, 100, + 85, 93, 100, 95, 81, 102, 80, 98, 102, 102, + 108, 108, 108, 110, 110, 110, 110, 110, 110, 111, + 111, 111, 112, 112, 112, 112, 113, 113, 73, 113, + 113, 113, 113, 69, 68, 56, 52, 46, 43, 38, + + 35, 33, 31, 25, 21, 17, 13, 11, 3, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[38] = + { 0, +0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, }; + +#define YY_TRAILING_MASK 0x2000 +#define YY_TRAILING_HEAD_MASK 0x4000 +#define REJECT \ +{ \ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \ +yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ +(yy_lp) = (yy_full_lp); /* restore orig. accepting pos. */ \ +(yy_state_ptr) = (yy_full_state); /* restore orig. state */ \ +yy_current_state = *(yy_state_ptr); /* restore curr. state */ \ +++(yy_lp); \ +goto find_rule; \ +} + +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "StepFile/step.lex" +/* + Copyright (c) 1999-2014 OPEN CASCADE SAS + + This file is part of Open CASCADE Technology software library. + + This library is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License version 2.1 as published + by the Free Software Foundation, with special exception defined in the file + OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT + distribution for complete text of the license and disclaimer of any warranty. + + Alternatively, this file may be used under the terms of Open CASCADE + commercial license or contractual agreement. +*/ +/* +c++ generate C++ parser class +8bit don't fail on 8-bit input characters +warn warn about inconsistencies +nodefault don't create default echo-all rule +noyywrap don't use yywrap() function +yylineno maintains the number of the current line +*/ +#line 30 "StepFile/step.lex" +#include "step.tab.hxx" +#include "scanner.hpp" +#include "recfile.ph" +#include "stdio.h" +#include + +typedef yy::parser::token token; +/* skl 31.01.2002 for OCC133(OCC96,97) - uncorrect +long string in files Henri.stp and 401.stp*/ +#define YY_FATAL_ERROR(msg) StepFile_CallFailure( msg ) + +/* abv 07.06.02: force inclusion of stdlib.h on WNT to avoid warnings */ +#include + +/* +void steperror ( FILE *input_file ); +void steprestart ( FILE *input_file ); +*/ + +void rec_restext(const char *constnewtext, int lentext); +void rec_typarg(int argtype); + + int steplineno; /* Comptage de ligne (ben oui, fait tout faire) */ + + int modcom = 0; /* Commentaires type C */ + int modend = 0; /* Flag for finishing of the STEP file */ + +// MSVC specifics +#ifdef _MSC_VER + +// disable MSVC warnings in flex code +// Note that Intel compiler also defines _MSC_VER but has different warning ids +#if defined(__INTEL_COMPILER) +#pragma warning(disable:177 1786 1736) +#else +#pragma warning(disable:4131 4244 4273 4267 4127 4100) +#endif + +// Avoid includion of unistd.h if parser is generated on Linux (flex 2.5.35) +#define YY_NO_UNISTD_H + +#endif + +// disable GCC warnings in flex code +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wunused-function" +#endif + +#line 618 "lex.step.cxx" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +#define ECHO LexerOutput( yytext, yyleng ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +\ + if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) LexerError( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 +#define YY_DECL int yyFlexLexer::yylex() +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yyregister yy_state_type yy_current_state; + yyregister char *yy_cp, *yy_bp; + yyregister int yy_act; + +#line 80 "StepFile/step.lex" + +#line 720 "lex.step.cxx" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + /* Create the reject buffer large enough to save one state per allowed character. */ + if ( ! (yy_state_buf) ) + (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE ); + if ( ! (yy_state_buf) ) + YY_FATAL_ERROR( "out of dynamic memory in yylex()" ); + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = & std::cin; + + if ( ! yyout ) + yyout = & std::cout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; + +yy_match: + do + { + yyregister YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 108 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 210 ); + +yy_find_action: + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; +find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[(yy_lp)]; + if ( yy_act & YY_TRAILING_HEAD_MASK || + (yy_looking_for_trail_begin) ) + { + if ( yy_act == (yy_looking_for_trail_begin) ) + { + (yy_looking_for_trail_begin) = 0; + yy_act &= ~YY_TRAILING_HEAD_MASK; + break; + } + } + else if ( yy_act & YY_TRAILING_MASK ) + { + (yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK; + (yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK; + } + else + { + (yy_full_match) = yy_cp; + (yy_full_state) = (yy_state_ptr); + (yy_full_lp) = (yy_lp); + break; + } + ++(yy_lp); + goto find_rule; + } + --yy_cp; + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + yy_size_t yyl; + for ( yyl = 0; (int)yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + yylineno++; +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ +case 1: +YY_RULE_SETUP +#line 81 "StepFile/step.lex" +{;} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 82 "StepFile/step.lex" +{;} + YY_BREAK +case 3: +/* rule 3 can match eol */ +YY_RULE_SETUP +#line 83 "StepFile/step.lex" +{ steplineno ++; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 84 "StepFile/step.lex" +{;} /* abv 30.06.00: for reading DOS files */ + YY_BREAK +case 5: +YY_RULE_SETUP +#line 85 "StepFile/step.lex" +{;} /* fix from C21. for test load e3i file with line 15 with null symbols */ + YY_BREAK +case 6: +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 86 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::ENTITY); } } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 87 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::ENTITY); } } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 88 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::IDENT); } } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 89 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argInteger); return(token::QUID); } } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 90 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argFloat); return(token::QUID); } } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 91 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argFloat); return(token::QUID); } } + YY_BREAK +case 12: +/* rule 12 can match eol */ +YY_RULE_SETUP +#line 92 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argText); return(token::QUID); } } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 93 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argHexa); return(token::QUID); } } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 94 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argEnum); return(token::QUID); } } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 95 "StepFile/step.lex" +{ if (modcom == 0) return ('('); } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 96 "StepFile/step.lex" +{ if (modcom == 0) return (')'); } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 97 "StepFile/step.lex" +{ if (modcom == 0) return (','); } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 98 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argNondef); return(token::QUID); } } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 99 "StepFile/step.lex" +{ if (modcom == 0) return ('='); } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 100 "StepFile/step.lex" +{ if (modcom == 0) return (';'); } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 101 "StepFile/step.lex" +{ modcom = 1; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 102 "StepFile/step.lex" +{ if (modend == 0) modcom = 0; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 104 "StepFile/step.lex" +{ if (modcom == 0) return(token::STEP); } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 105 "StepFile/step.lex" +{ if (modcom == 0) return(token::HEADER); } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 106 "StepFile/step.lex" +{ if (modcom == 0) return(token::ENDSEC); } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 107 "StepFile/step.lex" +{ if (modcom == 0) return(token::DATA); } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 108 "StepFile/step.lex" +{ if (modend == 0) {modcom = 0; return(token::ENDSTEP);} } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 109 "StepFile/step.lex" +{ if (modend == 0) {modcom = 0; return(token::ENDSTEP);} } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 110 "StepFile/step.lex" +{ modcom = 1; modend = 1; return(token::ENDSTEP); } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 111 "StepFile/step.lex" +{ if (modend == 0) {modcom = 0; return(token::STEP); } } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 113 "StepFile/step.lex" +{ if (modcom == 0) return ('/'); } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 114 "StepFile/step.lex" +{ if (modcom == 0) return(token::SCOPE); } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 115 "StepFile/step.lex" +{ if (modcom == 0) return(token::ENDSCOPE); } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 116 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::TYPE); } } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 117 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::TYPE); } } + YY_BREAK +case 36: +/* rule 36 can match eol */ +YY_RULE_SETUP +#line 118 "StepFile/step.lex" +{ if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argMisc); return(token::QUID); } } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 120 "StepFile/step.lex" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 1033 "lex.step.cxx" + case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* The contents of this function are C++ specific, so the () macro is not used. + */ +yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ) +{ + yyin = arg_yyin; + yyout = arg_yyout; + yy_c_buf_p = 0; + yy_init = 0; + yy_start = 0; + yy_flex_debug = 0; + yylineno = 1; // this will only get updated if %option yylineno + + yy_did_buffer_switch_on_eof = 0; + + yy_looking_for_trail_begin = 0; + yy_more_flag = 0; + yy_more_len = 0; + yy_more_offset = yy_prev_more_offset = 0; + + yy_start_stack_ptr = yy_start_stack_depth = 0; + yy_start_stack = NULL; + + yy_buffer_stack = 0; + yy_buffer_stack_top = 0; + yy_buffer_stack_max = 0; + + yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE]; + +} + +/* The contents of this function are C++ specific, so the () macro is not used. + */ +yyFlexLexer::~yyFlexLexer() +{ + delete [] yy_state_buf; + yyfree(yy_start_stack ); + yy_delete_buffer( YY_CURRENT_BUFFER ); + yyfree(yy_buffer_stack ); +} + +/* The contents of this function are C++ specific, so the () macro is not used. + */ +void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out ) +{ + if ( new_in ) + { + yy_delete_buffer( YY_CURRENT_BUFFER ); + yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); + } + + if ( new_out ) + yyout = new_out; +} + +#ifdef YY_INTERACTIVE +int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) +#else +int yyFlexLexer::LexerInput( char* buf, int max_size ) +#endif +{ + if ( yyin->eof() || yyin->fail() ) + return 0; + +#ifdef YY_INTERACTIVE + yyin->get( buf[0] ); + + if ( yyin->eof() ) + return 0; + + if ( yyin->bad() ) + return -1; + + return 1; + +#else + (void) yyin->read( buf, max_size ); + + if ( yyin->bad() ) + return -1; + else + return yyin->gcount(); +#endif +} + +void yyFlexLexer::LexerOutput( const char* buf, int size ) +{ + (void) yyout->write( buf, size ); +} + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +int yyFlexLexer::yy_get_next_buffer() +{ + yyregister char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + yyregister char *source = (yytext_ptr); + yyregister int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + yy_state_type yyFlexLexer::yy_get_previous_state() +{ + yyregister yy_state_type yy_current_state; + yyregister char *yy_cp; + + yy_current_state = (yy_start); + + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + yyregister YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 39); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 108 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) +{ + yyregister int yy_is_jam; + + yyregister YY_CHAR yy_c = 39; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 108 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 107); + if ( ! yy_is_jam ) + *(yy_state_ptr)++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; +} + + void yyFlexLexer::yyunput( int c, yyregister char* yy_bp) +{ + yyregister char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + yyregister yy_size_t number_to_move = (yy_n_chars) + 2; + yyregister char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + yyregister char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ){ + --yylineno; + } + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + + int yyFlexLexer::yyinput() +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + if ( c == '\n' ) + + yylineno++; +; + + return c; +} + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyFlexLexer::yyrestart( std::istream* input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + + void yyFlexLexer::yy_load_buffer_state() +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file ) + +{ + int oerrno = errno; + + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yyFlexLexer::yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +void yyFlexLexer::yyensure_buffer_stack(void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + + void yyFlexLexer::yy_push_state( int new_state ) +{ + if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) + { + yy_size_t new_size; + + (yy_start_stack_depth) += YY_START_STACK_INCR; + new_size = (yy_start_stack_depth) * sizeof( int ); + + if ( ! (yy_start_stack) ) + (yy_start_stack) = (int *) yyalloc(new_size ); + + else + (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size ); + + if ( ! (yy_start_stack) ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); + } + + (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; + + BEGIN(new_state); +} + + void yyFlexLexer::yy_pop_state() +{ + if ( --(yy_start_stack_ptr) < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); +} + + int yyFlexLexer::yy_top_state() +{ + return (yy_start_stack)[(yy_start_stack_ptr) - 1]; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +void yyFlexLexer::LexerError( yyconst char msg[] ) +{ + std::cerr << msg << std::endl; + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + yyregister int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + yyregister int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 119 "StepFile/step.lex" + + + +yy::scanner::scanner(std::istream* in, std::ostream* out) + : yyFlexLexer(in, out) +{ +} + +int yyFlexLexer::yylex() +{ + throw std::logic_error( + "The yylex() exists for technical reasons and must not be used."); +} diff --git a/src/StepFile/location.hh b/src/StepFile/location.hh new file mode 100644 index 0000000000..0bf1a74e88 --- /dev/null +++ b/src/StepFile/location.hh @@ -0,0 +1,181 @@ +/* A Bison parser, made by GNU Bison 2.7. */ + +/* Locations for Bison parsers in C++ + + Copyright (C) 2002-2007, 2009-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file location.hh + ** Define the yy::location class. + */ + +#ifndef YY_YY_LOCATION_HH_INCLUDED +# define YY_YY_LOCATION_HH_INCLUDED + +# include "position.hh" + + +namespace yy { +/* Line 166 of location.cc */ +#line 47 "location.hh" + + /// Abstract a location. + class location + { + public: + + /// Construct a location from \a b to \a e. + location (const position& b, const position& e) + : begin (b) + , end (e) + { + } + + /// Construct a 0-width location in \a p. + explicit location (const position& p = position ()) + : begin (p) + , end (p) + { + } + + /// Construct a 0-width location in \a f, \a l, \a c. + explicit location (std::string* f, + unsigned int l = 1u, + unsigned int c = 1u) + : begin (f, l, c) + , end (f, l, c) + { + } + + + /// Initialization. + void initialize (std::string* f = YY_NULL, + unsigned int l = 1u, + unsigned int c = 1u) + { + begin.initialize (f, l, c); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + void columns (unsigned int count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + void lines (unsigned int count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two location objects to create a location. + inline const location operator+ (const location& begin, const location& end) + { + location res = begin; + res.end = end.end; + return res; + } + + /// Add two location objects. + inline const location operator+ (const location& begin, unsigned int width) + { + location res = begin; + res.columns (width); + return res; + } + + /// Add and assign a location. + inline location& operator+= (location& res, unsigned int width) + { + res.columns (width); + return res; + } + + /// Compare two location objects. + inline bool + operator== (const location& loc1, const location& loc2) + { + return loc1.begin == loc2.begin && loc1.end == loc2.end; + } + + /// Compare two location objects. + inline bool + operator!= (const location& loc1, const location& loc2) + { + return !(loc1 == loc2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + template + inline std::basic_ostream& + operator<< (std::basic_ostream& ostr, const location& loc) + { + position last = loc.end - 1; + ostr << loc.begin; + if (last.filename + && (!loc.begin.filename + || *loc.begin.filename != *last.filename)) + ostr << '-' << last; + else if (loc.begin.line != last.line) + ostr << '-' << last.line << '.' << last.column; + else if (loc.begin.column != last.column) + ostr << '-' << last.column; + return ostr; + } + + +} // yy +/* Line 296 of location.cc */ +#line 180 "location.hh" + +#endif /* !YY_YY_LOCATION_HH_INCLUDED */ diff --git a/src/StepFile/position.hh b/src/StepFile/position.hh new file mode 100644 index 0000000000..3b33c2734a --- /dev/null +++ b/src/StepFile/position.hh @@ -0,0 +1,172 @@ +/* A Bison parser, made by GNU Bison 2.7. */ + +/* Positions for Bison parsers in C++ + + Copyright (C) 2002-2007, 2009-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file position.hh + ** Define the yy::position class. + */ + +#ifndef YY_YY_POSITION_HH_INCLUDED +# define YY_YY_POSITION_HH_INCLUDED + +# include // std::max +# include +# include + +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif + + +namespace yy { +/* Line 36 of location.cc */ +#line 57 "position.hh" + /// Abstract a position. + class position + { + public: + + /// Construct a position. + explicit position (std::string* f = YY_NULL, + unsigned int l = 1u, + unsigned int c = 1u) + : filename (f) + , line (l) + , column (c) + { + } + + + /// Initialization. + void initialize (std::string* fn = YY_NULL, + unsigned int l = 1u, + unsigned int c = 1u) + { + filename = fn; + line = l; + column = c; + } + + /** \name Line and Column related manipulators + ** \{ */ + /// (line related) Advance to the COUNT next lines. + void lines (int count = 1) + { + column = 1u; + line += count; + } + + /// (column related) Advance to the COUNT next columns. + void columns (int count = 1) + { + column = std::max (1u, column + count); + } + /** \} */ + + /// File name to which this position refers. + std::string* filename; + /// Current line number. + unsigned int line; + /// Current column number. + unsigned int column; + }; + + /// Add and assign a position. + inline position& + operator+= (position& res, const int width) + { + res.columns (width); + return res; + } + + /// Add two position objects. + inline const position + operator+ (const position& begin, const int width) + { + position res = begin; + return res += width; + } + + /// Add and assign a position. + inline position& + operator-= (position& res, const int width) + { + return res += -width; + } + + /// Add two position objects. + inline const position + operator- (const position& begin, const int width) + { + return begin + -width; + } + + /// Compare two position objects. + inline bool + operator== (const position& pos1, const position& pos2) + { + return (pos1.line == pos2.line + && pos1.column == pos2.column + && (pos1.filename == pos2.filename + || (pos1.filename && pos2.filename + && *pos1.filename == *pos2.filename))); + } + + /// Compare two position objects. + inline bool + operator!= (const position& pos1, const position& pos2) + { + return !(pos1 == pos2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + template + inline std::basic_ostream& + operator<< (std::basic_ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + + +} // yy +/* Line 148 of location.cc */ +#line 172 "position.hh" +#endif /* !YY_YY_POSITION_HH_INCLUDED */ diff --git a/src/StepFile/recfile.pc b/src/StepFile/recfile.pc index d3f4795d95..a8b0eebbb9 100644 --- a/src/StepFile/recfile.pc +++ b/src/StepFile/recfile.pc @@ -52,9 +52,10 @@ static char txt_cart_p[] = "CARTESIAN_POINT"; -void rec_restext(char* newtext, int lentext) /* destine a etre appele de l'exterieur */ +void rec_restext(const char* constnewtext, int lentext) /* destine a etre appele de l'exterieur */ { - char *res, *text; + char *res, *text, *newtext; + newtext = const_cast(constnewtext); if(strcmp(newtext,txt_cart_p)==0) { restext = txt_cart_p; return; @@ -167,9 +168,18 @@ static char idzero[] = "#0"; /* Trace pour controle */ + +#ifdef __cplusplus +extern "C" { +#endif + void recfile_modeprint(int mode) { modeprint = mode; } +#ifdef __cplusplus +} +#endif + static int lastno; extern int steplineno; extern int modcom; @@ -482,7 +492,9 @@ void scope_fin() La liberation de la memoire est faite par lir_file_fin, en une fois */ - +#ifdef __cplusplus +extern "C" { +#endif void lir_file_nbr(int* nbh, int* nbr, int* nbp) /* initialise le traitement et retourne la taille du directory et du header */ { @@ -562,6 +574,9 @@ int lir_file_arg(int* type, char* *val) return (1) ; } +#ifdef __cplusplus +} +#endif /* Verification de l'integrite des donnees */ @@ -599,6 +614,3 @@ void rec_check(int mode) ("Liste des records pourrie, nb note %d relu %d\n",nbrec,nr) ; } -void steperror (char *mess); -int steplex (void); - diff --git a/src/StepFile/scanner.hpp b/src/StepFile/scanner.hpp new file mode 100644 index 0000000000..2261aa4ee0 --- /dev/null +++ b/src/StepFile/scanner.hpp @@ -0,0 +1,36 @@ +#ifndef __SCANNER_HPP__INCLUDED__ +#define __SCANNER_HPP__INCLUDED__ + +#undef yyFlexLexer +#include +#include "step.tab.hxx" + +// Tell flex which function to define +#ifdef YY_DECL +# undef YY_DECL +#endif +#define YY_DECL \ + int yy::scanner::lex( \ + yy::parser::semantic_type* /*yylval*/, \ + yy::parser::location_type* /*yylloc*/) + + +namespace yy +{ + // To feed data back to bison, the yylex method needs yylval and + // yylloc parameters. Since the yyFlexLexer class is defined in the + // system header the signature of its yylex() method + // can not be changed anymore. This makes it necessary to derive a + // scanner class that provides a method with the desired signature: + + class scanner : public yyFlexLexer + { + public: + explicit scanner(std::istream* in = 0, std::ostream* out = 0); + + int lex(yy::parser::semantic_type* /*yylval*/, + yy::parser::location_type* /*yylloc*/); + }; +} + +#endif // include guard diff --git a/src/StepFile/stack.hh b/src/StepFile/stack.hh new file mode 100644 index 0000000000..0e42eca04c --- /dev/null +++ b/src/StepFile/stack.hh @@ -0,0 +1,137 @@ +/* A Bison parser, made by GNU Bison 2.7. */ + +/* Stack handling for Bison parsers in C++ + + Copyright (C) 2002-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file stack.hh + ** Define the yy::stack class. + */ + +#ifndef YY_YY_STACK_HH_INCLUDED +# define YY_YY_STACK_HH_INCLUDED + +# include + +// disable MSVC warnings in bison code +#ifdef _MSC_VER +#pragma warning(disable:4512) +#endif + +namespace yy { +/* Line 34 of stack.hh */ +#line 47 "stack.hh" + template > + class stack + { + public: + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; + + stack () : seq_ () + { + } + + stack (unsigned int n) : seq_ (n) + { + } + + inline + T& + operator [] (unsigned int i) + { + return seq_[i]; + } + + inline + const T& + operator [] (unsigned int i) const + { + return seq_[i]; + } + + inline + void + push (const T& t) + { + seq_.push_front (t); + } + + inline + void + pop (unsigned int n = 1) + { + for (; n; --n) + seq_.pop_front (); + } + + inline + size_t + height () const + { + return seq_.size (); + } + + inline const_iterator begin () const { return seq_.rbegin (); } + inline const_iterator end () const { return seq_.rend (); } + + private: + S seq_; + }; + + /// Present a slice of the top of a stack. + template > + class slice + { + public: + slice (const S& stack, unsigned int range) + : stack_ (stack) + , range_ (range) + { + } + + inline + const T& + operator [] (unsigned int i) const + { + return stack_[range_ - i]; + } + + private: + const S& stack_; + unsigned int range_; + }; + +} // yy +/* Line 116 of stack.hh */ +#line 132 "stack.hh" + +#endif /* !YY_YY_STACK_HH_INCLUDED */ diff --git a/src/StepFile/step.lex b/src/StepFile/step.lex index 94179ea56b..cd84da3764 100644 --- a/src/StepFile/step.lex +++ b/src/StepFile/step.lex @@ -13,12 +13,27 @@ commercial license or contractual agreement. */ +%option outfile="lex.step.cxx" + /* + c++ generate C++ parser class + 8bit don't fail on 8-bit input characters + warn warn about inconsistencies + nodefault don't create default echo-all rule + noyywrap don't use yywrap() function + yylineno maintains the number of the current line + */ +%option c++ +%option 8bit warn nodefault +%option noyywrap +%option yylineno %{ -#include "step.tab.h" +#include "step.tab.hxx" +#include "scanner.hpp" #include "recfile.ph" #include "stdio.h" #include +typedef yy::parser::token token; /* skl 31.01.2002 for OCC133(OCC96,97) - uncorrect long string in files Henri.stp and 401.stp*/ #define YY_FATAL_ERROR(msg) StepFile_CallFailure( msg ) @@ -30,15 +45,14 @@ long string in files Henri.stp and 401.stp*/ void steperror ( FILE *input_file ); void steprestart ( FILE *input_file ); */ -void rec_restext(char *newtext, int lentext); + +void rec_restext(const char *constnewtext, int lentext); void rec_typarg(int argtype); int steplineno; /* Comptage de ligne (ben oui, fait tout faire) */ int modcom = 0; /* Commentaires type C */ int modend = 0; /* Flag for finishing of the STEP file */ - void resultat () /* Resultat alloue dynamiquement, "jete" une fois lu */ - { if (modcom == 0) rec_restext(yytext,yyleng); } // MSVC specifics #ifdef _MSC_VER @@ -48,7 +62,7 @@ void rec_typarg(int argtype); #if defined(__INTEL_COMPILER) #pragma warning(disable:177 1786 1736) #else -#pragma warning(disable:4131 4244 4273 4267 4127) +#pragma warning(disable:4131 4244 4273 4267 4127 4100) #endif // Avoid includion of unistd.h if parser is generated on Linux (flex 2.5.35) @@ -62,43 +76,56 @@ void rec_typarg(int argtype); #endif %} + %% " " {;} " " {;} [\n] { steplineno ++; } [\r] {;} /* abv 30.06.00: for reading DOS files */ [\0]+ {;} /* fix from C21. for test load e3i file with line 15 with null symbols */ - -#[0-9]+/= { resultat(); if (modcom == 0) return(ENTITY); } -#[0-9]+/[ ]*= { resultat(); if (modcom == 0) return(ENTITY); } -#[0-9]+ { resultat(); if (modcom == 0) return(IDENT); } -[-+0-9][0-9]* { resultat(); if (modcom == 0) { rec_typarg(rec_argInteger); return(QUID); } } -[-+\.0-9][\.0-9]+ { resultat(); if (modcom == 0) { rec_typarg(rec_argFloat); return(QUID); } } -[-+\.0-9][\.0-9]+E[-+0-9][0-9]* { resultat(); if (modcom == 0) { rec_typarg(rec_argFloat); return(QUID); } } -[\']([\n]|[\000\011-\046\050-\176\201-\237\240-\777]|[\047][\047])*[\'] { resultat(); if (modcom == 0) { rec_typarg(rec_argText); return(QUID); } } -["][0-9A-F]+["] { resultat(); if (modcom == 0) { rec_typarg(rec_argHexa); return(QUID); } } -[.][A-Z0-9_]+[.] { resultat(); if (modcom == 0) { rec_typarg(rec_argEnum); return(QUID); } } +#[0-9]+/= { if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::ENTITY); } } +#[0-9]+/[ ]*= { if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::ENTITY); } } +#[0-9]+ { if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::IDENT); } } +[-+0-9][0-9]* { if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argInteger); return(token::QUID); } } +[-+\.0-9][\.0-9]+ { if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argFloat); return(token::QUID); } } +[-+\.0-9][\.0-9]+E[-+0-9][0-9]* { if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argFloat); return(token::QUID); } } +[\']([\n]|[\000\011-\046\050-\176\201-\237\240-\777]|[\047][\047])*[\'] { if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argText); return(token::QUID); } } +["][0-9A-F]+["] { if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argHexa); return(token::QUID); } } +[.][A-Z0-9_]+[.] { if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argEnum); return(token::QUID); } } [(] { if (modcom == 0) return ('('); } [)] { if (modcom == 0) return (')'); } [,] { if (modcom == 0) return (','); } -[$] { resultat(); if (modcom == 0) { rec_typarg(rec_argNondef); return(QUID); } } +[$] { if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argNondef); return(token::QUID); } } [=] { if (modcom == 0) return ('='); } [;] { if (modcom == 0) return (';'); } "/*" { modcom = 1; } "*/" { if (modend == 0) modcom = 0; } -STEP; { if (modcom == 0) return(STEP); } -HEADER; { if (modcom == 0) return(HEADER); } -ENDSEC; { if (modcom == 0) return(ENDSEC); } -DATA; { if (modcom == 0) return(DATA); } -ENDSTEP; { if (modend == 0) {modcom = 0; return(ENDSTEP);} } -"ENDSTEP;".* { if (modend == 0) {modcom = 0; return(ENDSTEP);} } -END-ISO[0-9\-]*; { modcom = 1; modend = 1; return(ENDSTEP); } -ISO[0-9\-]*; { if (modend == 0) {modcom = 0; return(STEP); } } +STEP; { if (modcom == 0) return(token::STEP); } +HEADER; { if (modcom == 0) return(token::HEADER); } +ENDSEC; { if (modcom == 0) return(token::ENDSEC); } +DATA; { if (modcom == 0) return(token::DATA); } +ENDSTEP; { if (modend == 0) {modcom = 0; return(token::ENDSTEP);} } +"ENDSTEP;".* { if (modend == 0) {modcom = 0; return(token::ENDSTEP);} } +END-ISO[0-9\-]*; { modcom = 1; modend = 1; return(token::ENDSTEP); } +ISO[0-9\-]*; { if (modend == 0) {modcom = 0; return(token::STEP); } } [/] { if (modcom == 0) return ('/'); } -&SCOPE { if (modcom == 0) return(SCOPE); } -ENDSCOPE { if (modcom == 0) return(ENDSCOPE); } -[a-zA-Z0-9_]+ { resultat(); if (modcom == 0) return(TYPE); } -![a-zA-Z0-9_]+ { resultat(); if (modcom == 0) return(TYPE); } -[^)] { resultat(); if (modcom == 0) { rec_typarg(rec_argMisc); return(QUID); } } +&SCOPE { if (modcom == 0) return(token::SCOPE); } +ENDSCOPE { if (modcom == 0) return(token::ENDSCOPE); } +[a-zA-Z0-9_]+ { if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::TYPE); } } +![a-zA-Z0-9_]+ { if (modcom == 0) { rec_restext(YYText(),YYLeng()); return(token::TYPE); } } +[^)] { if (modcom == 0) { rec_restext(YYText(),YYLeng()); rec_typarg(rec_argMisc); return(token::QUID); } } + +%% + +yy::scanner::scanner(std::istream* in, std::ostream* out) + : yyFlexLexer(in, out) +{ +} + +int yyFlexLexer::yylex() +{ + throw std::logic_error( + "The yylex() exists for technical reasons and must not be used."); +} \ No newline at end of file diff --git a/src/StepFile/step.tab.c b/src/StepFile/step.tab.c deleted file mode 100644 index 4a574f028f..0000000000 --- a/src/StepFile/step.tab.c +++ /dev/null @@ -1,1799 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.7. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.7" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - -/* Substitute the variable and function names. */ -#define yyparse stepparse -#define yylex steplex -#define yyerror steperror -#define yylval steplval -#define yychar stepchar -#define yydebug stepdebug -#define yynerrs stepnerrs - -/* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 18 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - -#include "recfile.ph" /* definitions des types d'arguments */ -#include "recfile.pc" /* la-dedans, tout y est */ -/* -#define stepparse STEPparse -#define steplex STEPlex -#define stepwrap STEPwrap -#define steprestart STEPrestart -#define steplex STEPlex -#define steplval STEPlval -#define stepval STEPval -#define stepchar STEPchar -#define stepdebug STEPdebug -#define stepnerrs STEPnerrs -#define steperror STEPerror -*/ -#define stepclearin yychar = -1 -#define steperrok yyerrflag = 0 - -/* -#define stepin STEPin -#define yyerrflag STEPerrflag -#define yyerrstatus STEPerrflag -*/ - -/* ABV 19.12.00: merging porting modifications by POP (for WNT, AIX) */ -#if defined(_WIN32) && !defined(MSDOS) -#define MSDOS _WIN32 -#endif -#if defined(_AIX) -#include -#define alloca malloc -#endif - - -// disable MSVC warnings in bison code -#ifdef _MSC_VER -#pragma warning(disable:4244 4131 4127 4702) -#define YYMALLOC malloc -#define YYFREE free -#endif - - -/* Line 371 of yacc.c */ -#line 119 "step.tab.c" - -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "step.tab.h". */ -#ifndef YY_STEP_STEP_TAB_H_INCLUDED -# define YY_STEP_STEP_TAB_H_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int stepdebug; -#endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - STEP = 258, - HEADER = 259, - ENDSEC = 260, - DATA = 261, - ENDSTEP = 262, - SCOPE = 263, - ENDSCOPE = 264, - ENTITY = 265, - TYPE = 266, - INTEGER = 267, - FLOAT = 268, - IDENT = 269, - TEXT = 270, - NONDEF = 271, - ENUM = 272, - HEXA = 273, - QUID = 274 - }; -#endif - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -extern YYSTYPE steplval; - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int stepparse (void *YYPARSE_PARAM); -#else -int stepparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int stepparse (void); -#else -int stepparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - -#endif /* !YY_STEP_STEP_TAB_H_INCLUDED */ - -/* Copy the second part of user declarations. */ - -/* Line 390 of yacc.c */ -#line 204 "step.tab.c" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(N) (N) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; -#endif -{ - return yyi; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 7 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 81 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 27 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 27 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 49 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 85 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 274 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 20, 2, 2, 2, 2, 2, 2, 2, - 22, 23, 2, 2, 24, 2, 2, 26, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 21, - 2, 25, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 5, 8, 10, 13, 22, 30, 37, - 39, 41, 43, 45, 48, 52, 54, 56, 58, 60, - 62, 65, 67, 69, 71, 73, 76, 80, 83, 85, - 89, 92, 94, 97, 102, 110, 117, 119, 122, 126, - 129, 133, 135, 137, 139, 143, 145, 147, 152, 154 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 33, 0, -1, 20, -1, 28, 20, -1, 7, -1, - 7, 28, -1, 3, 4, 34, 5, 36, 43, 5, - 29, -1, 3, 4, 5, 36, 43, 5, 7, -1, - 3, 4, 5, 36, 43, 1, -1, 30, -1, 31, - -1, 32, -1, 35, -1, 34, 35, -1, 53, 41, - 21, -1, 1, -1, 6, -1, 14, -1, 19, -1, - 41, -1, 38, 41, -1, 1, -1, 11, -1, 22, - -1, 23, -1, 39, 40, -1, 39, 42, 40, -1, - 39, 1, -1, 37, -1, 42, 24, 37, -1, 42, - 1, -1, 44, -1, 43, 44, -1, 52, 25, 46, - 21, -1, 52, 25, 47, 43, 51, 46, 21, -1, - 52, 25, 47, 51, 46, 21, -1, 1, -1, 53, - 41, -1, 45, 53, 41, -1, 53, 41, -1, 22, - 45, 23, -1, 8, -1, 14, -1, 48, -1, 49, - 24, 48, -1, 26, -1, 9, -1, 9, 50, 49, - 26, -1, 10, -1, 11, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint8 yyrline[] = -{ - 0, 64, 64, 65, 66, 67, 68, 69, 70, 71, - 71, 71, 74, 75, 77, 78, 80, 83, 84, 85, - 86, 87, 91, 94, 97, 102, 103, 104, 106, 107, - 108, 110, 111, 113, 114, 115, 116, 118, 119, 121, - 122, 124, 127, 130, 131, 133, 136, 138, 143, 146 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 0 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "STEP", "HEADER", "ENDSEC", "DATA", - "ENDSTEP", "SCOPE", "ENDSCOPE", "ENTITY", "TYPE", "INTEGER", "FLOAT", - "IDENT", "TEXT", "NONDEF", "ENUM", "HEXA", "QUID", "' '", "';'", "'('", - "')'", "','", "'='", "'/'", "$accept", "finvide", "finstep", "stepf1", - "stepf2", "stepf3", "stepf", "headl", "headent", "endhead", "unarg", - "listype", "deblist", "finlist", "listarg", "arglist", "model", "bloc", - "plex", "unent", "debscop", "unid", "export", "debexp", "finscop", - "entlab", "enttype", YY_NULL -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 32, 59, 40, 41, 44, 61, 47 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 27, 28, 28, 29, 29, 30, 31, 32, 33, - 33, 33, 34, 34, 35, 35, 36, 37, 37, 37, - 37, 37, 38, 39, 40, 41, 41, 41, 42, 42, - 42, 43, 43, 44, 44, 44, 44, 45, 45, 46, - 46, 47, 48, 49, 49, 50, 51, 51, 52, 53 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 2, 1, 2, 8, 7, 6, 1, - 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, - 2, 1, 1, 1, 1, 2, 3, 2, 1, 3, - 2, 1, 2, 4, 7, 6, 1, 2, 3, 2, - 3, 1, 1, 1, 3, 1, 1, 4, 1, 1 -}; - -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 0, 9, 10, 11, 0, 0, 1, 15, 0, - 49, 0, 12, 0, 16, 0, 0, 13, 23, 0, - 0, 36, 48, 0, 31, 0, 0, 21, 22, 17, - 18, 24, 28, 0, 25, 19, 0, 14, 36, 0, - 32, 0, 0, 20, 30, 0, 26, 7, 41, 0, - 0, 0, 0, 0, 21, 29, 0, 0, 33, 46, - 0, 0, 39, 4, 6, 40, 0, 37, 45, 0, - 0, 0, 2, 5, 38, 42, 43, 0, 0, 35, - 3, 0, 47, 34, 44 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 73, 64, 2, 3, 4, 5, 11, 12, 15, - 32, 33, 19, 34, 35, 36, 23, 24, 56, 50, - 51, 76, 77, 69, 61, 25, 52 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -26 -static const yytype_int8 yypact[] = -{ - 27, 30, -26, -26, -26, 31, 36, -26, -26, 55, - -26, 49, -26, 14, -26, 41, 55, -26, -26, 10, - 42, -26, -26, 9, -26, 37, 41, -3, -26, -26, - -26, -26, -26, 14, -26, -26, 4, -26, 65, 59, - -26, 1, 54, -26, -26, 24, -26, -26, -26, 56, - 48, 47, 14, 61, -26, -26, -7, 14, -26, 44, - 47, -5, -26, 51, -26, -26, 14, -26, -26, 58, - -5, 52, -26, 57, -26, -26, -26, -11, 53, -26, - -26, 58, -26, -26, -26 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -26, -26, -26, -26, -26, -26, -26, -26, 64, 60, - 33, -26, -26, 43, -13, -26, -25, -20, -26, -12, - -26, -1, -26, -26, 21, -26, -4 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -28 -static const yytype_int8 yytable[] = -{ - 20, 42, 13, 40, 10, 44, 10, 13, -27, 48, - 38, 27, 10, 81, 39, 82, 65, 49, -27, 22, - 43, 28, 40, 49, 29, 54, 60, 31, 45, 30, - 1, 7, 18, 31, 6, 28, 18, 8, 29, 62, - 40, 9, 21, 30, 67, 57, 18, 10, 21, 71, - 8, 22, 66, 74, 16, 21, 59, 22, 78, 53, - 10, 14, 41, 37, 22, -8, 47, 10, 63, 58, - 68, 72, 75, 79, 83, 17, 26, 80, 55, 46, - 84, 70 -}; - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-26))) - -#define yytable_value_is_error(Yytable_value) \ - YYID (0) - -static const yytype_uint8 yycheck[] = -{ - 13, 26, 6, 23, 11, 1, 11, 11, 11, 8, - 1, 1, 11, 24, 5, 26, 23, 22, 21, 10, - 33, 11, 42, 22, 14, 1, 51, 23, 24, 19, - 3, 0, 22, 23, 4, 11, 22, 1, 14, 52, - 60, 5, 1, 19, 57, 49, 22, 11, 1, 61, - 1, 10, 56, 66, 5, 1, 9, 10, 70, 5, - 11, 6, 25, 21, 10, 0, 7, 11, 7, 21, - 26, 20, 14, 21, 21, 11, 16, 20, 45, 36, - 81, 60 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 3, 30, 31, 32, 33, 4, 0, 1, 5, - 11, 34, 35, 53, 6, 36, 5, 35, 22, 39, - 41, 1, 10, 43, 44, 52, 36, 1, 11, 14, - 19, 23, 37, 38, 40, 41, 42, 21, 1, 5, - 44, 25, 43, 41, 1, 24, 40, 7, 8, 22, - 46, 47, 53, 5, 1, 37, 45, 53, 21, 9, - 43, 51, 41, 7, 29, 23, 53, 41, 26, 50, - 51, 46, 20, 28, 41, 14, 48, 49, 46, 21, - 20, 24, 26, 21, 48 -}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULL; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - - - - -/* The lookahead symbol. */ -int yychar; - - -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); - -/* Number of syntax errors so far. */ -int yynerrs; - - -/*----------. -| yyparse. | -`----------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 11: -/* Line 1792 of yacc.c */ -#line 72 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_finfile(); return(0); /* fini pour celui-la */ } - break; - - case 16: -/* Line 1792 of yacc.c */ -#line 81 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_finhead(); } - break; - - case 17: -/* Line 1792 of yacc.c */ -#line 83 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_typarg(rec_argIdent); rec_newarg(); } - break; - - case 18: -/* Line 1792 of yacc.c */ -#line 84 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { /* deja fait par lex*/ rec_newarg(); } - break; - - case 19: -/* Line 1792 of yacc.c */ -#line 85 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_newarg(); } - break; - - case 20: -/* Line 1792 of yacc.c */ -#line 86 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_newarg(); } - break; - - case 21: -/* Line 1792 of yacc.c */ -#line 87 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_typarg(rec_argMisc); rec_newarg(); - yyerrstatus = 1; yyclearin; } - break; - - case 22: -/* Line 1792 of yacc.c */ -#line 92 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_listype(); } - break; - - case 23: -/* Line 1792 of yacc.c */ -#line 95 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_deblist(); } - break; - - case 24: -/* Line 1792 of yacc.c */ -#line 98 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { if (modeprint > 0) - { printf("Record no : %d -- ",nbrec+1); rec_print(currec); } - rec_newent (); yyerrstatus = 0; } - break; - - case 41: -/* Line 1792 of yacc.c */ -#line 125 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { scope_debut(); } - break; - - case 42: -/* Line 1792 of yacc.c */ -#line 128 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_typarg(rec_argIdent); rec_newarg(); } - break; - - case 45: -/* Line 1792 of yacc.c */ -#line 134 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_deblist(); } - break; - - case 46: -/* Line 1792 of yacc.c */ -#line 137 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { scope_fin(); } - break; - - case 47: -/* Line 1792 of yacc.c */ -#line 139 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { printf("*** Warning : Export List not yet processed\n"); - rec_newent(); scope_fin() ; } - break; - - case 48: -/* Line 1792 of yacc.c */ -#line 144 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_ident(); } - break; - - case 49: -/* Line 1792 of yacc.c */ -#line 147 "D:/ABV/OCCT/occt7/src/StepFile/step.yacc" - { rec_type (); } - break; - - -/* Line 1792 of yacc.c */ -#line 1570 "step.tab.c" - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - diff --git a/src/StepFile/step.tab.cxx b/src/StepFile/step.tab.cxx new file mode 100644 index 0000000000..660f7fff53 --- /dev/null +++ b/src/StepFile/step.tab.cxx @@ -0,0 +1,1076 @@ +/* A Bison parser, made by GNU Bison 2.7. */ + +/* Skeleton implementation for Bison LALR(1) parsers in C++ + + Copyright (C) 2002-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* First part of user declarations. */ + +/* Line 279 of lalr1.cc */ +#line 38 "step.tab.cxx" + + +#include "step.tab.hxx" + +/* User implementation prologue. */ + +/* Line 285 of lalr1.cc */ +#line 46 "step.tab.cxx" +/* Unqualified %code blocks. */ +/* Line 286 of lalr1.cc */ +#line 39 "StepFile/step.yacc" + +#include "recfile.ph" /* definitions des types d'arguments */ +#include "recfile.pc" /* la-dedans, tout y est */ +#include "scanner.hpp" +#undef yylex +#define yylex scanner->lex +/* +#define stepparse STEPparse +#define steplex STEPlex +#define stepwrap STEPwrap +#define steprestart STEPrestart +#define steplex STEPlex +#define steplval STEPlval +#define stepval STEPval +#define stepchar STEPchar +#define stepdebug STEPdebug +#define stepnerrs STEPnerrs +#define steperror STEPerror +*/ + +#define stepclearin yychar = -1 +#define steperrok yyerrflag = 0 + +/* +#define stepin STEPin +#define yyerrflag STEPerrflag +#define yyerrstatus STEPerrflag +*/ + +/* ABV 19.12.00: merging porting modifications by POP (for WNT, AIX) */ +#if defined(WNT) && !defined(MSDOS) +#define MSDOS WNT +#endif +#if defined(_AIX) +#include +#define alloca malloc +#endif + + +// disable MSVC warnings in bison code +#ifdef _MSC_VER +#pragma warning(disable:4065 4244 4131 4127 4702) +#define YYMALLOC malloc +#define YYFREE free +#endif +void StepFile_Interrupt (char* nomfic); /* rln 13.09.00 port on HP*/ + + +/* Line 286 of lalr1.cc */ +#line 99 "step.tab.cxx" + + +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* FIXME: INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +# ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).begin = YYRHSLOC (Rhs, 1).begin; \ + (Current).end = YYRHSLOC (Rhs, N).end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ + } \ + while (/*CONSTCOND*/ false) +# endif + + +/* Suppress unused-variable warnings by "using" E. */ +#define YYUSE(e) ((void) (e)) + +/* Enable debugging if requested. */ +#if YYDEBUG + +/* A pseudo ostream that takes yydebug_ into account. */ +# define YYCDEBUG if (yydebug_) (*yycdebug_) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug_) \ + { \ + *yycdebug_ << Title << ' '; \ + yy_symbol_print_ ((Type), (Value), (Location)); \ + *yycdebug_ << std::endl; \ + } \ +} while (false) + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug_) \ + yy_reduce_print_ (Rule); \ +} while (false) + +# define YY_STACK_PRINT() \ +do { \ + if (yydebug_) \ + yystack_print_ (); \ +} while (false) + +#else /* !YYDEBUG */ + +# define YYCDEBUG if (false) std::cerr +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) YYUSE(Type) +# define YY_REDUCE_PRINT(Rule) static_cast(0) +# define YY_STACK_PRINT() static_cast(0) + +#endif /* !YYDEBUG */ + +#define yyerrok (yyerrstatus_ = 0) +#define yyclearin (yychar = yyempty_) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYRECOVERING() (!!yyerrstatus_) + + +namespace yy { +/* Line 353 of lalr1.cc */ +#line 194 "step.tab.cxx" + + /// Build a parser object. + parser::parser (yy::scanner* scanner_yyarg) + : +#if YYDEBUG + yydebug_ (false), + yycdebug_ (&std::cerr), +#endif + scanner (scanner_yyarg) + { + } + + parser::~parser () + { + } + +#if YYDEBUG + /*--------------------------------. + | Print this symbol on YYOUTPUT. | + `--------------------------------*/ + + inline void + parser::yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + YYUSE (yylocationp); + YYUSE (yyvaluep); + std::ostream& yyo = debug_stream (); + std::ostream& yyoutput = yyo; + YYUSE (yyoutput); + switch (yytype) + { + default: + break; + } + } + + + void + parser::yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") + << ' ' << yytname_[yytype] << " (" + << *yylocationp << ": "; + yy_symbol_value_print_ (yytype, yyvaluep, yylocationp); + *yycdebug_ << ')'; + } +#endif + + void + parser::yydestruct_ (const char* yymsg, + int yytype, semantic_type* yyvaluep, location_type* yylocationp) + { + YYUSE (yylocationp); + YYUSE (yymsg); + YYUSE (yyvaluep); + + if (yymsg) + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } + } + + void + parser::yypop_ (unsigned int n) + { + yystate_stack_.pop (n); + yysemantic_stack_.pop (n); + yylocation_stack_.pop (n); + } + +#if YYDEBUG + std::ostream& + parser::debug_stream () const + { + return *yycdebug_; + } + + void + parser::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + parser::debug_level_type + parser::debug_level () const + { + return yydebug_; + } + + void + parser::set_debug_level (debug_level_type l) + { + yydebug_ = l; + } +#endif + + inline bool + parser::yy_pact_value_is_default_ (int yyvalue) + { + return yyvalue == yypact_ninf_; + } + + inline bool + parser::yy_table_value_is_error_ (int yyvalue) + { + return yyvalue == yytable_ninf_; + } + + int + parser::parse () + { + /// Lookahead and lookahead in internal form. + int yychar = yyempty_; + int yytoken = 0; + + // State. + int yyn; + int yylen = 0; + int yystate = 0; + + // Error handling. + int yynerrs_ = 0; + int yyerrstatus_ = 0; + + /// Semantic value of the lookahead. + static semantic_type yyval_default; + semantic_type yylval = yyval_default; + /// Location of the lookahead. + location_type yylloc; + /// The locations where the error started and ended. + location_type yyerror_range[3]; + + /// $$. + semantic_type yyval; + /// @$. + location_type yyloc; + + int yyresult; + + // FIXME: This shoud be completely indented. It is not yet to + // avoid gratuitous conflicts when merging into the master branch. + try + { + YYCDEBUG << "Starting parse" << std::endl; + + + /* Initialize the stacks. The initial state will be pushed in + yynewstate, since the latter expects the semantical and the + location values to have been already stored, initialize these + stacks with a primary value. */ + yystate_stack_ = state_stack_type (0); + yysemantic_stack_ = semantic_stack_type (0); + yylocation_stack_ = location_stack_type (0); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); + + /* New state. */ + yynewstate: + yystate_stack_.push (yystate); + YYCDEBUG << "Entering state " << yystate << std::endl; + + /* Accept? */ + if (yystate == yyfinal_) + goto yyacceptlab; + + goto yybackup; + + /* Backup. */ + yybackup: + + /* Try to take a decision without lookahead. */ + yyn = yypact_[yystate]; + if (yy_pact_value_is_default_ (yyn)) + goto yydefault; + + /* Read a lookahead token. */ + if (yychar == yyempty_) + { + YYCDEBUG << "Reading a token: "; + yychar = yylex (&yylval, &yylloc); + } + + /* Convert token to internal form. */ + if (yychar <= yyeof_) + { + yychar = yytoken = yyeof_; + YYCDEBUG << "Now at end of input." << std::endl; + } + else + { + yytoken = yytranslate_ (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) + goto yydefault; + + /* Reduce or error. */ + yyn = yytable_[yyn]; + if (yyn <= 0) + { + if (yy_table_value_is_error_ (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the token being shifted. */ + yychar = yyempty_; + + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus_) + --yyerrstatus_; + + yystate = yyn; + goto yynewstate; + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact_[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + /*-----------------------------. + | yyreduce -- Do a reduction. | + `-----------------------------*/ + yyreduce: + yylen = yyr2_[yyn]; + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. Otherwise, use the top of the stack. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. */ + if (yylen) + yyval = yysemantic_stack_[yylen - 1]; + else + yyval = yysemantic_stack_[0]; + + // Compute the default @$. + { + slice slice (yylocation_stack_, yylen); + YYLLOC_DEFAULT (yyloc, slice, yylen); + } + + // Perform the reduction. + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 11: +/* Line 670 of lalr1.cc */ +#line 97 "StepFile/step.yacc" + { rec_finfile(); return(0); /* fini pour celui-la */ } + break; + + case 16: +/* Line 670 of lalr1.cc */ +#line 106 "StepFile/step.yacc" + { rec_finhead(); } + break; + + case 17: +/* Line 670 of lalr1.cc */ +#line 108 "StepFile/step.yacc" + { rec_typarg(rec_argIdent); rec_newarg(); } + break; + + case 18: +/* Line 670 of lalr1.cc */ +#line 109 "StepFile/step.yacc" + { /* deja fait par lex*/ rec_newarg(); } + break; + + case 19: +/* Line 670 of lalr1.cc */ +#line 110 "StepFile/step.yacc" + { rec_newarg(); } + break; + + case 20: +/* Line 670 of lalr1.cc */ +#line 111 "StepFile/step.yacc" + { rec_newarg(); } + break; + + case 21: +/* Line 670 of lalr1.cc */ +#line 112 "StepFile/step.yacc" + { rec_typarg(rec_argMisc); rec_newarg(); + yyerrstatus_ = 1; yyclearin; } + break; + + case 22: +/* Line 670 of lalr1.cc */ +#line 117 "StepFile/step.yacc" + { rec_listype(); } + break; + + case 23: +/* Line 670 of lalr1.cc */ +#line 120 "StepFile/step.yacc" + { rec_deblist(); } + break; + + case 24: +/* Line 670 of lalr1.cc */ +#line 123 "StepFile/step.yacc" + { if (modeprint > 0) + { printf("Record no : %d -- ",nbrec+1); rec_print(currec); } + rec_newent (); yyerrstatus_ = 0; } + break; + + case 41: +/* Line 670 of lalr1.cc */ +#line 150 "StepFile/step.yacc" + { scope_debut(); } + break; + + case 42: +/* Line 670 of lalr1.cc */ +#line 153 "StepFile/step.yacc" + { rec_typarg(rec_argIdent); rec_newarg(); } + break; + + case 45: +/* Line 670 of lalr1.cc */ +#line 159 "StepFile/step.yacc" + { rec_deblist(); } + break; + + case 46: +/* Line 670 of lalr1.cc */ +#line 162 "StepFile/step.yacc" + { scope_fin(); } + break; + + case 47: +/* Line 670 of lalr1.cc */ +#line 164 "StepFile/step.yacc" + { printf("*** Warning : Export List not yet processed\n"); + rec_newent(); scope_fin() ; } + break; + + case 48: +/* Line 670 of lalr1.cc */ +#line 169 "StepFile/step.yacc" + { rec_ident(); } + break; + + case 49: +/* Line 670 of lalr1.cc */ +#line 172 "StepFile/step.yacc" + { rec_type (); } + break; + + +/* Line 670 of lalr1.cc */ +#line 573 "step.tab.cxx" + default: + break; + } + + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action + invokes YYABORT, YYACCEPT, or YYERROR immediately after altering + yychar. In the case of YYABORT or YYACCEPT, an incorrect + destructor might then be invoked immediately. In the case of + YYERROR, subsequent parser actions might lead to an incorrect + destructor call or verbose syntax error message before the + lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); + + yypop_ (yylen); + yylen = 0; + YY_STACK_PRINT (); + + yysemantic_stack_.push (yyval); + yylocation_stack_.push (yyloc); + + /* Shift the result of the reduction. */ + yyn = yyr1_[yyn]; + yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0]; + if (0 <= yystate && yystate <= yylast_ + && yycheck_[yystate] == yystate_stack_[0]) + yystate = yytable_[yystate]; + else + yystate = yydefgoto_[yyn - yyntokens_]; + goto yynewstate; + + /*------------------------------------. + | yyerrlab -- here on detecting error | + `------------------------------------*/ + yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yytranslate_ (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus_) + { + ++yynerrs_; + if (yychar == yyempty_) + yytoken = yyempty_; + error (yysyntax_error_ (yystate, yytoken)); + } + + yyerror_range[1] = yylloc; + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + if (yychar <= yyeof_) + { + /* Return failure if at end of input. */ + if (yychar == yyeof_) + YYABORT; + } + else + { + yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc); + yychar = yyempty_; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + + /*---------------------------------------------------. + | yyerrorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (false) + goto yyerrorlab; + + yyerror_range[1] = yylocation_stack_[yylen - 1]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + yypop_ (yylen); + yylen = 0; + yystate = yystate_stack_[0]; + goto yyerrlab1; + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus_ = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact_[yystate]; + if (!yy_pact_value_is_default_ (yyn)) + { + yyn += yyterror_; + if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) + { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yystate_stack_.height () == 1) + YYABORT; + + yyerror_range[1] = yylocation_stack_[0]; + yydestruct_ ("Error: popping", + yystos_[yystate], + &yysemantic_stack_[0], &yylocation_stack_[0]); + yypop_ (); + yystate = yystate_stack_[0]; + YY_STACK_PRINT (); + } + + yyerror_range[2] = yylloc; + // Using YYLLOC is tempting, but would change the location of + // the lookahead. YYLOC is available though. + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yyloc); + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos_[yyn], + &yysemantic_stack_[0], &yylocation_stack_[0]); + + yystate = yyn; + goto yynewstate; + + /* Accept. */ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + /* Abort. */ + yyabortlab: + yyresult = 1; + goto yyreturn; + + yyreturn: + if (yychar != yyempty_) + { + /* Make sure we have latest lookahead translation. See comments + at user semantic actions for why this is necessary. */ + yytoken = yytranslate_ (yychar); + yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, + &yylloc); + } + + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + yypop_ (yylen); + while (1 < yystate_stack_.height ()) + { + yydestruct_ ("Cleanup: popping", + yystos_[yystate_stack_[0]], + &yysemantic_stack_[0], + &yylocation_stack_[0]); + yypop_ (); + } + + return yyresult; + } + catch (...) + { + YYCDEBUG << "Exception caught: cleaning lookahead and stack" + << std::endl; + // Do not try to display the values of the reclaimed symbols, + // as their printer might throw an exception. + if (yychar != yyempty_) + { + /* Make sure we have latest lookahead translation. See + comments at user semantic actions for why this is + necessary. */ + yytoken = yytranslate_ (yychar); + yydestruct_ (YY_NULL, yytoken, &yylval, &yylloc); + } + + while (1 < yystate_stack_.height ()) + { + yydestruct_ (YY_NULL, + yystos_[yystate_stack_[0]], + &yysemantic_stack_[0], + &yylocation_stack_[0]); + yypop_ (); + } + throw; + } + } + + // Generate an error message. + std::string + parser::yysyntax_error_ (int, int) + { + return YY_("syntax error"); + } + + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + const signed char parser::yypact_ninf_ = -26; + const signed char + parser::yypact_[] = + { + 27, 30, -26, -26, -26, 31, 36, -26, -26, 55, + -26, 49, -26, 14, -26, 41, 55, -26, -26, 10, + 42, -26, -26, 9, -26, 37, 41, -3, -26, -26, + -26, -26, -26, 14, -26, -26, 4, -26, 65, 59, + -26, 1, 54, -26, -26, 24, -26, -26, -26, 56, + 48, 47, 14, 61, -26, -26, -7, 14, -26, 44, + 47, -5, -26, 51, -26, -26, 14, -26, -26, 58, + -5, 52, -26, 57, -26, -26, -26, -11, 53, -26, + -26, 58, -26, -26, -26 + }; + + /* YYDEFACT[S] -- default reduction number in state S. Performed when + YYTABLE doesn't specify something else to do. Zero means the + default is an error. */ + const unsigned char + parser::yydefact_[] = + { + 0, 0, 9, 10, 11, 0, 0, 1, 15, 0, + 49, 0, 12, 0, 16, 0, 0, 13, 23, 0, + 0, 36, 48, 0, 31, 0, 0, 21, 22, 17, + 18, 24, 28, 0, 25, 19, 0, 14, 36, 0, + 32, 0, 0, 20, 30, 0, 26, 7, 41, 0, + 0, 0, 0, 0, 21, 29, 0, 0, 33, 46, + 0, 0, 39, 4, 6, 40, 0, 37, 45, 0, + 0, 0, 2, 5, 38, 42, 43, 0, 0, 35, + 3, 0, 47, 34, 44 + }; + + /* YYPGOTO[NTERM-NUM]. */ + const signed char + parser::yypgoto_[] = + { + -26, -26, -26, -26, -26, -26, -26, -26, 64, 60, + 33, -26, -26, 43, -13, -26, -25, -20, -26, -12, + -26, -1, -26, -26, 21, -26, -4 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + const signed char + parser::yydefgoto_[] = + { + -1, 73, 64, 2, 3, 4, 5, 11, 12, 15, + 32, 33, 19, 34, 35, 36, 23, 24, 56, 50, + 51, 76, 77, 69, 61, 25, 52 + }; + + /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If YYTABLE_NINF_, syntax error. */ + const signed char parser::yytable_ninf_ = -28; + const signed char + parser::yytable_[] = + { + 20, 42, 13, 40, 10, 44, 10, 13, -27, 48, + 38, 27, 10, 81, 39, 82, 65, 49, -27, 22, + 43, 28, 40, 49, 29, 54, 60, 31, 45, 30, + 1, 7, 18, 31, 6, 28, 18, 8, 29, 62, + 40, 9, 21, 30, 67, 57, 18, 10, 21, 71, + 8, 22, 66, 74, 16, 21, 59, 22, 78, 53, + 10, 14, 41, 37, 22, -8, 47, 10, 63, 58, + 68, 72, 75, 79, 83, 17, 26, 80, 55, 46, + 84, 70 + }; + + /* YYCHECK. */ + const unsigned char + parser::yycheck_[] = + { + 13, 26, 6, 23, 11, 1, 11, 11, 11, 8, + 1, 1, 11, 24, 5, 26, 23, 22, 21, 10, + 33, 11, 42, 22, 14, 1, 51, 23, 24, 19, + 3, 0, 22, 23, 4, 11, 22, 1, 14, 52, + 60, 5, 1, 19, 57, 49, 22, 11, 1, 61, + 1, 10, 56, 66, 5, 1, 9, 10, 70, 5, + 11, 6, 25, 21, 10, 0, 7, 11, 7, 21, + 26, 20, 14, 21, 21, 11, 16, 20, 45, 36, + 81, 60 + }; + + /* STOS_[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + const unsigned char + parser::yystos_[] = + { + 0, 3, 30, 31, 32, 33, 4, 0, 1, 5, + 11, 34, 35, 53, 6, 36, 5, 35, 22, 39, + 41, 1, 10, 43, 44, 52, 36, 1, 11, 14, + 19, 23, 37, 38, 40, 41, 42, 21, 1, 5, + 44, 25, 43, 41, 1, 24, 40, 7, 8, 22, + 46, 47, 53, 5, 1, 37, 45, 53, 21, 9, + 43, 51, 41, 7, 29, 23, 53, 41, 26, 50, + 51, 46, 20, 28, 41, 14, 48, 49, 46, 21, + 20, 24, 26, 21, 48 + }; + +#if YYDEBUG + /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding + to YYLEX-NUM. */ + const unsigned short int + parser::yytoken_number_[] = + { + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 32, 59, 40, 41, 44, 61, 47 + }; +#endif + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + const unsigned char + parser::yyr1_[] = + { + 0, 27, 28, 28, 29, 29, 30, 31, 32, 33, + 33, 33, 34, 34, 35, 35, 36, 37, 37, 37, + 37, 37, 38, 39, 40, 41, 41, 41, 42, 42, + 42, 43, 43, 44, 44, 44, 44, 45, 45, 46, + 46, 47, 48, 49, 49, 50, 51, 51, 52, 53 + }; + + /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ + const unsigned char + parser::yyr2_[] = + { + 0, 2, 1, 2, 1, 2, 8, 7, 6, 1, + 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, + 2, 1, 1, 1, 1, 2, 3, 2, 1, 3, + 2, 1, 2, 4, 7, 6, 1, 2, 3, 2, + 3, 1, 1, 1, 3, 1, 1, 4, 1, 1 + }; + +#if YYDEBUG + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at \a yyntokens_, nonterminals. */ + const char* + const parser::yytname_[] = + { + "$end", "error", "$undefined", "STEP", "HEADER", "ENDSEC", "DATA", + "ENDSTEP", "SCOPE", "ENDSCOPE", "ENTITY", "TYPE", "INTEGER", "FLOAT", + "IDENT", "TEXT", "NONDEF", "ENUM", "HEXA", "QUID", "' '", "';'", "'('", + "')'", "','", "'='", "'/'", "$accept", "finvide", "finstep", "stepf1", + "stepf2", "stepf3", "stepf", "headl", "headent", "endhead", "unarg", + "listype", "deblist", "finlist", "listarg", "arglist", "model", "bloc", + "plex", "unent", "debscop", "unid", "export", "debexp", "finscop", + "entlab", "enttype", YY_NULL + }; + + + /* YYRHS -- A `-1'-separated list of the rules' RHS. */ + const parser::rhs_number_type + parser::yyrhs_[] = + { + 33, 0, -1, 20, -1, 28, 20, -1, 7, -1, + 7, 28, -1, 3, 4, 34, 5, 36, 43, 5, + 29, -1, 3, 4, 5, 36, 43, 5, 7, -1, + 3, 4, 5, 36, 43, 1, -1, 30, -1, 31, + -1, 32, -1, 35, -1, 34, 35, -1, 53, 41, + 21, -1, 1, -1, 6, -1, 14, -1, 19, -1, + 41, -1, 38, 41, -1, 1, -1, 11, -1, 22, + -1, 23, -1, 39, 40, -1, 39, 42, 40, -1, + 39, 1, -1, 37, -1, 42, 24, 37, -1, 42, + 1, -1, 44, -1, 43, 44, -1, 52, 25, 46, + 21, -1, 52, 25, 47, 43, 51, 46, 21, -1, + 52, 25, 47, 51, 46, 21, -1, 1, -1, 53, + 41, -1, 45, 53, 41, -1, 53, 41, -1, 22, + 45, 23, -1, 8, -1, 14, -1, 48, -1, 49, + 24, 48, -1, 26, -1, 9, -1, 9, 50, 49, + 26, -1, 10, -1, 11, -1 + }; + + /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ + const unsigned char + parser::yyprhs_[] = + { + 0, 0, 3, 5, 8, 10, 13, 22, 30, 37, + 39, 41, 43, 45, 48, 52, 54, 56, 58, 60, + 62, 65, 67, 69, 71, 73, 76, 80, 83, 85, + 89, 92, 94, 97, 102, 110, 117, 119, 122, 126, + 129, 133, 135, 137, 139, 143, 145, 147, 152, 154 + }; + + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + const unsigned char + parser::yyrline_[] = + { + 0, 89, 89, 90, 91, 92, 93, 94, 95, 96, + 96, 96, 99, 100, 102, 103, 105, 108, 109, 110, + 111, 112, 116, 119, 122, 127, 128, 129, 131, 132, + 133, 135, 136, 138, 139, 140, 141, 143, 144, 146, + 147, 149, 152, 155, 156, 158, 161, 163, 168, 171 + }; + + // Print the state stack on the debug stream. + void + parser::yystack_print_ () + { + *yycdebug_ << "Stack now"; + for (state_stack_type::const_iterator i = yystate_stack_.begin (); + i != yystate_stack_.end (); ++i) + *yycdebug_ << ' ' << *i; + *yycdebug_ << std::endl; + } + + // Report on the debug stream that the rule \a yyrule is going to be reduced. + void + parser::yy_reduce_print_ (int yyrule) + { + unsigned int yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + /* Print the symbols being reduced, and their result. */ + *yycdebug_ << "Reducing stack by rule " << yyrule - 1 + << " (line " << yylno << "):" << std::endl; + /* The symbols being reduced. */ + for (int yyi = 0; yyi < yynrhs; yyi++) + YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", + yyrhs_[yyprhs_[yyrule] + yyi], + &(yysemantic_stack_[(yynrhs) - (yyi + 1)]), + &(yylocation_stack_[(yynrhs) - (yyi + 1)])); + } +#endif // YYDEBUG + + /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ + parser::token_number_type + parser::yytranslate_ (int t) + { + static + const token_number_type + translate_table[] = + { + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 20, 2, 2, 2, 2, 2, 2, 2, + 22, 23, 2, 2, 24, 2, 2, 26, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 21, + 2, 25, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19 + }; + if ((unsigned int) t <= yyuser_token_number_max_) + return translate_table[t]; + else + return yyundef_token_; + } + + const int parser::yyeof_ = 0; + const int parser::yylast_ = 81; + const int parser::yynnts_ = 27; + const int parser::yyempty_ = -2; + const int parser::yyfinal_ = 7; + const int parser::yyterror_ = 1; + const int parser::yyerrcode_ = 256; + const int parser::yyntokens_ = 27; + + const unsigned int parser::yyuser_token_number_max_ = 274; + const parser::token_number_type parser::yyundef_token_ = 2; + + +} // yy +/* Line 1141 of lalr1.cc */ +#line 1067 "step.tab.cxx" +/* Line 1142 of lalr1.cc */ +#line 174 "StepFile/step.yacc" + + +void yy::parser::error(const std::string& m) +{ + char newmess[80]; + sprintf(newmess, "At line %d : %s", scanner->lineno() + 1, m.c_str()); + StepFile_Interrupt(newmess); +} diff --git a/src/StepFile/step.tab.h b/src/StepFile/step.tab.h deleted file mode 100644 index 803d863826..0000000000 --- a/src/StepFile/step.tab.h +++ /dev/null @@ -1,93 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.7. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_STEP_STEP_TAB_H_INCLUDED -# define YY_STEP_STEP_TAB_H_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int stepdebug; -#endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - STEP = 258, - HEADER = 259, - ENDSEC = 260, - DATA = 261, - ENDSTEP = 262, - SCOPE = 263, - ENDSCOPE = 264, - ENTITY = 265, - TYPE = 266, - INTEGER = 267, - FLOAT = 268, - IDENT = 269, - TEXT = 270, - NONDEF = 271, - ENUM = 272, - HEXA = 273, - QUID = 274 - }; -#endif - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -extern YYSTYPE steplval; - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int stepparse (void *YYPARSE_PARAM); -#else -int stepparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int stepparse (void); -#else -int stepparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - -#endif /* !YY_STEP_STEP_TAB_H_INCLUDED */ diff --git a/src/StepFile/step.tab.hxx b/src/StepFile/step.tab.hxx new file mode 100644 index 0000000000..9fc468cec4 --- /dev/null +++ b/src/StepFile/step.tab.hxx @@ -0,0 +1,285 @@ +/* A Bison parser, made by GNU Bison 2.7. */ + +/* Skeleton interface for Bison LALR(1) parsers in C++ + + Copyright (C) 2002-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file step.tab.hxx + ** Define the yy::parser class. + */ + +/* C++ LALR(1) parser skeleton written by Akim Demaille. */ + +#ifndef YY_YY_STEP_TAB_HXX_INCLUDED +# define YY_YY_STEP_TAB_HXX_INCLUDED + +/* "%code requires" blocks. */ +/* Line 33 of lalr1.cc */ +#line 31 "StepFile/step.yacc" + +#include "location.hh" +#include +namespace yy { + class scanner; +}; + + +/* Line 33 of lalr1.cc */ +#line 56 "step.tab.hxx" + + +#include +#include +#include "stack.hh" +#include "location.hh" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + + +namespace yy { +/* Line 33 of lalr1.cc */ +#line 72 "step.tab.hxx" + + /// A Bison parser. + class parser + { + public: + /// Symbol semantic values. +#ifndef YYSTYPE + typedef int semantic_type; +#else + typedef YYSTYPE semantic_type; +#endif + /// Symbol locations. + typedef location location_type; + /// Tokens. + struct token + { + /* Tokens. */ + enum yytokentype { + STEP = 258, + HEADER = 259, + ENDSEC = 260, + DATA = 261, + ENDSTEP = 262, + SCOPE = 263, + ENDSCOPE = 264, + ENTITY = 265, + TYPE = 266, + INTEGER = 267, + FLOAT = 268, + IDENT = 269, + TEXT = 270, + NONDEF = 271, + ENUM = 272, + HEXA = 273, + QUID = 274 + }; + + }; + /// Token type. + typedef token::yytokentype token_type; + + /// Build a parser object. + parser (yy::scanner* scanner_yyarg); + virtual ~parser (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + +#if YYDEBUG + /// The current debugging stream. + std::ostream& debug_stream () const; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); +#endif + + private: + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const std::string& msg); + + /// Generate an error message. + /// \param state the state where the error occurred. + /// \param tok the lookahead token. + virtual std::string yysyntax_error_ (int yystate, int tok); + +#if YYDEBUG + /// \brief Report a symbol value on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); + /// \brief Report a symbol on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); +#endif + + + /// State numbers. + typedef int state_type; + /// State stack type. + typedef stack state_stack_type; + /// Semantic value stack type. + typedef stack semantic_stack_type; + /// location stack type. + typedef stack location_stack_type; + + /// The state stack. + state_stack_type yystate_stack_; + /// The semantic value stack. + semantic_stack_type yysemantic_stack_; + /// The location stack. + location_stack_type yylocation_stack_; + + /// Whether the given \c yypact_ value indicates a defaulted state. + /// \param yyvalue the value to check + static bool yy_pact_value_is_default_ (int yyvalue); + + /// Whether the given \c yytable_ value indicates a syntax error. + /// \param yyvalue the value to check + static bool yy_table_value_is_error_ (int yyvalue); + + /// Internal symbol numbers. + typedef unsigned char token_number_type; + /* Tables. */ + /// For a state, the index in \a yytable_ of its portion. + static const signed char yypact_[]; + static const signed char yypact_ninf_; + + /// For a state, default reduction number. + /// Unless\a yytable_ specifies something else to do. + /// Zero means the default is an error. + static const unsigned char yydefact_[]; + + static const signed char yypgoto_[]; + static const signed char yydefgoto_[]; + + /// What to do in a state. + /// \a yytable_[yypact_[s]]: what to do in state \a s. + /// - if positive, shift that token. + /// - if negative, reduce the rule which number is the opposite. + /// - if zero, do what YYDEFACT says. + static const signed char yytable_[]; + static const signed char yytable_ninf_; + + static const unsigned char yycheck_[]; + + /// For a state, its accessing symbol. + static const unsigned char yystos_[]; + + /// For a rule, its LHS. + static const unsigned char yyr1_[]; + /// For a rule, its RHS length. + static const unsigned char yyr2_[]; + +#if YYDEBUG + /// For a symbol, its name in clear. + static const char* const yytname_[]; + + /// A type to store symbol numbers and -1. + typedef signed char rhs_number_type; + /// A `-1'-separated list of the rules' RHS. + static const rhs_number_type yyrhs_[]; + /// For each rule, the index of the first RHS symbol in \a yyrhs_. + static const unsigned char yyprhs_[]; + /// For each rule, its source line number. + static const unsigned char yyrline_[]; + /// For each scanner token number, its symbol number. + static const unsigned short int yytoken_number_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); + + /* Debugging. */ + int yydebug_; + std::ostream* yycdebug_; +#endif + + /// Convert a scanner token number \a t to a symbol number. + token_number_type yytranslate_ (int t); + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// If null, do not display the symbol, just free it. + /// \param yytype The symbol type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + inline void yydestruct_ (const char* yymsg, + int yytype, + semantic_type* yyvaluep, + location_type* yylocationp); + + /// Pop \a n symbols the three stacks. + inline void yypop_ (unsigned int n = 1); + + /* Constants. */ + static const int yyeof_; + /* LAST_ -- Last index in TABLE_. */ + static const int yylast_; + static const int yynnts_; + static const int yyempty_; + static const int yyfinal_; + static const int yyterror_; + static const int yyerrcode_; + static const int yyntokens_; + static const unsigned int yyuser_token_number_max_; + static const token_number_type yyundef_token_; + + /* User arguments. */ + yy::scanner* scanner; + }; + +} // yy +/* Line 33 of lalr1.cc */ +#line 282 "step.tab.hxx" + + + +#endif /* !YY_YY_STEP_TAB_HXX_INCLUDED */ diff --git a/src/StepFile/step.yacc b/src/StepFile/step.yacc index aa160c0236..a9c12742b7 100644 --- a/src/StepFile/step.yacc +++ b/src/StepFile/step.yacc @@ -13,11 +13,35 @@ commercial license or contractual agreement. */ +%output "step.tab.cxx" +%defines "step.tab.hxx" + +%language "C++" +%require "2.7" +/* C++ parser interface */ +%skeleton "lalr1.cc" + +%parse-param {yy::scanner* scanner} + +%locations + %token STEP HEADER ENDSEC DATA ENDSTEP SCOPE ENDSCOPE ENTITY TYPE INTEGER FLOAT IDENT TEXT NONDEF ENUM HEXA QUID %start stepf -%{ + +%code requires { +#include "location.hh" +#include +namespace yy { + class scanner; +}; +} + +%code { #include "recfile.ph" /* definitions des types d'arguments */ #include "recfile.pc" /* la-dedans, tout y est */ +#include "scanner.hpp" +#undef yylex +#define yylex scanner->lex /* #define stepparse STEPparse #define steplex STEPlex @@ -31,6 +55,7 @@ #define stepnerrs STEPnerrs #define steperror STEPerror */ + #define stepclearin yychar = -1 #define steperrok yyerrflag = 0 @@ -52,12 +77,12 @@ // disable MSVC warnings in bison code #ifdef _MSC_VER -#pragma warning(disable:4244 4131 4127 4702) +#pragma warning(disable:4065 4244 4131 4127 4702) #define YYMALLOC malloc #define YYFREE free #endif - -%} +void StepFile_Interrupt (char* nomfic); /* rln 13.09.00 port on HP*/ +} %% /* N.B. : les commentaires sont filtres par LEX */ /* La fin vide (selon systeme emetteur) est filtree ici */ @@ -85,7 +110,7 @@ unarg : IDENT { rec_typarg(rec_argIdent); rec_newarg(); } | listarg /* rec_newent lors du ')' */ { rec_newarg(); } | listype listarg /* liste typee */ { rec_newarg(); } | error { rec_typarg(rec_argMisc); rec_newarg(); - yyerrstatus = 1; yyclearin; } + yyerrstatus_ = 1; yyclearin; } /* Erreur sur Parametre : tacher de le noter sans jeter l'Entite */ ; listype : TYPE @@ -97,7 +122,7 @@ deblist : '(' finlist : ')' { if (modeprint > 0) { printf("Record no : %d -- ",nbrec+1); rec_print(currec); } - rec_newent (); yyerrstatus = 0; } + rec_newent (); yyerrstatus_ = 0; } ; listarg : deblist finlist /* liste vide (peut y en avoir) */ | deblist arglist finlist /* liste normale, non vide */ @@ -146,3 +171,11 @@ entlab : ENTITY enttype : TYPE { rec_type (); } ; +%% + +void yy::parser::error(const std::string& m) +{ + char newmess[80]; + sprintf(newmess, "At line %d : %s", scanner->lineno() + 1, m.c_str()); + StepFile_Interrupt(newmess); +} diff --git a/src/StepFile/stepread.c b/src/StepFile/stepread.cxx similarity index 65% rename from src/StepFile/stepread.c rename to src/StepFile/stepread.cxx index aeff1e9181..4df217f0b5 100644 --- a/src/StepFile/stepread.c +++ b/src/StepFile/stepread.cxx @@ -23,8 +23,11 @@ #include #include #include +#include +#include #include "recfile.ph" #include +#include "scanner.hpp" /* StepFile_Error.c @@ -41,38 +44,14 @@ continuation a change */ -static int lastno; -extern int steplineno; - -extern void StepFile_Interrupt (char* nomfic); /* rln 13.09.00 port on HP*/ -int stepparse(void); -void rec_debfile(); -void steprestart(FILE *input_file); +void rec_debfile(); void rec_finfile(); -void steperror (char *mess) -{ - char newmess[80]; - if (steplineno == lastno) return; - lastno = steplineno; - sprintf (newmess,"At line %d, %s",steplineno+1,mess); - -/* yysbuf[0] = '\0'; - yysptr = yysbuf; - * yylineno = 0; */ - - StepFile_Interrupt(newmess); -} - /* But de ce mini-programme : appeler yyparse et si besoin preciser un fichier d'entree StepFile_Error redefinit yyerror pour ne pas stopper (s'y reporter) */ -extern FILE* stepin ; /* input de yyparse (executeur de lex-yacc) */ -extern int steplineno; /* compteur de ligne lex (pour erreurs) */ - - /* Designation d'un fichier de lecture (par defaut, c'est l'entree standard) @@ -81,40 +60,31 @@ extern int steplineno; /* compteur de ligne lex (pour erreurs) */ iflag retourne vaut 0 si c'est OK, 1 sinon */ -FILE* stepread_setinput (char* nomfic) +void stepread_setinput(std::ifstream& stream, char* nomfic) { - FILE* newin ; - if (strlen(nomfic) == 0) return stepin ; - newin = OSD_OpenFile(nomfic,"r"); - - if (newin == NULL) { - return NULL ; - } else { - stepin = newin ; return newin ; - } + if (strlen(nomfic) == 0) return; + OSD_OpenStream(stream, nomfic, std::ios_base::in | std::ios_base::binary); } -void stepread_endinput (FILE* infic, char* nomfic) +void stepread_endinput (std::ifstream& stream, char* nomfic) { - if (!infic) return; + if (!stream) return; if (strlen(nomfic) == 0) return; - fclose (infic); + stream.close(); } /* Lecture d'un fichier ia grammaire lex-yacc Appel : i = stepread() ; i est la valeur retournee par yyparse (0 si OK, 1 si erreur) */ -int stepread () +int stepread(std::istream* stream) { - int letat; - lastno = 0; - steplineno = 0; - rec_debfile() ; - steprestart(stepin); - letat = stepparse() ; - rec_finfile() ; + int letat = 0; + rec_debfile(); + yy::scanner scanner(stream); + scanner.yyrestart(stream); + yy::parser parser(&scanner); + letat = parser.parse(); + rec_finfile(); return letat; -} - -int stepwrap () { return 1; } +} \ No newline at end of file diff --git a/src/StepFile/stepread.ph b/src/StepFile/stepread.ph index bbdbcb9f62..dd6f86fc5f 100644 --- a/src/StepFile/stepread.ph +++ b/src/StepFile/stepread.ph @@ -16,18 +16,27 @@ // stepread.h /* lecture du fichier STEP (par appel a lex+yac) */ +#include -extern "C" FILE* stepread_setinput (char* nomfic) ; -extern "C" void stepread_endinput (FILE* infic, char* nomfic); -extern "C" int stepread() ; -extern "C" void recfile_modeprint (int mode) ; /* controle trace recfile */ +#ifdef __cplusplus +extern "C" { +#endif +void recfile_modeprint (int mode) ; /* controle trace recfile */ /* creation du Direc a partir de recfile : entrys connues de c++ */ -extern "C" void lir_file_nbr(int* nbh, int* nbr, int* nbp) ; -extern "C" int lir_file_rec(char* *ident , char* *type , int* nbarg) ; -extern "C" void lir_file_finrec() ; -extern "C" int lir_file_arg(int* type , char* *val) ; -extern "C" void lir_file_fin(int mode); +void lir_file_nbr(int* nbh, int* nbr, int* nbp) ; +int lir_file_rec(char* *ident , char* *type , int* nbarg) ; +void lir_file_finrec() ; +int lir_file_arg(int* type , char* *val) ; +void lir_file_fin(int mode); /* Interruption passant par C++ */ -extern "C" void StepFile_Interrupt (char* nomfic); + +#ifdef __cplusplus +} +#endif + +void stepread_setinput(std::ifstream& stream, char* nomfic); +void stepread_endinput (std::ifstream& stream, char* nomfic); +int stepread(std::istream* stream); +void StepFile_Interrupt (char* nomfic); \ No newline at end of file diff --git a/src/StepSelect/StepSelect_WorkLibrary.cxx b/src/StepSelect/StepSelect_WorkLibrary.cxx index 272f079a0b..518a3e25c6 100644 --- a/src/StepSelect/StepSelect_WorkLibrary.cxx +++ b/src/StepSelect/StepSelect_WorkLibrary.cxx @@ -78,6 +78,23 @@ Standard_Integer StepSelect_WorkLibrary::ReadFile return status; } +Standard_Integer StepSelect_WorkLibrary::ReadStream + (const Standard_CString name, + std::istream* istream, + Handle(Interface_InterfaceModel)& model, + const Handle(Interface_Protocol)& protocol) const +{ + long status = 1; + DeclareAndCast(StepData_Protocol, stepro, protocol); + if (stepro.IsNull()) return 1; + Handle(StepData_StepModel) stepmodel = new StepData_StepModel; + model = stepmodel; + StepFile_ReadTrace(0); + char *pName = (char *)name; + status = StepFile_Read(pName, istream, stepmodel, stepro); + return status; +} + Standard_Boolean StepSelect_WorkLibrary::WriteFile (IFSelect_ContextWrite& ctx) const diff --git a/src/StepSelect/StepSelect_WorkLibrary.hxx b/src/StepSelect/StepSelect_WorkLibrary.hxx index 4f09ef3943..cbf1729368 100644 --- a/src/StepSelect/StepSelect_WorkLibrary.hxx +++ b/src/StepSelect/StepSelect_WorkLibrary.hxx @@ -58,7 +58,12 @@ public: //! or lets "Null" in case of Error //! Returns 0 if OK, 1 if Read Error, -1 if File not opened Standard_EXPORT Standard_Integer ReadFile (const Standard_CString name, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const Standard_OVERRIDE; - + + //! Reads a STEP File from stream and returns a STEP Model (into ), + //! or lets "Null" in case of Error + //! Returns 0 if OK, 1 if Read Error, -1 if File not opened + Standard_EXPORT Standard_Integer ReadStream(const Standard_CString name, std::istream* istream, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const Standard_OVERRIDE; + //! Writes a File from a STEP Model //! Returns False (and writes no file) if does not bring a //! STEP Model diff --git a/src/XSControl/XSControl_Reader.cxx b/src/XSControl/XSControl_Reader.cxx index ea17e5cd61..aea24a9513 100644 --- a/src/XSControl/XSControl_Reader.cxx +++ b/src/XSControl/XSControl_Reader.cxx @@ -122,14 +122,26 @@ Handle(XSControl_WorkSession) XSControl_Reader::WS () const //purpose : //======================================================================= -IFSelect_ReturnStatus XSControl_Reader::ReadFile - (const Standard_CString filename) +IFSelect_ReturnStatus XSControl_Reader::ReadFile (const Standard_CString filename) { IFSelect_ReturnStatus stat = thesession->ReadFile(filename); thesession->InitTransferReader(4); return stat; } +//======================================================================= +//function : ReadStream +//purpose : +//======================================================================= + +IFSelect_ReturnStatus XSControl_Reader::ReadStream(const Standard_CString filename, + std::istream* istream) +{ + IFSelect_ReturnStatus stat = thesession->ReadStream(filename, istream); + thesession->InitTransferReader(4); + return stat; +} + Handle(Interface_InterfaceModel) XSControl_Reader::Model () const { diff --git a/src/XSControl/XSControl_Reader.hxx b/src/XSControl/XSControl_Reader.hxx index ebd3ad079c..1ea4c2bfda 100644 --- a/src/XSControl/XSControl_Reader.hxx +++ b/src/XSControl/XSControl_Reader.hxx @@ -101,6 +101,10 @@ Standard_EXPORT virtual ~XSControl_Reader() {} //! Loads a file and returns the read status //! Zero for a Model which compies with the Controller Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString filename); + + //! Loads a file from stream and returns the read status + //! Zero for a Model which compies with the Controller + Standard_EXPORT IFSelect_ReturnStatus ReadStream(const Standard_CString filename, std::istream* istream); //! Returns the model. It can then be consulted (header, product) Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; -- 2.39.5