0031489: Data Exchange - STEP Reader can't read a big file
[occt.git] / src / StepFile / step.yacc
CommitLineData
b311480e 1/*
973c2be1 2 Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3
973c2be1 4 This file is part of Open CASCADE Technology software library.
b311480e 5
d5f74e42 6 This library is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8 by the Free Software Foundation, with special exception defined in the file
9 OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 distribution for complete text of the license and disclaimer of any warranty.
b311480e 11
973c2be1 12 Alternatively, this file may be used under the terms of Open CASCADE
13 commercial license or contractual agreement.
b311480e 14*/
15
fba34cf8 16%code top {
17// This file is part of Open CASCADE Technology software library.
18// This file is generated, do not modify it directly; edit source file step.yacc instead.
19}
20
7fd59977 21%token STEP HEADER ENDSEC DATA ENDSTEP SCOPE ENDSCOPE ENTITY TYPE INTEGER FLOAT IDENT TEXT NONDEF ENUM HEXA QUID
22%start stepf
23%{
24#include "recfile.ph" /* definitions des types d'arguments */
25#include "recfile.pc" /* la-dedans, tout y est */
fba34cf8 26
7fd59977 27#define stepclearin yychar = -1
28#define steperrok yyerrflag = 0
29
d5f74e42 30// disable MSVC warnings in bison code
105aae76 31#ifdef _MSC_VER
d5f74e42 32#pragma warning(disable:4244 4131 4127 4702)
ced8e751 33#define YYMALLOC malloc
34#define YYFREE free
105aae76 35#endif
36
7fd59977 37%}
38%%
39/* N.B. : les commentaires sont filtres par LEX */
40/* La fin vide (selon systeme emetteur) est filtree ici */
41finvide : ' '
42 | finvide ' ' ;
43finstep : ENDSTEP
44 | ENDSTEP finvide ;
45stepf1 : STEP HEADER headl ENDSEC endhead model ENDSEC finstep ;
46stepf2 : STEP HEADER ENDSEC endhead model ENDSEC ENDSTEP ;
47stepf3 : STEP HEADER ENDSEC endhead model error ;
48stepf : stepf1 | stepf2 | stepf3
49 { rec_finfile(); return(0); /* fini pour celui-la */ }
50 ;
51headl : headent
52 | headl headent
53 ;
54headent : enttype listarg ';'
55 | error /* Erreur sur Entite : la sauter */
56 ;
57endhead : DATA
58 { rec_finhead(); }
59 ;
60unarg : IDENT { rec_typarg(rec_argIdent); rec_newarg(); }
61 | QUID { /* deja fait par lex*/ rec_newarg(); }
62 | listarg /* rec_newent lors du ')' */ { rec_newarg(); }
63 | listype listarg /* liste typee */ { rec_newarg(); }
64 | error { rec_typarg(rec_argMisc); rec_newarg();
65 yyerrstatus = 1; yyclearin; }
66/* Erreur sur Parametre : tacher de le noter sans jeter l'Entite */
67 ;
68listype : TYPE
69 { rec_listype(); }
70 ;
71deblist : '('
72 { rec_deblist(); }
73 ;
74finlist : ')'
75 { if (modeprint > 0)
76 { printf("Record no : %d -- ",nbrec+1); rec_print(currec); }
77 rec_newent (); yyerrstatus = 0; }
78 ;
79listarg : deblist finlist /* liste vide (peut y en avoir) */
80 | deblist arglist finlist /* liste normale, non vide */
46370000 81 | deblist arglist ',' finlist /* broken list with missing last parameter, see #31756 */
7fd59977 82 | deblist error
83 ;
84arglist : unarg
85 | arglist ',' unarg
86 | arglist error
87 ;
88model : bloc
89 | model bloc
90 ;
91bloc : entlab '=' unent ';'
92 | entlab '=' debscop model finscop unent ';'
93 | entlab '=' debscop finscop unent ';'
94 | error /* Erreur sur Entite : la sauter */
95 ;
96plex : enttype listarg
97 | plex enttype listarg /* sert a ce qui suit : */
98 ;
99unent : enttype listarg /* Entite de Type Simple */
100 | '(' plex ')' /* Entite de Type Complexe */
101 ;
102debscop : SCOPE
103 { scope_debut(); }
104 ;
105unid : IDENT
106 { rec_typarg(rec_argIdent); rec_newarg(); }
107 ;
108export : unid
109 | export ',' unid
110 ;
111debexp : '/'
112 { rec_deblist(); }
113 ;
114finscop : ENDSCOPE
115 { scope_fin(); }
116 | ENDSCOPE debexp export '/'
117 { printf("*** Warning : Export List not yet processed\n");
118 rec_newent(); scope_fin() ; }
119 /* La liste Export est prise comme ARGUMENT du EndScope */
120 ;
121entlab : ENTITY
122 { rec_ident(); }
123 ;
124enttype : TYPE
125 { rec_type (); }
126 ;