0027960: Configuration - fix compilation of OSD_Directory with MinGW-w64
[occt.git] / src / StepFile / step.yacc
... / ...
CommitLineData
1/*
2 Copyright (c) 1999-2014 OPEN CASCADE SAS
3
4 This file is part of Open CASCADE Technology software library.
5
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
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.
11
12 Alternatively, this file may be used under the terms of Open CASCADE
13 commercial license or contractual agreement.
14*/
15
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
52
53// disable MSVC warnings in bison code
54#ifdef _MSC_VER
55#pragma warning(disable:4244 4131 4127 4702)
56#define YYMALLOC malloc
57#define YYFREE free
58#endif
59
60%}
61%%
62/* N.B. : les commentaires sont filtres par LEX */
63/* La fin vide (selon systeme emetteur) est filtree ici */
64finvide : ' '
65 | finvide ' ' ;
66finstep : ENDSTEP
67 | ENDSTEP finvide ;
68stepf1 : STEP HEADER headl ENDSEC endhead model ENDSEC finstep ;
69stepf2 : STEP HEADER ENDSEC endhead model ENDSEC ENDSTEP ;
70stepf3 : STEP HEADER ENDSEC endhead model error ;
71stepf : stepf1 | stepf2 | stepf3
72 { rec_finfile(); return(0); /* fini pour celui-la */ }
73 ;
74headl : headent
75 | headl headent
76 ;
77headent : enttype listarg ';'
78 | error /* Erreur sur Entite : la sauter */
79 ;
80endhead : DATA
81 { rec_finhead(); }
82 ;
83unarg : 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 ;
91listype : TYPE
92 { rec_listype(); }
93 ;
94deblist : '('
95 { rec_deblist(); }
96 ;
97finlist : ')'
98 { if (modeprint > 0)
99 { printf("Record no : %d -- ",nbrec+1); rec_print(currec); }
100 rec_newent (); yyerrstatus = 0; }
101 ;
102listarg : deblist finlist /* liste vide (peut y en avoir) */
103 | deblist arglist finlist /* liste normale, non vide */
104 | deblist error
105 ;
106arglist : unarg
107 | arglist ',' unarg
108 | arglist error
109 ;
110model : bloc
111 | model bloc
112 ;
113bloc : entlab '=' unent ';'
114 | entlab '=' debscop model finscop unent ';'
115 | entlab '=' debscop finscop unent ';'
116 | error /* Erreur sur Entite : la sauter */
117 ;
118plex : enttype listarg
119 | plex enttype listarg /* sert a ce qui suit : */
120 ;
121unent : enttype listarg /* Entite de Type Simple */
122 | '(' plex ')' /* Entite de Type Complexe */
123 ;
124debscop : SCOPE
125 { scope_debut(); }
126 ;
127unid : IDENT
128 { rec_typarg(rec_argIdent); rec_newarg(); }
129 ;
130export : unid
131 | export ',' unid
132 ;
133debexp : '/'
134 { rec_deblist(); }
135 ;
136finscop : 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 ;
143entlab : ENTITY
144 { rec_ident(); }
145 ;
146enttype : TYPE
147 { rec_type (); }
148 ;