xref: /aoo42x/main/rsc/source/parser/yyrscyacc.y (revision 7de6b1b1)
1e26f3242SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3e26f3242SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4e26f3242SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5e26f3242SAndrew Rist  * distributed with this work for additional information
6e26f3242SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7e26f3242SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8e26f3242SAndrew Rist  * "License"); you may not use this file except in compliance
9e26f3242SAndrew Rist  * with the License.  You may obtain a copy of the License at
10e26f3242SAndrew Rist  *
11e26f3242SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12e26f3242SAndrew Rist  *
13e26f3242SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14e26f3242SAndrew Rist  * software distributed under the License is distributed on an
15e26f3242SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16e26f3242SAndrew Rist  * KIND, either express or implied.  See the License for the
17e26f3242SAndrew Rist  * specific language governing permissions and limitations
18e26f3242SAndrew Rist  * under the License.
19e26f3242SAndrew Rist  *
20e26f3242SAndrew Rist  *************************************************************/
21e26f3242SAndrew Rist 
22e26f3242SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir %{
25cdf0e10cSrcweir #if defined __GNUC__
26cdf0e10cSrcweir #pragma GCC system_header
27cdf0e10cSrcweir #elif defined __SUNPRO_CC
28cdf0e10cSrcweir #pragma disable_warn
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir %}
31cdf0e10cSrcweir 
32cdf0e10cSrcweir /* Compilerstack */
33cdf0e10cSrcweir 
34cdf0e10cSrcweir %union {
35cdf0e10cSrcweir 	Atom			varid;
36cdf0e10cSrcweir 	struct {
37cdf0e10cSrcweir 		Atom			hashid;
38cdf0e10cSrcweir 		sal_Int32			nValue;
39cdf0e10cSrcweir 	}				constname;
40cdf0e10cSrcweir 	RscTop *		pClass;
41cdf0e10cSrcweir 	RSCHEADER		header;
42cdf0e10cSrcweir 	struct {
43cdf0e10cSrcweir 		CLASS_DATA	pData;
44cdf0e10cSrcweir 		RscTop *	pClass;
45cdf0e10cSrcweir 	}				instance;
46cdf0e10cSrcweir 	sal_Int32			value;
47cdf0e10cSrcweir 	sal_uInt16			ushort;
48cdf0e10cSrcweir 	short			exp_short;
49cdf0e10cSrcweir 	char *			string;
50cdf0e10cSrcweir 	sal_Bool			svbool;
51cdf0e10cSrcweir 	REF_ENUM		copyref;
52cdf0e10cSrcweir 	RscDefine	  * defineele;
53cdf0e10cSrcweir 	CharSet 		charset;
54cdf0e10cSrcweir 	RscExpType		macrostruct;
55cdf0e10cSrcweir }
56cdf0e10cSrcweir 
57cdf0e10cSrcweir /* Token */
58cdf0e10cSrcweir %token <value>			NUMBER
59cdf0e10cSrcweir %token <string> 		SYMBOL
60cdf0e10cSrcweir %token <defineele>		RSCDEFINE
61cdf0e10cSrcweir %token <string> 		STRING
62cdf0e10cSrcweir %token <string> 		INCLUDE_STRING
63cdf0e10cSrcweir %token <character>		CHARACTER
64cdf0e10cSrcweir %token <svbool> 		BOOLEAN
65cdf0e10cSrcweir 
66cdf0e10cSrcweir %token LINE
67cdf0e10cSrcweir %token AUTO_ID
68cdf0e10cSrcweir %token NOT
69cdf0e10cSrcweir %token XSCALE
70cdf0e10cSrcweir %token YSCALE
71cdf0e10cSrcweir %token RGB
72cdf0e10cSrcweir %token GEOMETRY
73cdf0e10cSrcweir %token POSITION
74cdf0e10cSrcweir %token DIMENSION
75cdf0e10cSrcweir %token INZOOMOUTPUTSIZE
76cdf0e10cSrcweir %token FLOATINGPOS
77cdf0e10cSrcweir %token DEFINE
78cdf0e10cSrcweir %token INCLUDE
79cdf0e10cSrcweir %token MACROTARGET
80cdf0e10cSrcweir %token DEFAULT
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 
83cdf0e10cSrcweir %token <pClass> 		CLASSNAME
84cdf0e10cSrcweir %token <varid>			VARNAME
85cdf0e10cSrcweir %token <constname>		CONSTNAME
86cdf0e10cSrcweir %token CLASS
87cdf0e10cSrcweir %token EXTENDABLE
88cdf0e10cSrcweir %token WRITEIFSET
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 
91cdf0e10cSrcweir %type  <macrostruct>	macro_expression
92cdf0e10cSrcweir %type  <macrostruct>	id_expression
93cdf0e10cSrcweir %type  <value>			long_expression
94cdf0e10cSrcweir %type  <string> 		string_multiline
95cdf0e10cSrcweir 
96cdf0e10cSrcweir %type  <pClass> 		type
97cdf0e10cSrcweir %type  <pClass> 		type_base
98cdf0e10cSrcweir %type  <header> 		class_header_body
99cdf0e10cSrcweir %type  <header> 		class_header
100cdf0e10cSrcweir %type  <header> 		var_header_class
101cdf0e10cSrcweir %type  <copyref>		copy_ref
102cdf0e10cSrcweir %type  <ushort> 		type_flags
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 
105cdf0e10cSrcweir %left '|'
106cdf0e10cSrcweir %left '&'
107cdf0e10cSrcweir %left LEFTSHIFT RIGHTSHIFT
108cdf0e10cSrcweir %left '+' '-'
109cdf0e10cSrcweir %left '*' '/'
110cdf0e10cSrcweir %left UNARYMINUS
111cdf0e10cSrcweir %left UNARYPLUS
112cdf0e10cSrcweir %left ','
113cdf0e10cSrcweir %left '(' ')'
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 
116cdf0e10cSrcweir /*	Grammatik  */
117cdf0e10cSrcweir 
118cdf0e10cSrcweir %start resource_definitions
119cdf0e10cSrcweir 
120cdf0e10cSrcweir %%
121cdf0e10cSrcweir 
122cdf0e10cSrcweir /********************** D E F I N I T I O N S ****************************/
123cdf0e10cSrcweir resource_definitions
124cdf0e10cSrcweir   :
125cdf0e10cSrcweir   | resource_definitions resource_definition
126cdf0e10cSrcweir   | MACROTARGET macro_expression
127cdf0e10cSrcweir 	{
128cdf0e10cSrcweir 		RscExpType		aExpType;
129cdf0e10cSrcweir 		sal_Int32			lValue;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 		aExpType.cType = RSCEXP_NOTHING;
132cdf0e10cSrcweir 		pExp = new RscExpression( aExpType, '+', $2 );
133cdf0e10cSrcweir 		if( !pExp->Evaluate( &lValue ) )
134cdf0e10cSrcweir 			pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
135cdf0e10cSrcweir 	}
136cdf0e10cSrcweir   ;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir resource_definition
139cdf0e10cSrcweir   : line_number
140cdf0e10cSrcweir   | '#' DEFINE SYMBOL macro_expression
141cdf0e10cSrcweir 	{
142cdf0e10cSrcweir 		sal_Bool		bError = sal_False;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 		if( $4.IsNumber() ){
145cdf0e10cSrcweir 			if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(),
146cdf0e10cSrcweir 									   ByteString( $3 ),
147cdf0e10cSrcweir 									   $4.GetLong(), LIST_APPEND ) )
148cdf0e10cSrcweir 				bError = sal_True;
149cdf0e10cSrcweir 		}
150cdf0e10cSrcweir 		else if( $4.IsDefinition() ){
151cdf0e10cSrcweir 			RscExpType		aExpType;
152cdf0e10cSrcweir 			RscExpression * pExpr;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 			aExpType.cType = RSCEXP_NOTHING;
155cdf0e10cSrcweir 			aExpType.SetLong( 0 );
156cdf0e10cSrcweir 			aExpType.cType = RSCEXP_LONG;
157cdf0e10cSrcweir 			pExpr = new RscExpression( aExpType, '+', $4 );
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 			if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(),
160cdf0e10cSrcweir 									   ByteString( $3 ), pExpr, LIST_APPEND ) )
161cdf0e10cSrcweir 				bError = sal_True;
162cdf0e10cSrcweir 		}
163cdf0e10cSrcweir 		else if( $4.IsExpression() ){
164cdf0e10cSrcweir 			if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(),
165cdf0e10cSrcweir 									   ByteString( $3 ), $4.aExp.pExp,
166cdf0e10cSrcweir 									   LIST_APPEND ) )
167cdf0e10cSrcweir 				bError = sal_True;
168cdf0e10cSrcweir 		}
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 		if( bError ){
171cdf0e10cSrcweir 			pTC->pEH->Error( ERR_DECLAREDEFINE, NULL, RscId(), $3 );
172cdf0e10cSrcweir 		}
173cdf0e10cSrcweir 	}
174cdf0e10cSrcweir   | '#' DEFINE RSCDEFINE macro_expression
175cdf0e10cSrcweir 	{
176cdf0e10cSrcweir 		pTC->pEH->Error( ERR_DOUBLEDEFINE, NULL, RscId(), $3->GetName().GetBuffer() );
177cdf0e10cSrcweir 	}
178cdf0e10cSrcweir   | '#' INCLUDE STRING
179cdf0e10cSrcweir 	{
180cdf0e10cSrcweir 	}
181cdf0e10cSrcweir   | '#' INCLUDE INCLUDE_STRING
182cdf0e10cSrcweir 	{
183cdf0e10cSrcweir 	}
184cdf0e10cSrcweir   | class_definition ';'
185cdf0e10cSrcweir 	{
186cdf0e10cSrcweir #ifdef D40
187cdf0e10cSrcweir 			void * pMem;
188cdf0e10cSrcweir 			pMem = rtl_allocateMemory( 20000 );
189cdf0e10cSrcweir 			rtl_freeMemory( pMem );
190cdf0e10cSrcweir #endif
191cdf0e10cSrcweir 	}
192cdf0e10cSrcweir   | new_class_definition_header '{' new_class_definition_body '}' ';'
193cdf0e10cSrcweir   | new_class_definition_header ';'
194cdf0e10cSrcweir   ;
195cdf0e10cSrcweir 
196cdf0e10cSrcweir new_class_definition_header
197cdf0e10cSrcweir   : CLASS SYMBOL id_expression ':' CLASSNAME
198cdf0e10cSrcweir 	{
199cdf0e10cSrcweir 		sal_Int32	lType;
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 		$3.Evaluate( &lType );
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 		// Klasse anlegen
204cdf0e10cSrcweir 		Atom nId = pHS->getID( $2 );
205cdf0e10cSrcweir 		pCurClass = new RscClass( nId, lType, $5 );
206cdf0e10cSrcweir 		nCurMask = 1;
207cdf0e10cSrcweir 		pTC->aNmTb.Put( nId, CLASSNAME, pCurClass );
208cdf0e10cSrcweir 		pTC->GetRoot()->Insert( pCurClass );
209cdf0e10cSrcweir 	}
210cdf0e10cSrcweir   | CLASS CLASSNAME id_expression ':' CLASSNAME
211cdf0e10cSrcweir 	{
212cdf0e10cSrcweir 		pCurClass = $2;
213cdf0e10cSrcweir 		nCurMask = 1;
214cdf0e10cSrcweir 	}
215cdf0e10cSrcweir   ;
216cdf0e10cSrcweir 
217cdf0e10cSrcweir new_class_definition_body
218cdf0e10cSrcweir   :
219cdf0e10cSrcweir   | property_definition ';' new_class_definition_body
220cdf0e10cSrcweir   ;
221cdf0e10cSrcweir 
222cdf0e10cSrcweir property_definition
223cdf0e10cSrcweir   : type_flags type SYMBOL
224cdf0e10cSrcweir   {
225cdf0e10cSrcweir 	// Variable anlegen
226cdf0e10cSrcweir 	Atom nId = pTC->aNmTb.Put( $3, VARNAME );
227cdf0e10cSrcweir 	pCurClass->SetVariable( nId, $2, NULL, $1, nCurMask );
228cdf0e10cSrcweir 	nCurMask <<= 1;
229cdf0e10cSrcweir   }
230cdf0e10cSrcweir   | type_flags type VARNAME
231cdf0e10cSrcweir   {
232cdf0e10cSrcweir 	pCurClass->SetVariable( $3, $2, NULL, $1, nCurMask );
233cdf0e10cSrcweir 	nCurMask <<= 1;
234cdf0e10cSrcweir   }
235cdf0e10cSrcweir   ;
236cdf0e10cSrcweir 
237cdf0e10cSrcweir type_flags
238cdf0e10cSrcweir   : type_flags EXTENDABLE
239cdf0e10cSrcweir   {
240cdf0e10cSrcweir 	$$ = $1 | VAR_EXTENDABLE;
241cdf0e10cSrcweir   }
242cdf0e10cSrcweir   | type_flags WRITEIFSET
243cdf0e10cSrcweir   {
244cdf0e10cSrcweir 	$$ = $1 | VAR_SVDYNAMIC;
245cdf0e10cSrcweir   }
246cdf0e10cSrcweir   |
247cdf0e10cSrcweir   {
248cdf0e10cSrcweir 	$$ = 0;
249cdf0e10cSrcweir   }
250cdf0e10cSrcweir   ;
251cdf0e10cSrcweir 
252cdf0e10cSrcweir type
253cdf0e10cSrcweir   : type_base
254cdf0e10cSrcweir   {
255cdf0e10cSrcweir 	$$ = $1;
256cdf0e10cSrcweir   }
257cdf0e10cSrcweir   | type_base '[' ']'
258cdf0e10cSrcweir   {
259cdf0e10cSrcweir 	if( $1 )
260cdf0e10cSrcweir 	{
261cdf0e10cSrcweir 		ByteString aTypeName = pHS->getString( $1->GetId() );
262cdf0e10cSrcweir 		aTypeName += "[]";
263cdf0e10cSrcweir 		$$ = pTC->SearchType( pHS->getID( aTypeName.GetBuffer(), true ) );
264cdf0e10cSrcweir 		if( !$$ )
265cdf0e10cSrcweir 		{
266cdf0e10cSrcweir 			RscCont * pCont;
267cdf0e10cSrcweir 			pCont = new RscCont( pHS->getID( aTypeName.GetBuffer() ), RSC_NOTYPE );
268cdf0e10cSrcweir 			pCont->SetTypeClass( $1 );
269cdf0e10cSrcweir 			pTC->InsertType( pCont );
270cdf0e10cSrcweir 			$$ = pCont;
271cdf0e10cSrcweir 		}
272cdf0e10cSrcweir 	}
273cdf0e10cSrcweir 	else
274cdf0e10cSrcweir 		$$ = NULL;
275cdf0e10cSrcweir   }
276cdf0e10cSrcweir   ;
277cdf0e10cSrcweir 
278cdf0e10cSrcweir type_base
279cdf0e10cSrcweir   : CLASSNAME
280cdf0e10cSrcweir   {
281cdf0e10cSrcweir 	$$ = $1;
282cdf0e10cSrcweir   }
283cdf0e10cSrcweir   | SYMBOL
284cdf0e10cSrcweir   {
285cdf0e10cSrcweir 	RscTop * pType = pTC->SearchType( pHS->getID( $1, true ) );
286cdf0e10cSrcweir 	if( !pType )
287cdf0e10cSrcweir 		pTC->pEH->Error( ERR_NOTYPE, pCurClass, RscId() );
288cdf0e10cSrcweir 	$$ = pType;
289cdf0e10cSrcweir   }
290cdf0e10cSrcweir   ;
291cdf0e10cSrcweir 
292cdf0e10cSrcweir class_definition
293cdf0e10cSrcweir   : class_header class_body
294cdf0e10cSrcweir   {
295cdf0e10cSrcweir 	if( TYPE_REF == $1.nTyp )
296cdf0e10cSrcweir 		pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass,
297cdf0e10cSrcweir 						 RscId( $1.nName1 ) );
298cdf0e10cSrcweir 	S.Pop();
299cdf0e10cSrcweir   }
300cdf0e10cSrcweir   | class_header
301cdf0e10cSrcweir   {
302cdf0e10cSrcweir 	ERRTYPE aError;
303cdf0e10cSrcweir 	RscId aRscId( $1.nName1 );
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 	if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() )
306cdf0e10cSrcweir 		aError = S.Top().pClass->SetRef( S.Top(), aRscId );
307cdf0e10cSrcweir 	else if( TYPE_COPY == $1.nTyp )
308cdf0e10cSrcweir 		aError = ERR_COPYNOTALLOWED;
309cdf0e10cSrcweir 	if( aError.IsError() || aError.IsWarning() )
310cdf0e10cSrcweir 		pTC->pEH->Error( aError, S.Top().pClass, aRscId );
311cdf0e10cSrcweir 	S.Pop();
312cdf0e10cSrcweir   }
313cdf0e10cSrcweir   ;
314cdf0e10cSrcweir 
315cdf0e10cSrcweir class_header
316cdf0e10cSrcweir   : class_header_body
317cdf0e10cSrcweir 	{
318cdf0e10cSrcweir 		if( !DoClassHeader( &$1, sal_False ) )
319cdf0e10cSrcweir 			return( ERR_ERROR );
320cdf0e10cSrcweir 		$$ = $1;
321cdf0e10cSrcweir 	}
322cdf0e10cSrcweir   ;
323cdf0e10cSrcweir 
324cdf0e10cSrcweir copy_ref
325cdf0e10cSrcweir   : '<'
326cdf0e10cSrcweir 	{
327cdf0e10cSrcweir 		$$ = TYPE_COPY;
328cdf0e10cSrcweir 	}
329cdf0e10cSrcweir   | ','
330cdf0e10cSrcweir 	{
331cdf0e10cSrcweir 		$$ = TYPE_REF;
332cdf0e10cSrcweir 	}
333cdf0e10cSrcweir   ;
334cdf0e10cSrcweir 
335cdf0e10cSrcweir class_header_body
336cdf0e10cSrcweir   : CLASSNAME id_expression copy_ref CLASSNAME id_expression
337cdf0e10cSrcweir 	{
338cdf0e10cSrcweir 		$$.pClass = $1;
339cdf0e10cSrcweir 		$$.nName1 = $2;
340cdf0e10cSrcweir 		$$.nTyp = $3;
341cdf0e10cSrcweir 		$$.pRefClass = $4;
342cdf0e10cSrcweir 		$$.nName2 = $5;
343cdf0e10cSrcweir 	}
344cdf0e10cSrcweir   | CLASSNAME id_expression copy_ref id_expression
345cdf0e10cSrcweir 	{
346cdf0e10cSrcweir 		$$.pClass = $1;
347cdf0e10cSrcweir 		$$.nName1 = $2;
348cdf0e10cSrcweir 		$$.nTyp = $3;
349cdf0e10cSrcweir 		$$.pRefClass = NULL;
350cdf0e10cSrcweir 		$$.nName2 = $4;
351cdf0e10cSrcweir 	}
352cdf0e10cSrcweir   | CLASSNAME id_expression
353cdf0e10cSrcweir 	{
354cdf0e10cSrcweir 		$$.pClass = $1;
355cdf0e10cSrcweir 		$$.nName1 = $2;
356cdf0e10cSrcweir 		$$.nTyp = TYPE_NOTHING;
357cdf0e10cSrcweir 		$$.pRefClass = NULL;
358cdf0e10cSrcweir 		$$.nName2.cType = RSCEXP_NOTHING;
359cdf0e10cSrcweir 	}
360cdf0e10cSrcweir   | CLASSNAME copy_ref id_expression
361cdf0e10cSrcweir 	{
362cdf0e10cSrcweir 		$$.pClass = $1;
363cdf0e10cSrcweir 		$$.nName1.cType = RSCEXP_NOTHING;
364cdf0e10cSrcweir 		$$.nTyp = $2;
365cdf0e10cSrcweir 		$$.pRefClass = NULL;
366cdf0e10cSrcweir 		$$.nName2 = $3;
367cdf0e10cSrcweir 	}
368cdf0e10cSrcweir   | CLASSNAME copy_ref CLASSNAME id_expression
369cdf0e10cSrcweir 	{
370cdf0e10cSrcweir 		$$.pClass = $1;
371cdf0e10cSrcweir 		$$.nName1.cType = RSCEXP_NOTHING;
372cdf0e10cSrcweir 		$$.nTyp = $2;
373cdf0e10cSrcweir 		$$.pRefClass = $3;
374cdf0e10cSrcweir 		$$.nName2 = $4;
375cdf0e10cSrcweir 	}
376cdf0e10cSrcweir   | CLASSNAME
377cdf0e10cSrcweir 	{
378cdf0e10cSrcweir 		$$.pClass = $1;
379cdf0e10cSrcweir 		$$.nName1.cType = RSCEXP_NOTHING;
380cdf0e10cSrcweir 		$$.nTyp = TYPE_NOTHING;
381cdf0e10cSrcweir 		$$.nName2.cType = RSCEXP_NOTHING;
382cdf0e10cSrcweir 	}
383cdf0e10cSrcweir   ;
384cdf0e10cSrcweir 
385cdf0e10cSrcweir class_body
386cdf0e10cSrcweir   : '{' var_definitions '}'
387cdf0e10cSrcweir   | '{' '}'
388cdf0e10cSrcweir   | string_multiline
389cdf0e10cSrcweir 	{
390cdf0e10cSrcweir 		SetString( S.Top(), "TEXT", $1 );
391cdf0e10cSrcweir 	}
392cdf0e10cSrcweir   ;
393cdf0e10cSrcweir 
394cdf0e10cSrcweir var_definitions
395cdf0e10cSrcweir   : var_definition
396cdf0e10cSrcweir   | var_definitions var_definition
397cdf0e10cSrcweir   ;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir xy_mapmode
400cdf0e10cSrcweir   : CONSTNAME
401cdf0e10cSrcweir 	{
402cdf0e10cSrcweir 		SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue );
403cdf0e10cSrcweir 	}
404cdf0e10cSrcweir   |
405cdf0e10cSrcweir   ;
406cdf0e10cSrcweir 
407cdf0e10cSrcweir wh_mapmode
408cdf0e10cSrcweir   : CONSTNAME
409cdf0e10cSrcweir 	{
410cdf0e10cSrcweir 		SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue );
411cdf0e10cSrcweir 	}
412cdf0e10cSrcweir   |
413cdf0e10cSrcweir   ;
414cdf0e10cSrcweir 
415cdf0e10cSrcweir xywh_mapmode
416cdf0e10cSrcweir   : CONSTNAME
417cdf0e10cSrcweir 	{
418cdf0e10cSrcweir 		SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue );
419cdf0e10cSrcweir 		SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue );
420cdf0e10cSrcweir 	}
421cdf0e10cSrcweir   |
422cdf0e10cSrcweir   ;
423cdf0e10cSrcweir 
424cdf0e10cSrcweir var_definition
425cdf0e10cSrcweir   : line_number
426cdf0e10cSrcweir   | var_header var_body ';'
427cdf0e10cSrcweir 	{
428cdf0e10cSrcweir 		S.Pop();
429cdf0e10cSrcweir 	}
430cdf0e10cSrcweir   | class_definition ';'
431cdf0e10cSrcweir   | var_header_class class_body ';'
432cdf0e10cSrcweir 	{
433cdf0e10cSrcweir 		if( TYPE_REF == $1.nTyp )
434cdf0e10cSrcweir 			pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass,
435cdf0e10cSrcweir 							 RscId( $1.nName1 ) );
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 		if( S.Top().pClass->GetCount( S.Top() ) )
438cdf0e10cSrcweir 			pTC->pEH->Error( WRN_SUBINMEMBER, S.Top().pClass,
439cdf0e10cSrcweir 							 RscId(  $1.nName1 ) );
440cdf0e10cSrcweir 
441cdf0e10cSrcweir 		S.Pop();
442cdf0e10cSrcweir 	}
443cdf0e10cSrcweir   | var_header_class ';'
444cdf0e10cSrcweir 	{
445cdf0e10cSrcweir 		ERRTYPE aError;
446cdf0e10cSrcweir 		RscId aRscId( $1.nName1 );
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 		if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() )
449cdf0e10cSrcweir 			aError = S.Top().pClass->SetRef( S.Top(), aRscId );
450cdf0e10cSrcweir 		else if( TYPE_COPY == $1.nTyp )
451cdf0e10cSrcweir 			aError = ERR_COPYNOTALLOWED;
452cdf0e10cSrcweir 		if( S.Top().pClass->GetCount( S.Top() ) )
453cdf0e10cSrcweir 			aError = WRN_SUBINMEMBER;
454cdf0e10cSrcweir 		if( aError.IsError() || aError.IsWarning() )
455cdf0e10cSrcweir 			pTC->pEH->Error( aError, S.Top().pClass, aRscId );
456cdf0e10cSrcweir 
457cdf0e10cSrcweir 		S.Pop();
458cdf0e10cSrcweir 	}
459cdf0e10cSrcweir   | XSCALE '=' '(' long_expression ',' long_expression ')' ';'
460cdf0e10cSrcweir 	{
461cdf0e10cSrcweir 		SetNumber( S.Top(), "_XNUMERATOR", $4 );
462cdf0e10cSrcweir 		SetNumber( S.Top(), "_XDENOMINATOR", $6 );
463cdf0e10cSrcweir 	}
464cdf0e10cSrcweir   | YSCALE '=' '(' long_expression ',' long_expression ')' ';'
465cdf0e10cSrcweir 	{
466cdf0e10cSrcweir 		SetNumber( S.Top(), "_YNUMERATOR", $4 );
467cdf0e10cSrcweir 		SetNumber( S.Top(), "_YDENOMINATOR", $6 );
468cdf0e10cSrcweir 	}
469cdf0e10cSrcweir   | RGB '=' '(' long_expression ',' long_expression
470cdf0e10cSrcweir 				',' long_expression ')' ';'
471cdf0e10cSrcweir 	{
472cdf0e10cSrcweir 		SetNumber( S.Top(), "RED", $4 );
473cdf0e10cSrcweir 		SetNumber( S.Top(), "GREEN", $6 );
474cdf0e10cSrcweir 		SetNumber( S.Top(), "BLUE", $8 );
475cdf0e10cSrcweir 	}
476cdf0e10cSrcweir   | GEOMETRY '=' xywh_mapmode '(' long_expression ',' long_expression ','
477cdf0e10cSrcweir 						long_expression ',' long_expression ')' ';'
478cdf0e10cSrcweir 	{
479cdf0e10cSrcweir 		SetNumber( S.Top(), "_X", $5 );
480cdf0e10cSrcweir 		SetNumber( S.Top(), "_Y", $7 );
481cdf0e10cSrcweir 		SetNumber( S.Top(), "_WIDTH", $9 );
482cdf0e10cSrcweir 		SetNumber( S.Top(), "_HEIGHT", $11 );
483cdf0e10cSrcweir 	}
484cdf0e10cSrcweir   | POSITION '=' xy_mapmode '(' long_expression ',' long_expression
485cdf0e10cSrcweir 							')' ';'
486cdf0e10cSrcweir 	{
487cdf0e10cSrcweir 		SetNumber( S.Top(), "_X", $5 );
488cdf0e10cSrcweir 		SetNumber( S.Top(), "_Y", $7 );
489cdf0e10cSrcweir 	}
490cdf0e10cSrcweir   | DIMENSION '=' wh_mapmode '(' long_expression ',' long_expression
491cdf0e10cSrcweir 							 ')' ';'
492cdf0e10cSrcweir 	{
493cdf0e10cSrcweir 		SetNumber( S.Top(), "_WIDTH", $5 );
494cdf0e10cSrcweir 		SetNumber( S.Top(), "_HEIGHT", $7 );
495cdf0e10cSrcweir 	}
496cdf0e10cSrcweir   | INZOOMOUTPUTSIZE '=' CONSTNAME '(' long_expression ',' long_expression
497cdf0e10cSrcweir 							 ')' ';'
498cdf0e10cSrcweir 	{
499cdf0e10cSrcweir 		SetConst( S.Top(), "_ZOOMINMAPMODE", $3.hashid, $3.nValue );
500cdf0e10cSrcweir 		SetNumber( S.Top(), "_ZOOMINWIDTH", $5 );
501cdf0e10cSrcweir 		SetNumber( S.Top(), "_ZOOMINHEIGHT", $7 );
502cdf0e10cSrcweir 	}
503cdf0e10cSrcweir   | INZOOMOUTPUTSIZE '=' '(' long_expression ',' long_expression ')' ';'
504cdf0e10cSrcweir 	{
505cdf0e10cSrcweir 		SetNumber( S.Top(), "_ZOOMINWIDTH", $4 );
506cdf0e10cSrcweir 		SetNumber( S.Top(), "_ZOOMINHEIGHT", $6 );
507cdf0e10cSrcweir 	}
508cdf0e10cSrcweir   | FLOATINGPOS '=' CONSTNAME '(' long_expression ',' long_expression
509cdf0e10cSrcweir 							 ')' ';'
510cdf0e10cSrcweir 	{
511cdf0e10cSrcweir 		SetConst( S.Top(),	"_FLOATINGPOSMAPMODE", $3.hashid, $3.nValue );
512cdf0e10cSrcweir 		SetNumber( S.Top(), "_FLOATINGPOSX", $5 );
513cdf0e10cSrcweir 		SetNumber( S.Top(), "_FLOATINGPOSY", $7 );
514cdf0e10cSrcweir 	}
515cdf0e10cSrcweir   | FLOATINGPOS '=' '(' long_expression ',' long_expression ')' ';'
516cdf0e10cSrcweir 	{
517cdf0e10cSrcweir 		SetNumber( S.Top(), "_FLOATINGPOSX", $4 );
518cdf0e10cSrcweir 		SetNumber( S.Top(), "_FLOATINGPOSY", $6 );
519cdf0e10cSrcweir 	}
520cdf0e10cSrcweir   ;
521cdf0e10cSrcweir 
522cdf0e10cSrcweir var_header_class
523cdf0e10cSrcweir   : VARNAME '=' class_header_body
524cdf0e10cSrcweir 	{
525cdf0e10cSrcweir 		RSCINST aInst;
526cdf0e10cSrcweir 
527cdf0e10cSrcweir 		aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST(), sal_False, $3.pClass );
528cdf0e10cSrcweir 
529cdf0e10cSrcweir 		if( aInst.pData )
530cdf0e10cSrcweir 			S.Push( aInst );
531cdf0e10cSrcweir 		else
532cdf0e10cSrcweir 		{
533cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
534cdf0e10cSrcweir 							 pHS->getString( $1 )  );
535cdf0e10cSrcweir 			return( ERR_ERROR );
536cdf0e10cSrcweir 		};
537cdf0e10cSrcweir 
538cdf0e10cSrcweir 		if( !DoClassHeader( &$3, sal_True ) )
539cdf0e10cSrcweir 			return( ERR_ERROR );
540cdf0e10cSrcweir 		$$ = $3;
541cdf0e10cSrcweir 	}
542cdf0e10cSrcweir   | VARNAME '[' CONSTNAME ']' '=' class_header_body
543cdf0e10cSrcweir 	{
544cdf0e10cSrcweir 		RSCINST aInst;
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 		aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 		if( aInst.pData )
549cdf0e10cSrcweir 		{
550cdf0e10cSrcweir 			ERRTYPE aError;
551cdf0e10cSrcweir 			RSCINST aIdxInst;
552cdf0e10cSrcweir 
553cdf0e10cSrcweir 			aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst );
554cdf0e10cSrcweir 			if( aError.IsError() || aError.IsWarning() )
555cdf0e10cSrcweir 				 pTC->pEH->Error( aError, S.Top().pClass, RscId() );
556cdf0e10cSrcweir 			if( aError.IsError() )
557cdf0e10cSrcweir 				return( ERR_ERROR );
558cdf0e10cSrcweir 			S.Push( aIdxInst );
559cdf0e10cSrcweir 		}
560cdf0e10cSrcweir 		else
561cdf0e10cSrcweir 		{
562cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
563cdf0e10cSrcweir 							 pHS->getString( $1 )  );
564cdf0e10cSrcweir 			return( ERR_ERROR );
565cdf0e10cSrcweir 		};
566cdf0e10cSrcweir 		if( !DoClassHeader( &$6, sal_True ) )
567cdf0e10cSrcweir 			return( ERR_ERROR );
568cdf0e10cSrcweir 		$$ = $6;
569cdf0e10cSrcweir 	}
570cdf0e10cSrcweir   | VARNAME '[' SYMBOL ']' '=' class_header_body
571cdf0e10cSrcweir 	{
572cdf0e10cSrcweir 		RSCINST aInst;
573cdf0e10cSrcweir 
574cdf0e10cSrcweir 		aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 		if( aInst.pData )
577cdf0e10cSrcweir 		{
578cdf0e10cSrcweir             long nNewLang = pTC->AddLanguage( $3 );
579cdf0e10cSrcweir 			ERRTYPE aError;
580cdf0e10cSrcweir 			RSCINST aIdxInst;
581cdf0e10cSrcweir 
582cdf0e10cSrcweir 			aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst );
583cdf0e10cSrcweir 			if( aError.IsError() || aError.IsWarning() )
584cdf0e10cSrcweir 				 pTC->pEH->Error( aError, S.Top().pClass, RscId() );
585cdf0e10cSrcweir 			if( aError.IsError() )
586cdf0e10cSrcweir 				return( ERR_ERROR );
587cdf0e10cSrcweir 			S.Push( aIdxInst );
588cdf0e10cSrcweir 		}
589cdf0e10cSrcweir 		else
590cdf0e10cSrcweir 		{
591cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
592cdf0e10cSrcweir 							 pHS->getString( $1 )  );
593cdf0e10cSrcweir 			return( ERR_ERROR );
594cdf0e10cSrcweir 		};
595cdf0e10cSrcweir 		if( !DoClassHeader( &$6, sal_True ) )
596cdf0e10cSrcweir 			return( ERR_ERROR );
597cdf0e10cSrcweir 		$$ = $6;
598cdf0e10cSrcweir 	}
599cdf0e10cSrcweir   ;
600cdf0e10cSrcweir 
601cdf0e10cSrcweir var_header
602cdf0e10cSrcweir   : VARNAME '='
603cdf0e10cSrcweir 	{
604cdf0e10cSrcweir 		RSCINST aInst;
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 		aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
607cdf0e10cSrcweir 
608cdf0e10cSrcweir 		if( aInst.pData )
609cdf0e10cSrcweir 			S.Push( aInst );
610cdf0e10cSrcweir 		else{
611cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
612cdf0e10cSrcweir 							 pHS->getString( $1 )  );
613cdf0e10cSrcweir 			return( ERR_ERROR );
614cdf0e10cSrcweir 		};
615cdf0e10cSrcweir 	}
616cdf0e10cSrcweir   | VARNAME '[' CONSTNAME ']' '='
617cdf0e10cSrcweir 	{
618cdf0e10cSrcweir 		RSCINST aInst;
619cdf0e10cSrcweir 
620cdf0e10cSrcweir 		aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
621cdf0e10cSrcweir 
622cdf0e10cSrcweir 		if( aInst.pData )
623cdf0e10cSrcweir 		{
624cdf0e10cSrcweir 			ERRTYPE aError;
625cdf0e10cSrcweir 			RSCINST aIdxInst;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 			aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst );
628cdf0e10cSrcweir 			if( aError.IsError() || aError.IsWarning() )
629cdf0e10cSrcweir 				 pTC->pEH->Error( aError, S.Top().pClass, RscId() );
630cdf0e10cSrcweir 			if( aError.IsError() )
631cdf0e10cSrcweir 				return( ERR_ERROR );
632cdf0e10cSrcweir 			S.Push( aIdxInst );
633cdf0e10cSrcweir 		}
634cdf0e10cSrcweir 		else{
635cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
636cdf0e10cSrcweir 							 pHS->getString( $1 )  );
637cdf0e10cSrcweir 			return( ERR_ERROR );
638cdf0e10cSrcweir 		};
639cdf0e10cSrcweir 	}
640cdf0e10cSrcweir   | VARNAME '[' SYMBOL ']' '='
641cdf0e10cSrcweir 	{
642cdf0e10cSrcweir 		RSCINST aInst;
643cdf0e10cSrcweir 
644cdf0e10cSrcweir 		aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
645cdf0e10cSrcweir 
646cdf0e10cSrcweir 		if( aInst.pData )
647cdf0e10cSrcweir 		{
648cdf0e10cSrcweir             long nNewLang = pTC->AddLanguage( $3 );
649cdf0e10cSrcweir 			ERRTYPE aError;
650cdf0e10cSrcweir 			RSCINST aIdxInst;
651cdf0e10cSrcweir 
652cdf0e10cSrcweir 			aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst );
653cdf0e10cSrcweir 			if( aError.IsError() || aError.IsWarning() )
654cdf0e10cSrcweir 				 pTC->pEH->Error( aError, S.Top().pClass, RscId() );
655cdf0e10cSrcweir 			if( aError.IsError() )
656cdf0e10cSrcweir 				return( ERR_ERROR );
657cdf0e10cSrcweir 			S.Push( aIdxInst );
658cdf0e10cSrcweir 		}
659cdf0e10cSrcweir 		else{
660cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
661cdf0e10cSrcweir 							 pHS->getString( $1 )  );
662cdf0e10cSrcweir 			return( ERR_ERROR );
663cdf0e10cSrcweir 		};
664cdf0e10cSrcweir 	}
665cdf0e10cSrcweir   ;
666cdf0e10cSrcweir tupel_header0
667cdf0e10cSrcweir   :
668cdf0e10cSrcweir 	{
669cdf0e10cSrcweir 		RSCINST aInst;
670cdf0e10cSrcweir 
671cdf0e10cSrcweir 		aInst = S.Top().pClass->GetTupelVar( S.Top(), 0, RSCINST() );
672cdf0e10cSrcweir 		if( aInst.pData )
673cdf0e10cSrcweir 			S.Push( aInst );
674cdf0e10cSrcweir 		else
675cdf0e10cSrcweir 		{
676cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() );
677cdf0e10cSrcweir 			return( ERR_ERROR );
678cdf0e10cSrcweir 		};
679cdf0e10cSrcweir 	}
680cdf0e10cSrcweir   ;
681cdf0e10cSrcweir 
682cdf0e10cSrcweir tupel_header1
683cdf0e10cSrcweir   :
684cdf0e10cSrcweir 	{
685cdf0e10cSrcweir 		RSCINST aInst;
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 		aInst = S.Top().pClass->GetTupelVar( S.Top(), 1, RSCINST() );
688cdf0e10cSrcweir 		if( aInst.pData )
689cdf0e10cSrcweir 			S.Push( aInst );
690cdf0e10cSrcweir 		else
691cdf0e10cSrcweir 		{
692cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() );
693cdf0e10cSrcweir 			return( ERR_ERROR );
694cdf0e10cSrcweir 		};
695cdf0e10cSrcweir 	}
696cdf0e10cSrcweir   ;
697cdf0e10cSrcweir 
698cdf0e10cSrcweir tupel_header2
699cdf0e10cSrcweir   :
700cdf0e10cSrcweir 	{
701cdf0e10cSrcweir 		RSCINST aInst;
702cdf0e10cSrcweir 
703cdf0e10cSrcweir 		aInst = S.Top().pClass->GetTupelVar( S.Top(), 2, RSCINST() );
704cdf0e10cSrcweir 		if( aInst.pData )
705cdf0e10cSrcweir 			S.Push( aInst );
706cdf0e10cSrcweir 		else
707cdf0e10cSrcweir 		{
708cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() );
709cdf0e10cSrcweir 			return( ERR_ERROR );
710cdf0e10cSrcweir 		};
711cdf0e10cSrcweir 	}
712cdf0e10cSrcweir   ;
713cdf0e10cSrcweir 
714cdf0e10cSrcweir tupel_header3
715cdf0e10cSrcweir   :
716cdf0e10cSrcweir 	{
717cdf0e10cSrcweir 		RSCINST aInst;
718cdf0e10cSrcweir 
719cdf0e10cSrcweir 		aInst = S.Top().pClass->GetTupelVar( S.Top(), 3, RSCINST() );
720cdf0e10cSrcweir 		if( !aInst.pData )
721cdf0e10cSrcweir 		{
722cdf0e10cSrcweir 			pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() );
723cdf0e10cSrcweir 			return( ERR_ERROR );
724cdf0e10cSrcweir 		};
725cdf0e10cSrcweir 		S.Push( aInst );
726cdf0e10cSrcweir 	}
727cdf0e10cSrcweir   ;
728cdf0e10cSrcweir 
729cdf0e10cSrcweir tupel_body
730cdf0e10cSrcweir   : var_body
731cdf0e10cSrcweir 	{
732cdf0e10cSrcweir 		S.Pop();
733cdf0e10cSrcweir 	}
734cdf0e10cSrcweir   ;
735cdf0e10cSrcweir 
736cdf0e10cSrcweir var_list_header
737cdf0e10cSrcweir   :
738cdf0e10cSrcweir 	{
739cdf0e10cSrcweir 		ERRTYPE aError;
740cdf0e10cSrcweir 		RSCINST aInst;
741cdf0e10cSrcweir 
742cdf0e10cSrcweir 		aError = S.Top().pClass->GetElement( S.Top(), RscId(),
743cdf0e10cSrcweir 											NULL, RSCINST(), &aInst );
744cdf0e10cSrcweir 		if( aError.IsError() || aError.IsWarning() )
745cdf0e10cSrcweir 			pTC->pEH->Error( aError, S.Top().pClass, RscId() );
746cdf0e10cSrcweir 		if( aError.IsError() )
747cdf0e10cSrcweir 		{ // unbedingt Instanz auf den Stack bringen
748cdf0e10cSrcweir 			aInst = S.Top().pClass->Create( NULL, RSCINST() );
749cdf0e10cSrcweir 		}
750cdf0e10cSrcweir 		S.Push( aInst );
751cdf0e10cSrcweir 	}
752cdf0e10cSrcweir   ;
753cdf0e10cSrcweir 
754cdf0e10cSrcweir list_body
755cdf0e10cSrcweir   : var_bodycomplex
756cdf0e10cSrcweir 	{
757cdf0e10cSrcweir 		S.Pop();
758cdf0e10cSrcweir 	}
759cdf0e10cSrcweir   ;
760cdf0e10cSrcweir 
761cdf0e10cSrcweir list_header
762cdf0e10cSrcweir   :
763cdf0e10cSrcweir 	{
764cdf0e10cSrcweir 		sal_uInt32 nCount = S.Top().pClass->GetCount( S.Top() );
765cdf0e10cSrcweir 		sal_uInt32 i;
766cdf0e10cSrcweir 
767cdf0e10cSrcweir 		for( i = nCount; i > 0; i-- )
768cdf0e10cSrcweir 			S.Top().pClass->DeletePos( S.Top(), i -1 );
769cdf0e10cSrcweir 	}
770cdf0e10cSrcweir   ;
771cdf0e10cSrcweir 
772cdf0e10cSrcweir list
773cdf0e10cSrcweir   : list var_list_header list_body ';'
774cdf0e10cSrcweir   | list var_bodysimple ';'
775cdf0e10cSrcweir   | list class_definition ';'
776cdf0e10cSrcweir   | list line_number
777cdf0e10cSrcweir   |
778cdf0e10cSrcweir   ;
779cdf0e10cSrcweir 
780cdf0e10cSrcweir var_bodysimple
781cdf0e10cSrcweir   : macro_expression
782cdf0e10cSrcweir 	{
783cdf0e10cSrcweir 		sal_Int32	l;
784cdf0e10cSrcweir 		ERRTYPE aError;
785cdf0e10cSrcweir 
786cdf0e10cSrcweir 		if( !$1.Evaluate( &l ) )
787cdf0e10cSrcweir 			pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
788cdf0e10cSrcweir 		else
789cdf0e10cSrcweir 		{
790cdf0e10cSrcweir 			aError = S.Top().pClass->SetRef( S.Top(), RscId( $1 ) );
791cdf0e10cSrcweir 			if( aError.IsError() )
792cdf0e10cSrcweir 			{
793cdf0e10cSrcweir 				aError.Clear();
794cdf0e10cSrcweir 				aError = S.Top().pClass->SetNumber( S.Top(), l );
795cdf0e10cSrcweir 			}
796cdf0e10cSrcweir 			if( aError.IsError() )
797cdf0e10cSrcweir 			{ // Aufwaertskompatible, Tupel probieren
798cdf0e10cSrcweir 				RSCINST aInst = GetFirstTupelEle( S.Top() );
799cdf0e10cSrcweir 				if( aInst.pData )
800cdf0e10cSrcweir 				{
801cdf0e10cSrcweir 					aError.Clear(); // Fehler zuruecksetzen
802cdf0e10cSrcweir 					aError = aInst.pClass->SetRef( aInst, RscId( $1 ) );
803cdf0e10cSrcweir 					if( aError.IsError() )
804cdf0e10cSrcweir 					{
805cdf0e10cSrcweir 						aError.Clear();
806cdf0e10cSrcweir 						aError = aInst.pClass->SetNumber( aInst, l );
807cdf0e10cSrcweir 					}
808cdf0e10cSrcweir 				}
809cdf0e10cSrcweir 			}
810cdf0e10cSrcweir 		}
811cdf0e10cSrcweir 
812cdf0e10cSrcweir 		if( $1.IsExpression() )
813cdf0e10cSrcweir 			delete $1.aExp.pExp;
814cdf0e10cSrcweir 
815cdf0e10cSrcweir 		if( aError.IsError() || aError.IsWarning() )
816cdf0e10cSrcweir 			pTC->pEH->Error( aError, S.Top().pClass, RscId() );
817cdf0e10cSrcweir 	}
818cdf0e10cSrcweir   | CONSTNAME
819cdf0e10cSrcweir 	{
820cdf0e10cSrcweir 		ERRTYPE aError;
821cdf0e10cSrcweir 		aError = S.Top().pClass->SetConst( S.Top(), $1.hashid, $1.nValue );
822cdf0e10cSrcweir 		if( aError.IsError() )
823cdf0e10cSrcweir 		{ // Aufwaertskompatible, Tupel probieren
824cdf0e10cSrcweir 			RSCINST aInst = GetFirstTupelEle( S.Top() );
825cdf0e10cSrcweir 			if( aInst.pData )
826cdf0e10cSrcweir 			{
827cdf0e10cSrcweir 				aError.Clear(); // Fehler zuruecksetzen
828cdf0e10cSrcweir 				aError = aInst.pClass->SetConst( aInst, $1.hashid, $1.nValue );
829cdf0e10cSrcweir 			}
830cdf0e10cSrcweir 		}
831cdf0e10cSrcweir 
832cdf0e10cSrcweir 		if( aError.IsError() || aError.IsWarning() )
833cdf0e10cSrcweir 			pTC->pEH->Error( aError, S.Top().pClass, RscId() );
834cdf0e10cSrcweir 	}
835cdf0e10cSrcweir   | NOT CONSTNAME
836cdf0e10cSrcweir 	{
837cdf0e10cSrcweir 		ERRTYPE aError;
838cdf0e10cSrcweir 		aError = S.Top().pClass->SetNotConst( S.Top(), $2.hashid );
839cdf0e10cSrcweir 		if( aError.IsError() )
840cdf0e10cSrcweir 		{ // Aufwaertskompatible, Tupel probieren
841cdf0e10cSrcweir 			RSCINST aInst = GetFirstTupelEle( S.Top() );
842cdf0e10cSrcweir 			if( aInst.pData )
843cdf0e10cSrcweir 			{
844cdf0e10cSrcweir 				aError.Clear(); // Fehler zuruecksetzen
845cdf0e10cSrcweir 				aError = aInst.pClass->SetNotConst( aInst, $2.hashid );
846cdf0e10cSrcweir 			}
847cdf0e10cSrcweir 		}
848cdf0e10cSrcweir 
849cdf0e10cSrcweir 		if( aError.IsError() || aError.IsWarning() )
850cdf0e10cSrcweir 			pTC->pEH->Error( aError, S.Top().pClass, RscId() );
851cdf0e10cSrcweir 	}
852cdf0e10cSrcweir   | BOOLEAN
853cdf0e10cSrcweir 	{
854cdf0e10cSrcweir 		ERRTYPE aError;
855cdf0e10cSrcweir 		aError = S.Top().pClass->SetBool( S.Top(), $1 );
856cdf0e10cSrcweir 		if( aError.IsError() )
857cdf0e10cSrcweir 		{ // Aufwaertskompatible, Tupel probieren
858cdf0e10cSrcweir 			RSCINST aInst = GetFirstTupelEle( S.Top() );
859cdf0e10cSrcweir 			if( aInst.pData )
860cdf0e10cSrcweir 			{
861cdf0e10cSrcweir 				aError.Clear(); // Fehler zuruecksetzen
862cdf0e10cSrcweir 				aError = aInst.pClass->SetBool( aInst, $1 );
863cdf0e10cSrcweir 			}
864cdf0e10cSrcweir 		}
865cdf0e10cSrcweir 
866cdf0e10cSrcweir 		if( aError.IsError() || aError.IsWarning() )
867cdf0e10cSrcweir 			pTC->pEH->Error( aError, S.Top().pClass, RscId() );
868cdf0e10cSrcweir 	}
869cdf0e10cSrcweir   | string_multiline
870cdf0e10cSrcweir 	{
871cdf0e10cSrcweir 		ERRTYPE aError;
872cdf0e10cSrcweir 		aError = S.Top().pClass->SetString( S.Top(), $1 );
873cdf0e10cSrcweir 		if( aError.IsError() )
874cdf0e10cSrcweir 		{ // Aufwaertskompatible, Tupel probieren
875cdf0e10cSrcweir 			RSCINST aInst = GetFirstTupelEle( S.Top() );
876cdf0e10cSrcweir 			if( aInst.pData )
877cdf0e10cSrcweir 			{
878cdf0e10cSrcweir 				aError.Clear(); // Fehler zuruecksetzen
879cdf0e10cSrcweir 				aError = aInst.pClass->SetString( aInst, $1 );
880cdf0e10cSrcweir 			}
881cdf0e10cSrcweir 		}
882cdf0e10cSrcweir 
883cdf0e10cSrcweir 		if( aError.IsError() || aError.IsWarning() )
884cdf0e10cSrcweir 			pTC->pEH->Error( aError, S.Top().pClass, RscId() );
885cdf0e10cSrcweir 	}
886cdf0e10cSrcweir   | DEFAULT
887cdf0e10cSrcweir   ;
888cdf0e10cSrcweir 
889cdf0e10cSrcweir var_bodycomplex
890cdf0e10cSrcweir   : '{' list_header list '}'
891cdf0e10cSrcweir   | '<' tupel_header0 tupel_body ';' '>'
892cdf0e10cSrcweir   | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' '>'
893cdf0e10cSrcweir   | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';'
894cdf0e10cSrcweir 		tupel_header2 tupel_body ';' '>'
895cdf0e10cSrcweir   | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';'
896cdf0e10cSrcweir 		tupel_header2 tupel_body ';' tupel_header3 tupel_body ';' '>'
897cdf0e10cSrcweir   ;
898cdf0e10cSrcweir 
899cdf0e10cSrcweir var_body
900cdf0e10cSrcweir   : var_bodysimple
901cdf0e10cSrcweir   | var_bodycomplex
902cdf0e10cSrcweir   ;
903cdf0e10cSrcweir 
904cdf0e10cSrcweir /********************** work on yacc stack *******************************/
905cdf0e10cSrcweir string_multiline
906cdf0e10cSrcweir   : STRING
907cdf0e10cSrcweir 	{
908cdf0e10cSrcweir 		$$ = $1;
909cdf0e10cSrcweir 	}
910cdf0e10cSrcweir   | string_multiline STRING
911cdf0e10cSrcweir 	{
912cdf0e10cSrcweir         rtl::OStringBuffer aBuf( 256 );
913cdf0e10cSrcweir         aBuf.append( $1 );
914cdf0e10cSrcweir         aBuf.append( $2 );
915cdf0e10cSrcweir         $$ = (char*)pStringContainer->putString( aBuf.getStr() );
916cdf0e10cSrcweir 	}
917cdf0e10cSrcweir   ;
918cdf0e10cSrcweir 
919cdf0e10cSrcweir long_expression
920cdf0e10cSrcweir   : macro_expression
921cdf0e10cSrcweir 	{
922cdf0e10cSrcweir 		if( !$1.Evaluate( &$$ ) )
923cdf0e10cSrcweir 			pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
924cdf0e10cSrcweir 		if( $1.IsExpression() )
925cdf0e10cSrcweir 			delete $1.aExp.pExp;
926cdf0e10cSrcweir 	}
927cdf0e10cSrcweir   ;
928cdf0e10cSrcweir 
929cdf0e10cSrcweir macro_expression
930cdf0e10cSrcweir   : RSCDEFINE
931cdf0e10cSrcweir 	{
932cdf0e10cSrcweir 		$$.cType = RSCEXP_DEF;
933cdf0e10cSrcweir 		$$.aExp.pDef = $1;
934cdf0e10cSrcweir 	}
935cdf0e10cSrcweir   | NUMBER
936cdf0e10cSrcweir 	{
937cdf0e10cSrcweir 		$$.cType = RSCEXP_LONG;
938cdf0e10cSrcweir 		$$.SetLong( $1 );
939cdf0e10cSrcweir 	}
940cdf0e10cSrcweir   | '-' macro_expression %prec UNARYMINUS
941cdf0e10cSrcweir 	{
942cdf0e10cSrcweir 		if( $2.IsNumber() ){
943cdf0e10cSrcweir 			$$.cType = $2.cType;
944cdf0e10cSrcweir 			$$.SetLong( - $2.GetLong() );
945cdf0e10cSrcweir 		}
946cdf0e10cSrcweir 		else{
947cdf0e10cSrcweir 			RscExpType aLeftExp;
948cdf0e10cSrcweir 
949cdf0e10cSrcweir 			aLeftExp.cType = RSCEXP_NOTHING;
950cdf0e10cSrcweir 			$$.cType = RSCEXP_EXP;
951cdf0e10cSrcweir 			$$.aExp.pExp = new RscExpression( aLeftExp, '-', $2 );
952cdf0e10cSrcweir 		}
953cdf0e10cSrcweir 	}
954cdf0e10cSrcweir   | '+' macro_expression %prec UNARYPLUS
955cdf0e10cSrcweir 	{
956cdf0e10cSrcweir 		$$ = $2;
957cdf0e10cSrcweir 	}
958cdf0e10cSrcweir   | macro_expression '+' macro_expression
959cdf0e10cSrcweir 	{
960cdf0e10cSrcweir 		if( $1.IsNumber() && $3.IsNumber() ){
961cdf0e10cSrcweir 			$$.cType = RSCEXP_LONG;
962cdf0e10cSrcweir 			$$.SetLong( $1.GetLong() + $3.GetLong() );
963cdf0e10cSrcweir 		}
964cdf0e10cSrcweir 		else{
965cdf0e10cSrcweir 			$$.cType = RSCEXP_EXP;
966cdf0e10cSrcweir 			$$.aExp.pExp = new RscExpression( $1, '+', $3 );
967cdf0e10cSrcweir 		}
968cdf0e10cSrcweir 	}
969cdf0e10cSrcweir   | macro_expression '-' macro_expression
970cdf0e10cSrcweir 	{
971cdf0e10cSrcweir 		if( $1.IsNumber() && $3.IsNumber() ){
972cdf0e10cSrcweir 			$$.cType = RSCEXP_LONG;
973cdf0e10cSrcweir 			$$.SetLong( $1.GetLong() - $3.GetLong() );
974cdf0e10cSrcweir 		}
975cdf0e10cSrcweir 		else{
976cdf0e10cSrcweir 			$$.cType = RSCEXP_EXP;
977cdf0e10cSrcweir 			$$.aExp.pExp = new RscExpression( $1, '-', $3 );
978cdf0e10cSrcweir 		}
979cdf0e10cSrcweir 	}
980cdf0e10cSrcweir   | macro_expression '*' macro_expression
981cdf0e10cSrcweir 	{
982cdf0e10cSrcweir 		if( $1.IsNumber() && $3.IsNumber() ){
983cdf0e10cSrcweir 			$$.cType = RSCEXP_LONG;
984cdf0e10cSrcweir 			$$.SetLong( $1.GetLong() * $3.GetLong() );
985cdf0e10cSrcweir 		}
986cdf0e10cSrcweir 		else{
987cdf0e10cSrcweir 			$$.cType = RSCEXP_EXP;
988cdf0e10cSrcweir 			$$.aExp.pExp = new RscExpression( $1, '*', $3 );
989cdf0e10cSrcweir 		}
990cdf0e10cSrcweir 	}
991cdf0e10cSrcweir   | macro_expression '/' macro_expression
992cdf0e10cSrcweir 	{
993cdf0e10cSrcweir 		if( $1.IsNumber() && $3.IsNumber() ){
994cdf0e10cSrcweir 			if( 0 == $3.GetLong() ){
995cdf0e10cSrcweir 				$$.cType = RSCEXP_EXP;
996cdf0e10cSrcweir 				$$.aExp.pExp = new RscExpression( $1, '/', $3 );
997cdf0e10cSrcweir 			}
998cdf0e10cSrcweir 			else{
999cdf0e10cSrcweir 				$$.cType = RSCEXP_LONG;
1000cdf0e10cSrcweir 				$$.SetLong( $1.GetLong() / $3.GetLong() );
1001cdf0e10cSrcweir 			}
1002cdf0e10cSrcweir 		}
1003cdf0e10cSrcweir 		else{
1004cdf0e10cSrcweir 			$$.cType = RSCEXP_EXP;
1005cdf0e10cSrcweir 			$$.aExp.pExp = new RscExpression( $1, '/', $3 );
1006cdf0e10cSrcweir 		}
1007cdf0e10cSrcweir 	}
1008cdf0e10cSrcweir   | macro_expression '&' macro_expression
1009cdf0e10cSrcweir 	{
1010cdf0e10cSrcweir 		if( $1.IsNumber() && $3.IsNumber() ){
1011cdf0e10cSrcweir 			$$.cType = RSCEXP_LONG;
1012cdf0e10cSrcweir 			$$.SetLong( $1.GetLong() & $3.GetLong() );
1013cdf0e10cSrcweir 		}
1014cdf0e10cSrcweir 		else{
1015cdf0e10cSrcweir 			$$.cType = RSCEXP_EXP;
1016cdf0e10cSrcweir 			$$.aExp.pExp = new RscExpression( $1, '&', $3 );
1017cdf0e10cSrcweir 		}
1018cdf0e10cSrcweir 	}
1019cdf0e10cSrcweir   | macro_expression '|' macro_expression
1020cdf0e10cSrcweir 	{
1021cdf0e10cSrcweir 		if( $1.IsNumber() && $3.IsNumber() ){
1022cdf0e10cSrcweir 			$$.cType = RSCEXP_LONG;
1023cdf0e10cSrcweir 			$$.SetLong( $1.GetLong() | $3.GetLong() );
1024cdf0e10cSrcweir 		}
1025cdf0e10cSrcweir 		else{
1026cdf0e10cSrcweir 			$$.cType = RSCEXP_EXP;
1027cdf0e10cSrcweir 			$$.aExp.pExp = new RscExpression( $1, '|', $3 );
1028cdf0e10cSrcweir 		}
1029cdf0e10cSrcweir 	}
1030cdf0e10cSrcweir   | '(' macro_expression ')'
1031cdf0e10cSrcweir 	{
1032cdf0e10cSrcweir 		$$ = $2;
1033cdf0e10cSrcweir 	}
1034cdf0e10cSrcweir   | macro_expression LEFTSHIFT macro_expression
1035cdf0e10cSrcweir 	{
1036cdf0e10cSrcweir 		if( $1.IsNumber() && $3.IsNumber() ){
1037cdf0e10cSrcweir 			$$.cType = RSCEXP_LONG;
1038cdf0e10cSrcweir 			$$.SetLong( $1.GetLong() << $3.GetLong() );
1039cdf0e10cSrcweir 		}
1040cdf0e10cSrcweir 		else{
1041cdf0e10cSrcweir 			$$.cType = RSCEXP_EXP;
1042cdf0e10cSrcweir 			$$.aExp.pExp = new RscExpression( $1, 'l', $3 );
1043cdf0e10cSrcweir 		}
1044cdf0e10cSrcweir 	}
1045cdf0e10cSrcweir   | macro_expression RIGHTSHIFT macro_expression
1046cdf0e10cSrcweir 	{
1047cdf0e10cSrcweir 		if( $1.IsNumber() && $3.IsNumber() ){
1048cdf0e10cSrcweir 			$$.cType = RSCEXP_LONG;
1049cdf0e10cSrcweir 			$$.SetLong( $1.GetLong() >> $3.GetLong() );
1050cdf0e10cSrcweir 		}
1051cdf0e10cSrcweir 		else{
1052cdf0e10cSrcweir 			$$.cType = RSCEXP_EXP;
1053cdf0e10cSrcweir 			$$.aExp.pExp = new RscExpression( $1, 'r', $3 );
1054cdf0e10cSrcweir 		}
1055cdf0e10cSrcweir 	}
1056cdf0e10cSrcweir   ;
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir id_expression
1059cdf0e10cSrcweir   : id_expression line_number
1060cdf0e10cSrcweir   | macro_expression
1061cdf0e10cSrcweir 	{  // pExpession auswerten und loeschen
1062cdf0e10cSrcweir 		if( RSCEXP_EXP == $1.cType ){
1063cdf0e10cSrcweir 			sal_Int32	lValue;
1064cdf0e10cSrcweir 
1065cdf0e10cSrcweir 			if( !$1.Evaluate( &lValue ) )
1066cdf0e10cSrcweir 				pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
1067cdf0e10cSrcweir 			delete $1.aExp.pExp;
1068cdf0e10cSrcweir 			$$.cType = RSCEXP_LONG;
1069cdf0e10cSrcweir 			$$.SetLong( lValue );
1070cdf0e10cSrcweir 		}
1071cdf0e10cSrcweir 		else
1072cdf0e10cSrcweir 			$$ = $1;
1073cdf0e10cSrcweir 	}
1074cdf0e10cSrcweir   ;
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir DUMMY_NUMBER
1077cdf0e10cSrcweir   : NUMBER
1078cdf0e10cSrcweir 	{
1079cdf0e10cSrcweir 	}
1080cdf0e10cSrcweir   |
1081cdf0e10cSrcweir 	{
1082cdf0e10cSrcweir 	}
1083cdf0e10cSrcweir   ;
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir line_number
1086cdf0e10cSrcweir   : '#' LINE NUMBER STRING
1087cdf0e10cSrcweir 	{
1088cdf0e10cSrcweir 		RscFile * pFName;
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir 		pFI->SetLineNo( $3 );
1091cdf0e10cSrcweir 		pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( ByteString( $4 ) ) );
1092cdf0e10cSrcweir 		pFName = pTC->aFileTab.Get( pFI->GetFileIndex() );
1093cdf0e10cSrcweir 		pFName->bLoaded = sal_True;
1094cdf0e10cSrcweir 		pFName->bScanned = sal_True;
1095cdf0e10cSrcweir 	}
1096cdf0e10cSrcweir   | '#' NUMBER STRING DUMMY_NUMBER
1097cdf0e10cSrcweir 	{
1098cdf0e10cSrcweir 		RscFile * pFName;
1099cdf0e10cSrcweir 
1100cdf0e10cSrcweir 		pFI->SetLineNo( $2 );
1101cdf0e10cSrcweir 		pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( ByteString( $3 ) ) );
1102cdf0e10cSrcweir 		pFName = pTC->aFileTab.Get( pFI->GetFileIndex() );
1103cdf0e10cSrcweir 		pFName->bLoaded = sal_True;
1104cdf0e10cSrcweir 		pFName->bScanned = sal_True;
1105cdf0e10cSrcweir 	}
1106cdf0e10cSrcweir   | '#' NUMBER
1107cdf0e10cSrcweir 	{
1108cdf0e10cSrcweir 		pFI->SetLineNo( $2 );
1109cdf0e10cSrcweir 	}
1110cdf0e10cSrcweir   ;
1111cdf0e10cSrcweir 
1112cdf0e10cSrcweir 
1113cdf0e10cSrcweir 
1114cdf0e10cSrcweir 
1115