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 | |
7fd59977 |
16 | %token STEP HEADER ENDSEC DATA ENDSTEP SCOPE ENDSCOPE ENTITY TYPE INTEGER FLOAT IDENT TEXT NONDEF ENUM HEXA QUID |
17 | %start stepf |
18 | %{ |
19 | #include "recfile.ph" /* definitions des types d'arguments */ |
20 | #include "recfile.pc" /* la-dedans, tout y est */ |
21 | /* |
22 | #define stepparse STEPparse |
23 | #define steplex STEPlex |
24 | #define stepwrap STEPwrap |
25 | #define steprestart STEPrestart |
26 | #define steplex STEPlex |
27 | #define steplval STEPlval |
28 | #define stepval STEPval |
29 | #define stepchar STEPchar |
30 | #define stepdebug STEPdebug |
31 | #define stepnerrs STEPnerrs |
32 | #define steperror STEPerror |
33 | */ |
34 | #define stepclearin yychar = -1 |
35 | #define steperrok yyerrflag = 0 |
36 | |
37 | /* |
38 | #define stepin STEPin |
39 | #define yyerrflag STEPerrflag |
40 | #define yyerrstatus STEPerrflag |
41 | */ |
42 | |
43 | /* ABV 19.12.00: merging porting modifications by POP (for WNT, AIX) */ |
44 | #if defined(WNT) && !defined(MSDOS) |
45 | #define MSDOS WNT |
46 | #endif |
47 | #if defined(_AIX) |
48 | #include <malloc.h> |
49 | #define alloca malloc |
50 | #endif |
51 | |
105aae76 |
52 | |
d5f74e42 |
53 | // disable MSVC warnings in bison code |
105aae76 |
54 | #ifdef _MSC_VER |
d5f74e42 |
55 | #pragma warning(disable:4244 4131 4127 4702) |
ced8e751 |
56 | #define YYMALLOC malloc |
57 | #define YYFREE free |
105aae76 |
58 | #endif |
59 | |
7fd59977 |
60 | %} |
61 | %% |
62 | /* N.B. : les commentaires sont filtres par LEX */ |
63 | /* La fin vide (selon systeme emetteur) est filtree ici */ |
64 | finvide : ' ' |
65 | | finvide ' ' ; |
66 | finstep : ENDSTEP |
67 | | ENDSTEP finvide ; |
68 | stepf1 : STEP HEADER headl ENDSEC endhead model ENDSEC finstep ; |
69 | stepf2 : STEP HEADER ENDSEC endhead model ENDSEC ENDSTEP ; |
70 | stepf3 : STEP HEADER ENDSEC endhead model error ; |
71 | stepf : stepf1 | stepf2 | stepf3 |
72 | { rec_finfile(); return(0); /* fini pour celui-la */ } |
73 | ; |
74 | headl : headent |
75 | | headl headent |
76 | ; |
77 | headent : enttype listarg ';' |
78 | | error /* Erreur sur Entite : la sauter */ |
79 | ; |
80 | endhead : DATA |
81 | { rec_finhead(); } |
82 | ; |
83 | unarg : IDENT { rec_typarg(rec_argIdent); rec_newarg(); } |
84 | | QUID { /* deja fait par lex*/ rec_newarg(); } |
85 | | listarg /* rec_newent lors du ')' */ { rec_newarg(); } |
86 | | listype listarg /* liste typee */ { rec_newarg(); } |
87 | | error { rec_typarg(rec_argMisc); rec_newarg(); |
88 | yyerrstatus = 1; yyclearin; } |
89 | /* Erreur sur Parametre : tacher de le noter sans jeter l'Entite */ |
90 | ; |
91 | listype : TYPE |
92 | { rec_listype(); } |
93 | ; |
94 | deblist : '(' |
95 | { rec_deblist(); } |
96 | ; |
97 | finlist : ')' |
98 | { if (modeprint > 0) |
99 | { printf("Record no : %d -- ",nbrec+1); rec_print(currec); } |
100 | rec_newent (); yyerrstatus = 0; } |
101 | ; |
102 | listarg : deblist finlist /* liste vide (peut y en avoir) */ |
103 | | deblist arglist finlist /* liste normale, non vide */ |
104 | | deblist error |
105 | ; |
106 | arglist : unarg |
107 | | arglist ',' unarg |
108 | | arglist error |
109 | ; |
110 | model : bloc |
111 | | model bloc |
112 | ; |
113 | bloc : entlab '=' unent ';' |
114 | | entlab '=' debscop model finscop unent ';' |
115 | | entlab '=' debscop finscop unent ';' |
116 | | error /* Erreur sur Entite : la sauter */ |
117 | ; |
118 | plex : enttype listarg |
119 | | plex enttype listarg /* sert a ce qui suit : */ |
120 | ; |
121 | unent : enttype listarg /* Entite de Type Simple */ |
122 | | '(' plex ')' /* Entite de Type Complexe */ |
123 | ; |
124 | debscop : SCOPE |
125 | { scope_debut(); } |
126 | ; |
127 | unid : IDENT |
128 | { rec_typarg(rec_argIdent); rec_newarg(); } |
129 | ; |
130 | export : unid |
131 | | export ',' unid |
132 | ; |
133 | debexp : '/' |
134 | { rec_deblist(); } |
135 | ; |
136 | finscop : ENDSCOPE |
137 | { scope_fin(); } |
138 | | ENDSCOPE debexp export '/' |
139 | { printf("*** Warning : Export List not yet processed\n"); |
140 | rec_newent(); scope_fin() ; } |
141 | /* La liste Export est prise comme ARGUMENT du EndScope */ |
142 | ; |
143 | entlab : ENTITY |
144 | { rec_ident(); } |
145 | ; |
146 | enttype : TYPE |
147 | { rec_type (); } |
148 | ; |