Branch data Line data Source code
1 : : %{
2 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 : : /*
4 : : * This file is part of the LibreOffice project.
5 : : *
6 : : * This Source Code Form is subject to the terms of the Mozilla Public
7 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
8 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 : : *
10 : : * This file incorporates work covered by the following license notice:
11 : : *
12 : : * Licensed to the Apache Software Foundation (ASF) under one or more
13 : : * contributor license agreements. See the NOTICE file distributed
14 : : * with this work for additional information regarding copyright
15 : : * ownership. The ASF licenses this file to you under the Apache
16 : : * License, Version 2.0 (the "License"); you may not use this file
17 : : * except in compliance with the License. You may obtain a copy of
18 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 : : */
20 : :
21 : : #include <stdio.h>
22 : : #include <ctype.h>
23 : : #include <string.h>
24 : :
25 : : #include <rtl/strbuf.hxx>
26 : : #include <tools/rc.h>
27 : : #include <rscerror.h>
28 : : #include <rsctools.hxx>
29 : : #include <rscclass.hxx>
30 : : #include <rsccont.hxx>
31 : : #include <rsctree.hxx>
32 : : #include <rscdb.hxx>
33 : : #include <rscdef.hxx>
34 : : #include <rscpar.hxx>
35 : :
36 : : #include <rsclex.hxx>
37 : :
38 : : /************** V a r i a b l e n ****************************************/
39 : 1440 : ObjectStack S;
40 : : RscTop * pCurClass;
41 : : sal_uInt32 nCurMask;
42 : : char szErrBuf[ 100 ];
43 : :
44 : : /************** H i l f s F u n k t i o n e n ****************************/
45 : 234210 : RSCINST GetVarInst( const RSCINST & rInst, const char * pVarName )
46 : : {
47 : 234210 : RSCINST aInst;
48 : :
49 : : aInst = rInst.pClass->GetVariable( rInst, pHS->getID( pVarName ),
50 [ + - ][ + - ]: 234210 : RSCINST() );
51 : :
52 [ - + ]: 234210 : if( !aInst.pData )
53 [ # # ]: 0 : pTC->pEH->Error( ERR_NOVARIABLENAME, rInst.pClass, RscId() );
54 : :
55 : 234210 : return( aInst );
56 : : }
57 : :
58 : 156144 : void SetNumber( const RSCINST & rInst, const char * pVarName, sal_Int32 lValue )
59 : : {
60 : 156144 : RSCINST aInst;
61 : :
62 [ + - ]: 156144 : aInst = GetVarInst( rInst, pVarName );
63 : :
64 [ + - ]: 156144 : if( aInst.pData ){
65 : 156144 : ERRTYPE aError;
66 [ + - ][ + - ]: 156144 : aError = aInst.pClass->SetNumber( aInst, lValue );
67 : :
68 [ - + ]: 156144 : if( aError.IsError() )
69 [ # # ][ # # ]: 156144 : pTC->pEH->Error( aError, aInst.pClass, RscId() );
70 : : }
71 : 156144 : }
72 : :
73 : 78064 : void SetConst( const RSCINST & rInst, const char * pVarName,
74 : : Atom nValueId, sal_Int32 nVal )
75 : : {
76 : 78064 : RSCINST aInst;
77 : :
78 [ + - ]: 78064 : aInst = GetVarInst( rInst, pVarName );
79 [ + - ]: 78064 : if( aInst.pData )
80 : : {
81 : 78064 : ERRTYPE aError;
82 [ + - ][ + - ]: 78064 : aError = aInst.pClass->SetConst( aInst, nValueId, nVal );
83 : :
84 [ - + ]: 78064 : if( aError.IsError() )
85 [ # # ][ # # ]: 78064 : pTC->pEH->Error( aError, aInst.pClass, RscId() );
86 : : }
87 : 78064 : }
88 : :
89 : 2 : void SetString( const RSCINST & rInst, const char * pVarName, const char * pStr )
90 : : {
91 : 2 : RSCINST aInst;
92 : :
93 [ + - ]: 2 : aInst = GetVarInst( rInst, pVarName );
94 [ + - ]: 2 : if( aInst.pData ){
95 : 2 : ERRTYPE aError;
96 [ + - ][ + - ]: 2 : aError = aInst.pClass->SetString( aInst, pStr );
97 : :
98 [ - + ]: 2 : if( aError.IsError() )
99 [ # # ][ # # ]: 2 : pTC->pEH->Error( aError, aInst.pClass, RscId() );
100 : : }
101 : 2 : }
102 : :
103 : 247940 : RscId MakeRscId( RscExpType aExpType )
104 : : {
105 [ + + ]: 247940 : if( !aExpType.IsNothing() )
106 : : {
107 : 100460 : sal_Int32 lValue(0);
108 : :
109 [ + - ][ - + ]: 100460 : if( !aExpType.Evaluate( &lValue ) )
110 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
111 [ + - ][ - + ]: 100460 : if( lValue < 1 || lValue > (sal_Int32)0x7FFF )
112 : : {
113 : : pTC->pEH->Error( ERR_IDRANGE, NULL, RscId(),
114 [ # # ][ # # ]: 0 : rtl::OString::valueOf(lValue).getStr() );
115 : : }
116 : :
117 [ - + ]: 100460 : if( aExpType.IsDefinition() )
118 [ # # ]: 0 : return RscId( aExpType.aExp.pDef );
119 : : else
120 : 100460 : return RscId( lValue );
121 : : }
122 : 247940 : return RscId();
123 : : }
124 : :
125 : 123970 : sal_Bool DoClassHeader( RSCHEADER * pHeader, sal_Bool bMember )
126 : : {
127 : 123970 : RSCINST aCopyInst;
128 [ + - ]: 123970 : RscId aName1 = MakeRscId( pHeader->nName1 );
129 [ + - ]: 123970 : RscId aName2 = MakeRscId( pHeader->nName2 );
130 : :
131 [ - + ]: 123970 : if( pHeader->pRefClass )
132 : 0 : aCopyInst.pClass = pHeader->pRefClass;
133 : : else
134 : 123970 : aCopyInst.pClass = pHeader->pClass;
135 : :
136 [ + + ]: 123970 : if( TYPE_COPY == pHeader->nTyp )
137 : : {
138 [ + - ]: 18 : ObjNode * pCopyObj = aCopyInst.pClass->GetObjNode( aName2 );
139 : :
140 [ - + ]: 18 : if( !pCopyObj )
141 : : {
142 [ # # ][ # # ]: 0 : rtl::OStringBuffer aMsg( pHS->getString( aCopyInst.pClass->GetId() ) );
[ # # ]
143 [ # # ]: 0 : aMsg.append(' ');
144 [ # # ][ # # ]: 0 : aMsg.append(aName2.GetName());
145 : : pTC->pEH->Error( ERR_NOCOPYOBJ, pHeader->pClass, aName1,
146 [ # # ]: 0 : aMsg.getStr() );
147 : : }
148 : : else
149 : 18 : aCopyInst.pData = pCopyObj->GetRscObj();
150 : : }
151 : :
152 [ + + ]: 123970 : if( bMember )
153 : : {
154 : : // Angabe von Superklassen oder abgeleiteten Klassen ist jetzt erlaubt
155 [ + - ][ - + ]: 5810 : if( S.Top().pClass->InHierarchy( pHeader->pClass )
[ # # ][ + - ]
156 [ # # ]: 0 : || pHeader->pClass->InHierarchy( S.Top().pClass) )
157 : : {
158 [ - + ]: 5810 : if( aCopyInst.IsInst() )
159 : : {
160 : 0 : RSCINST aTmpI( S.Top() );
161 [ # # ]: 0 : aTmpI.pClass->Destroy( aTmpI );
162 [ # # ]: 0 : aTmpI.pClass->Create( &aTmpI, aCopyInst );
163 : : };
164 : : }
165 : : else
166 : 0 : pTC->pEH->Error( ERR_FALSETYPE, S.Top().pClass, aName1,
167 [ # # ][ # # ]: 0 : pHS->getString( pHeader->pClass->GetId() ).getStr() );
[ # # ]
168 : : }
169 : : else
170 : : {
171 [ + + ]: 118160 : if( S.IsEmpty() )
172 : : {
173 [ + - ][ - + ]: 36744 : if( (sal_Int32)aName1 < 256 )
174 [ # # ]: 0 : pTC->pEH->Error( WRN_GLOBALID, pHeader->pClass, aName1 );
175 : :
176 [ + + ]: 36744 : if( aCopyInst.IsInst() )
177 [ + - ][ + - ]: 18 : S.Push( pHeader->pClass->Create( NULL, aCopyInst ) );
178 : : else
179 [ + - ][ + - ]: 36726 : S.Push( pHeader->pClass->Create( NULL, RSCINST() ) );
180 : :
181 : 36744 : ObjNode * pNode = new ObjNode( aName1, S.Top().pData,
182 [ + - ][ + - ]: 36744 : pFI->GetFileIndex() );
183 [ + - ]: 36744 : pTC->pEH->StdOut( ".", RscVerbosityVerbose );
184 : :
185 [ - + ]: 36744 : if( !aName1.IsId() )
186 [ # # ]: 0 : pTC->pEH->Error( ERR_IDEXPECTED, pHeader->pClass, aName1 );
187 [ + - ][ - + ]: 36744 : else if( !pHeader->pClass->PutObjNode( pNode ) )
188 [ # # ]: 0 : pTC->pEH->Error( ERR_DOUBLEID, pHeader->pClass, aName1 );
189 : : }
190 : : else
191 : : {
192 : 81416 : RSCINST aTmpI;
193 : 81416 : ERRTYPE aError;
194 : :
195 [ + + ][ + - ]: 81416 : if( (sal_Int32)aName1 >= 256 && aName1.IsId() )
[ + + ][ + - ]
196 [ + - ]: 7072 : pTC->pEH->Error( WRN_LOCALID, pHeader->pClass, aName1 );
197 : 81416 : aError = S.Top().pClass->GetElement( S.Top(), aName1,
198 [ + - ][ + - ]: 81416 : pHeader->pClass, aCopyInst, &aTmpI );
199 : :
200 [ - + ]: 81416 : if( aError.IsWarning() )
201 [ # # ]: 0 : pTC->pEH->Error( aError, pHeader->pClass, aName1 );
202 [ - + ]: 81416 : else if( aError.IsError() )
203 : : {
204 [ # # ]: 0 : if( ERR_CONT_INVALIDTYPE == aError )
205 : 0 : pTC->pEH->Error( aError, S.Top().pClass, aName1,
206 [ # # ][ # # ]: 0 : pHS->getString( pHeader->pClass->GetId() ).getStr() );
[ # # ]
207 : : else
208 [ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, aName1 );
209 : 0 : S.Top().pClass->GetElement( S.Top(), RscId(),
210 [ # # ][ # # ]: 0 : pHeader->pClass, RSCINST(), &aTmpI );
211 : :
212 [ # # ]: 0 : if( !aTmpI.IsInst() )
213 : 0 : return( sal_False );
214 : : }
215 [ + - ]: 81416 : S.Push( aTmpI );
216 : : };
217 : : };
218 [ + + ]: 123970 : if( TYPE_REF == pHeader->nTyp )
219 : : {
220 : 18 : ERRTYPE aError;
221 : :
222 [ + - ][ + - ]: 18 : aError = S.Top().pClass->SetRef( S.Top(), aName2 );
223 [ + - ]: 18 : pTC->pEH->Error( aError, S.Top().pClass, aName1 );
224 : : }
225 : :
226 [ + - ][ + - ]: 123970 : return( sal_True );
227 : : }
228 : :
229 : 218 : RSCINST GetFirstTupelEle( const RSCINST & rTop )
230 : : { // Aufwaertskompatible, Tupel probieren
231 : 218 : RSCINST aInst;
232 : 218 : ERRTYPE aErr;
233 : :
234 [ + - ][ + - ]: 218 : aErr = rTop.pClass->GetElement( rTop, RscId(), NULL, RSCINST(), &aInst );
[ + - ]
235 [ + - ]: 218 : if( !aErr.IsError() )
236 [ + - ]: 218 : aInst = aInst.pClass->GetTupelVar( aInst, 0, RSCINST() );
237 : 218 : return aInst;
238 : : }
239 : :
240 : : /************** Y a c c C o d e ****************************************/
241 : : //#define YYDEBUG 1
242 : :
243 : : #define TYPE_Atom 0
244 : : #define TYPE_RESID 1
245 : :
246 : : #ifdef UNX
247 : : #define YYMAXDEPTH 2000
248 : : #else
249 : : #define YYMAXDEPTH 800
250 : : #endif
251 : :
252 : : #if defined _MSC_VER
253 : : #pragma warning(push, 1)
254 : : #pragma warning(disable:4129 4273 4701 4702)
255 : : #endif
256 : : #if defined __GNUC__
257 : : #define GCC_VERSION (__GNUC__ * 10000 \
258 : : + __GNUC_MINOR__ * 100 \
259 : : + __GNUC_PATCHLEVEL__)
260 : : /* Diagnostics pragma was introduced with gcc-4.2.1 */
261 : : #if GCC_VERSION >= 40201
262 : : #pragma GCC diagnostic ignored "-Wwrite-strings"
263 : : #endif
264 : : #elif defined __SUNPRO_CC
265 : : #pragma disable_warn
266 : : #endif
267 : : %}
268 : :
269 : : /* Compilerstack */
270 : :
271 : : %union {
272 : : Atom varid;
273 : : struct {
274 : : Atom hashid;
275 : : sal_Int32 nValue;
276 : : } constname;
277 : : RscTop * pClass;
278 : : RSCHEADER header;
279 : : struct {
280 : : CLASS_DATA pData;
281 : : RscTop * pClass;
282 : : } instance;
283 : : sal_Int32 value;
284 : : sal_uInt16 ushort;
285 : : short exp_short;
286 : : char * string;
287 : : sal_Bool svbool;
288 : : REF_ENUM copyref;
289 : : RscDefine * defineele;
290 : : CharSet charset;
291 : : RscExpType macrostruct;
292 : : }
293 : :
294 : : /* Token */
295 : : %token <value> NUMBER
296 : : %token <string> SYMBOL
297 : : %token <defineele> RSCDEFINE
298 : : %token <string> STRING
299 : : %token <string> INCLUDE_STRING
300 : : %token <character> CHARACTER
301 : : %token <svbool> BOOLEAN
302 : :
303 : : %token LINE
304 : : %token AUTO_ID
305 : : %token NOT
306 : : %token XSCALE
307 : : %token YSCALE
308 : : %token RGB
309 : : %token GEOMETRY
310 : : %token POSITION
311 : : %token DIMENSION
312 : : %token INZOOMOUTPUTSIZE
313 : : %token FLOATINGPOS
314 : : %token DEFINE
315 : : %token INCLUDE
316 : : %token MACROTARGET
317 : : %token DEFAULT
318 : :
319 : :
320 : : %token <pClass> CLASSNAME
321 : : %token <varid> VARNAME
322 : : %token <constname> CONSTNAME
323 : : %token CLASS
324 : : %token EXTENDABLE
325 : : %token WRITEIFSET
326 : :
327 : :
328 : : %type <macrostruct> macro_expression
329 : : %type <macrostruct> id_expression
330 : : %type <value> long_expression
331 : : %type <string> string_multiline
332 : :
333 : : %type <pClass> type
334 : : %type <pClass> type_base
335 : : %type <header> class_header_body
336 : : %type <header> class_header
337 : : %type <header> var_header_class
338 : : %type <copyref> copy_ref
339 : : %type <ushort> type_flags
340 : :
341 : :
342 : : %left '|'
343 : : %left '&'
344 : : %left LEFTSHIFT RIGHTSHIFT
345 : : %left '+' '-'
346 : : %left '*' '/'
347 : : %left UNARYMINUS
348 : : %left UNARYPLUS
349 : : %left ','
350 : : %left '(' ')'
351 : :
352 : :
353 : : /* Grammatik */
354 : :
355 : : %start resource_definitions
356 : :
357 : : %%
358 : :
359 : : /********************** D E F I N I T I O N S ****************************/
360 : : resource_definitions
361 : : :
362 : : | resource_definitions resource_definition
363 : : | MACROTARGET macro_expression
364 : : {
365 : : RscExpType aExpType;
366 : : sal_Int32 lValue;
367 : :
368 : 0 : aExpType.cType = RSCEXP_NOTHING;
369 [ # # ][ # # ]: 0 : pExp = new RscExpression( aExpType, '+', $2 );
370 [ # # ][ # # ]: 0 : if( !pExp->Evaluate( &lValue ) )
371 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
372 : : }
373 : 0 : ;
374 : :
375 : : resource_definition
376 : : : line_number
377 : : | '#' DEFINE SYMBOL macro_expression
378 : : {
379 : 0 : sal_Bool bError = sal_False;
380 : :
381 [ # # ]: 0 : if( $4.IsNumber() ){
382 [ # # ]: 0 : if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(),
383 : 0 : rtl::OString( $3 ),
384 [ # # ]: 0 : $4.GetLong(), ULONG_MAX ) )
385 : 0 : bError = sal_True;
386 : : }
387 [ # # ]: 0 : else if( $4.IsDefinition() ){
388 : : RscExpType aExpType;
389 : : RscExpression * pExpr;
390 : :
391 : 0 : aExpType.cType = RSCEXP_NOTHING;
392 : 0 : aExpType.SetLong( 0 );
393 : 0 : aExpType.cType = RSCEXP_LONG;
394 [ # # ][ # # ]: 0 : pExpr = new RscExpression( aExpType, '+', $4 );
395 : :
396 [ # # ]: 0 : if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(),
397 [ # # ]: 0 : rtl::OString( $3 ), pExpr, ULONG_MAX ) )
398 : 0 : bError = sal_True;
399 : : }
400 [ # # ]: 0 : else if( $4.IsExpression() ){
401 [ # # ]: 0 : if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(),
402 : 0 : rtl::OString( $3 ), $4.aExp.pExp,
403 [ # # ]: 0 : ULONG_MAX ) )
404 : 0 : bError = sal_True;
405 : : }
406 : :
407 [ # # ]: 0 : if( bError ){
408 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_DECLAREDEFINE, NULL, RscId(), $3 );
409 : : }
410 : : }
411 : 0 : | '#' DEFINE RSCDEFINE macro_expression
412 : : {
413 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_DOUBLEDEFINE, NULL, RscId(), $3->GetName().getStr() );
414 : : }
415 : 0 : | '#' INCLUDE STRING
416 : : {
417 : : }
418 : 0 : | '#' INCLUDE INCLUDE_STRING
419 : : {
420 : : }
421 : 0 : | class_definition ';'
422 : : {
423 : : #ifdef D40
424 : : void * pMem;
425 : : pMem = rtl_allocateMemory( 20000 );
426 : : rtl_freeMemory( pMem );
427 : : #endif
428 : : }
429 : 36744 : | new_class_definition_header '{' new_class_definition_body '}' ';'
430 : : | new_class_definition_header ';'
431 : : ;
432 : :
433 : : new_class_definition_header
434 : : : CLASS SYMBOL id_expression ':' CLASSNAME
435 : : {
436 : : sal_Int32 lType;
437 : :
438 [ # # ]: 0 : $3.Evaluate( &lType );
439 : :
440 : : // Klasse anlegen
441 [ # # ]: 0 : Atom nId = pHS->getID( $2 );
442 [ # # ][ # # ]: 0 : pCurClass = new RscClass( nId, lType, $5 );
443 : 0 : nCurMask = 1;
444 [ # # ]: 0 : pTC->aNmTb.Put( nId, CLASSNAME, pCurClass );
445 [ # # ]: 0 : pTC->GetRoot()->Insert( pCurClass );
446 : : }
447 : 0 : | CLASS CLASSNAME id_expression ':' CLASSNAME
448 : : {
449 : 0 : pCurClass = $2;
450 : 0 : nCurMask = 1;
451 : : }
452 : 0 : ;
453 : :
454 : : new_class_definition_body
455 : : :
456 : : | property_definition ';' new_class_definition_body
457 : : ;
458 : :
459 : : property_definition
460 : : : type_flags type SYMBOL
461 : : {
462 : : // Variable anlegen
463 [ # # ]: 0 : Atom nId = pTC->aNmTb.Put( $3, VARNAME );
464 [ # # ]: 0 : pCurClass->SetVariable( nId, $2, NULL, $1, nCurMask );
465 : 0 : nCurMask <<= 1;
466 : : }
467 : 0 : | type_flags type VARNAME
468 : : {
469 [ # # ]: 0 : pCurClass->SetVariable( $3, $2, NULL, $1, nCurMask );
470 : 0 : nCurMask <<= 1;
471 : : }
472 : 0 : ;
473 : :
474 : : type_flags
475 : : : type_flags EXTENDABLE
476 : : {
477 : 0 : $$ = $1 | VAR_EXTENDABLE;
478 : : }
479 : 0 : | type_flags WRITEIFSET
480 : : {
481 : 0 : $$ = $1 | VAR_SVDYNAMIC;
482 : : }
483 : 0 : |
484 : : {
485 : 0 : $$ = 0;
486 : : }
487 : 0 : ;
488 : :
489 : : type
490 : : : type_base
491 : : {
492 : 0 : $$ = $1;
493 : : }
494 : 0 : | type_base '[' ']'
495 : : {
496 [ # # ]: 0 : if( $1 )
497 : : {
498 [ # # ][ # # ]: 0 : rtl::OString aTypeName = rtl::OStringBuffer(pHS->getString($1->GetId())).
499 [ # # ][ # # ]: 0 : append("[]").makeStringAndClear();
500 [ # # ][ # # ]: 0 : $$ = pTC->SearchType( pHS->getID( aTypeName.getStr(), true ) );
501 [ # # ]: 0 : if( !$$ )
502 : : {
503 : : RscCont * pCont;
504 [ # # ][ # # ]: 0 : pCont = new RscCont( pHS->getID( aTypeName.getStr() ), RSC_NOTYPE );
[ # # ]
505 : 0 : pCont->SetTypeClass( $1 );
506 [ # # ]: 0 : pTC->InsertType( pCont );
507 : 0 : $$ = pCont;
508 : 0 : }
509 : : }
510 : : else
511 : 0 : $$ = NULL;
512 : : }
513 : 0 : ;
514 : :
515 : : type_base
516 : : : CLASSNAME
517 : : {
518 : 0 : $$ = $1;
519 : : }
520 : 0 : | SYMBOL
521 : : {
522 [ # # ][ # # ]: 0 : RscTop * pType = pTC->SearchType( pHS->getID( $1, true ) );
523 [ # # ]: 0 : if( !pType )
524 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_NOTYPE, pCurClass, RscId() );
525 : 0 : $$ = pType;
526 : : }
527 : 0 : ;
528 : :
529 : : class_definition
530 : : : class_header class_body
531 : : {
532 [ - + ]: 118156 : if( TYPE_REF == $1.nTyp )
533 : 0 : pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass,
534 [ # # # # ]: 0 : RscId( $1.nName1 ) );
[ # # ]
535 : 118156 : S.Pop();
536 : : }
537 : 118156 : | class_header
538 : : {
539 : 4 : ERRTYPE aError;
540 [ + - ]: 4 : RscId aRscId( $1.nName1 );
541 : :
542 [ + + ][ + - ]: 4 : if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() )
[ + + ]
543 [ + - ][ + - ]: 2 : aError = S.Top().pClass->SetRef( S.Top(), aRscId );
544 [ - + ]: 2 : else if( TYPE_COPY == $1.nTyp )
545 [ # # ]: 0 : aError = ERR_COPYNOTALLOWED;
546 [ + - ][ - + ]: 4 : if( aError.IsError() || aError.IsWarning() )
[ - + ]
547 [ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, aRscId );
548 [ + - ]: 4 : S.Pop();
549 : : }
550 : 4 : ;
551 : :
552 : : class_header
553 : : : class_header_body
554 : : {
555 [ + - ][ - + ]: 118160 : if( !DoClassHeader( &$1, sal_False ) )
556 : 0 : return( ERR_ERROR );
557 : 118160 : $$ = $1;
558 : : }
559 : 118160 : ;
560 : :
561 : : copy_ref
562 : : : '<'
563 : : {
564 : 18 : $$ = TYPE_COPY;
565 : : }
566 : 18 : | ','
567 : : {
568 : 18 : $$ = TYPE_REF;
569 : : }
570 : 18 : ;
571 : :
572 : : class_header_body
573 : : : CLASSNAME id_expression copy_ref CLASSNAME id_expression
574 : : {
575 : 0 : $$.pClass = $1;
576 : 0 : $$.nName1 = $2;
577 : 0 : $$.nTyp = $3;
578 : 0 : $$.pRefClass = $4;
579 : 0 : $$.nName2 = $5;
580 : : }
581 : 0 : | CLASSNAME id_expression copy_ref id_expression
582 : : {
583 : 20 : $$.pClass = $1;
584 : 20 : $$.nName1 = $2;
585 : 20 : $$.nTyp = $3;
586 : 20 : $$.pRefClass = NULL;
587 : 20 : $$.nName2 = $4;
588 : : }
589 : 20 : | CLASSNAME id_expression
590 : : {
591 : 100404 : $$.pClass = $1;
592 : 100404 : $$.nName1 = $2;
593 : 100404 : $$.nTyp = TYPE_NOTHING;
594 : 100404 : $$.pRefClass = NULL;
595 : 100404 : $$.nName2.cType = RSCEXP_NOTHING;
596 : : }
597 : 100404 : | CLASSNAME copy_ref id_expression
598 : : {
599 : 16 : $$.pClass = $1;
600 : 16 : $$.nName1.cType = RSCEXP_NOTHING;
601 : 16 : $$.nTyp = $2;
602 : 16 : $$.pRefClass = NULL;
603 : 16 : $$.nName2 = $3;
604 : : }
605 : 16 : | CLASSNAME copy_ref CLASSNAME id_expression
606 : : {
607 : 0 : $$.pClass = $1;
608 : 0 : $$.nName1.cType = RSCEXP_NOTHING;
609 : 0 : $$.nTyp = $2;
610 : 0 : $$.pRefClass = $3;
611 : 0 : $$.nName2 = $4;
612 : : }
613 : 0 : | CLASSNAME
614 : : {
615 : 23530 : $$.pClass = $1;
616 : 23530 : $$.nName1.cType = RSCEXP_NOTHING;
617 : 23530 : $$.nTyp = TYPE_NOTHING;
618 : 23530 : $$.nName2.cType = RSCEXP_NOTHING;
619 : : }
620 : 23530 : ;
621 : :
622 : : class_body
623 : : : '{' var_definitions '}'
624 : : | '{' '}'
625 : : | string_multiline
626 : : {
627 [ + - ]: 2 : SetString( S.Top(), "TEXT", $1 );
628 : : }
629 : 2 : ;
630 : :
631 : : var_definitions
632 : : : var_definition
633 : : | var_definitions var_definition
634 : : ;
635 : :
636 : : xy_mapmode
637 : : : CONSTNAME
638 : : {
639 [ + - ]: 37476 : SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue );
640 : : }
641 : 37476 : |
642 : : ;
643 : :
644 : : wh_mapmode
645 : : : CONSTNAME
646 : : {
647 [ + - ]: 40564 : SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue );
648 : : }
649 : 40564 : |
650 : : ;
651 : :
652 : : xywh_mapmode
653 : : : CONSTNAME
654 : : {
655 [ + - ]: 12 : SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue );
656 [ + - ]: 12 : SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue );
657 : : }
658 : 12 : |
659 : : ;
660 : :
661 : : var_definition
662 : : : line_number
663 : : | var_header var_body ';'
664 : : {
665 : 266040 : S.Pop();
666 : : }
667 : 266040 : | class_definition ';'
668 : : | var_header_class class_body ';'
669 : : {
670 [ - + ]: 5794 : if( TYPE_REF == $1.nTyp )
671 : 0 : pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass,
672 [ # # # # ]: 0 : RscId( $1.nName1 ) );
[ # # ]
673 : :
674 [ + - ][ - + ]: 5794 : if( S.Top().pClass->GetCount( S.Top() ) )
675 : 0 : pTC->pEH->Error( WRN_SUBINMEMBER, S.Top().pClass,
676 [ # # # # ]: 0 : RscId( $1.nName1 ) );
[ # # ]
677 : :
678 : 5794 : S.Pop();
679 : : }
680 : 5794 : | var_header_class ';'
681 : : {
682 : 16 : ERRTYPE aError;
683 [ + - ]: 16 : RscId aRscId( $1.nName1 );
684 : :
685 [ - + ][ # # ]: 16 : if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() )
[ - + ]
686 [ # # ][ # # ]: 0 : aError = S.Top().pClass->SetRef( S.Top(), aRscId );
687 [ - + ]: 16 : else if( TYPE_COPY == $1.nTyp )
688 [ # # ]: 0 : aError = ERR_COPYNOTALLOWED;
689 [ + - ][ - + ]: 16 : if( S.Top().pClass->GetCount( S.Top() ) )
690 [ # # ]: 0 : aError = WRN_SUBINMEMBER;
691 [ + - ][ - + ]: 16 : if( aError.IsError() || aError.IsWarning() )
[ - + ]
692 [ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, aRscId );
693 : :
694 [ + - ]: 16 : S.Pop();
695 : : }
696 : 16 : | XSCALE '=' '(' long_expression ',' long_expression ')' ';'
697 : : {
698 [ # # ]: 0 : SetNumber( S.Top(), "_XNUMERATOR", $4 );
699 [ # # ]: 0 : SetNumber( S.Top(), "_XDENOMINATOR", $6 );
700 : : }
701 : 0 : | YSCALE '=' '(' long_expression ',' long_expression ')' ';'
702 : : {
703 [ # # ]: 0 : SetNumber( S.Top(), "_YNUMERATOR", $4 );
704 [ # # ]: 0 : SetNumber( S.Top(), "_YDENOMINATOR", $6 );
705 : : }
706 : 0 : | RGB '=' '(' long_expression ',' long_expression
707 : : ',' long_expression ')' ';'
708 : : {
709 [ # # ]: 0 : SetNumber( S.Top(), "RED", $4 );
710 [ # # ]: 0 : SetNumber( S.Top(), "GREEN", $6 );
711 [ # # ]: 0 : SetNumber( S.Top(), "BLUE", $8 );
712 : : }
713 : 0 : | GEOMETRY '=' xywh_mapmode '(' long_expression ',' long_expression ','
714 : : long_expression ',' long_expression ')' ';'
715 : : {
716 [ + - ]: 12 : SetNumber( S.Top(), "_X", $5 );
717 [ + - ]: 12 : SetNumber( S.Top(), "_Y", $7 );
718 [ + - ]: 12 : SetNumber( S.Top(), "_WIDTH", $9 );
719 [ + - ]: 12 : SetNumber( S.Top(), "_HEIGHT", $11 );
720 : : }
721 : 12 : | POSITION '=' xy_mapmode '(' long_expression ',' long_expression
722 : : ')' ';'
723 : : {
724 [ + - ]: 37476 : SetNumber( S.Top(), "_X", $5 );
725 [ + - ]: 37476 : SetNumber( S.Top(), "_Y", $7 );
726 : : }
727 : 37476 : | DIMENSION '=' wh_mapmode '(' long_expression ',' long_expression
728 : : ')' ';'
729 : : {
730 [ + - ]: 40572 : SetNumber( S.Top(), "_WIDTH", $5 );
731 [ + - ]: 40572 : SetNumber( S.Top(), "_HEIGHT", $7 );
732 : : }
733 : 40572 : | INZOOMOUTPUTSIZE '=' CONSTNAME '(' long_expression ',' long_expression
734 : : ')' ';'
735 : : {
736 [ # # ]: 0 : SetConst( S.Top(), "_ZOOMINMAPMODE", $3.hashid, $3.nValue );
737 [ # # ]: 0 : SetNumber( S.Top(), "_ZOOMINWIDTH", $5 );
738 [ # # ]: 0 : SetNumber( S.Top(), "_ZOOMINHEIGHT", $7 );
739 : : }
740 : 0 : | INZOOMOUTPUTSIZE '=' '(' long_expression ',' long_expression ')' ';'
741 : : {
742 [ # # ]: 0 : SetNumber( S.Top(), "_ZOOMINWIDTH", $4 );
743 [ # # ]: 0 : SetNumber( S.Top(), "_ZOOMINHEIGHT", $6 );
744 : : }
745 : 0 : | FLOATINGPOS '=' CONSTNAME '(' long_expression ',' long_expression
746 : : ')' ';'
747 : : {
748 [ # # ]: 0 : SetConst( S.Top(), "_FLOATINGPOSMAPMODE", $3.hashid, $3.nValue );
749 [ # # ]: 0 : SetNumber( S.Top(), "_FLOATINGPOSX", $5 );
750 [ # # ]: 0 : SetNumber( S.Top(), "_FLOATINGPOSY", $7 );
751 : : }
752 : 0 : | FLOATINGPOS '=' '(' long_expression ',' long_expression ')' ';'
753 : : {
754 [ # # ]: 0 : SetNumber( S.Top(), "_FLOATINGPOSX", $4 );
755 [ # # ]: 0 : SetNumber( S.Top(), "_FLOATINGPOSY", $6 );
756 : : }
757 : 0 : ;
758 : :
759 : : var_header_class
760 : : : VARNAME '=' class_header_body
761 : : {
762 : 5810 : RSCINST aInst;
763 : :
764 [ + - ]: 5810 : aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST(), sal_False, $3.pClass );
765 : :
766 [ + - ]: 5810 : if( aInst.pData )
767 [ + - ]: 5810 : S.Push( aInst );
768 : : else
769 : : {
770 : 0 : pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
771 [ # # ][ # # ]: 0 : pHS->getString( $1 ).getStr() );
[ # # ]
772 : 0 : return( ERR_ERROR );
773 : : };
774 : :
775 [ + - ][ - + ]: 5810 : if( !DoClassHeader( &$3, sal_True ) )
776 : 0 : return( ERR_ERROR );
777 : 5810 : $$ = $3;
778 : : }
779 : 5810 : | VARNAME '[' CONSTNAME ']' '=' class_header_body
780 : : {
781 : 0 : RSCINST aInst;
782 : :
783 [ # # ]: 0 : aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
784 : :
785 [ # # ]: 0 : if( aInst.pData )
786 : : {
787 : 0 : ERRTYPE aError;
788 : 0 : RSCINST aIdxInst;
789 : :
790 [ # # ][ # # ]: 0 : aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst );
791 [ # # ][ # # ]: 0 : if( aError.IsError() || aError.IsWarning() )
[ # # ]
792 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
793 [ # # ]: 0 : if( aError.IsError() )
794 : 0 : return( ERR_ERROR );
795 [ # # ]: 0 : S.Push( aIdxInst );
796 : : }
797 : : else
798 : : {
799 : 0 : pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
800 [ # # ][ # # ]: 0 : pHS->getString( $1 ).getStr() );
[ # # ]
801 : 0 : return( ERR_ERROR );
802 : : };
803 [ # # ][ # # ]: 0 : if( !DoClassHeader( &$6, sal_True ) )
804 : 0 : return( ERR_ERROR );
805 : 0 : $$ = $6;
806 : : }
807 : 0 : | VARNAME '[' SYMBOL ']' '=' class_header_body
808 : : {
809 : 0 : RSCINST aInst;
810 : :
811 [ # # ]: 0 : aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
812 : :
813 [ # # ]: 0 : if( aInst.pData )
814 : : {
815 [ # # ]: 0 : long nNewLang = pTC->AddLanguage( $3 );
816 : 0 : ERRTYPE aError;
817 : 0 : RSCINST aIdxInst;
818 : :
819 [ # # ][ # # ]: 0 : aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst );
820 [ # # ][ # # ]: 0 : if( aError.IsError() || aError.IsWarning() )
[ # # ]
821 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
822 [ # # ]: 0 : if( aError.IsError() )
823 : 0 : return( ERR_ERROR );
824 [ # # ]: 0 : S.Push( aIdxInst );
825 : : }
826 : : else
827 : : {
828 : 0 : pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
829 [ # # ][ # # ]: 0 : pHS->getString( $1 ).getStr() );
[ # # ]
830 : 0 : return( ERR_ERROR );
831 : : };
832 [ # # ][ # # ]: 0 : if( !DoClassHeader( &$6, sal_True ) )
833 : 0 : return( ERR_ERROR );
834 : 0 : $$ = $6;
835 : : }
836 : 0 : ;
837 : :
838 : : var_header
839 : : : VARNAME '='
840 : : {
841 : 179916 : RSCINST aInst;
842 : :
843 [ + - ]: 179916 : aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
844 : :
845 [ + - ]: 179916 : if( aInst.pData )
846 [ + - ]: 179916 : S.Push( aInst );
847 : : else{
848 : 0 : pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
849 [ # # ][ # # ]: 0 : pHS->getString( $1 ).getStr() );
[ # # ]
850 : 0 : return( ERR_ERROR );
851 : : };
852 : : }
853 : 179916 : | VARNAME '[' CONSTNAME ']' '='
854 : : {
855 : 86124 : RSCINST aInst;
856 : :
857 [ + - ]: 86124 : aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
858 : :
859 [ + - ]: 86124 : if( aInst.pData )
860 : : {
861 : 86124 : ERRTYPE aError;
862 : 86124 : RSCINST aIdxInst;
863 : :
864 [ + - ][ + - ]: 86124 : aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst );
865 [ + - ][ - + ]: 86124 : if( aError.IsError() || aError.IsWarning() )
[ - + ]
866 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
867 [ - + ]: 86124 : if( aError.IsError() )
868 : 0 : return( ERR_ERROR );
869 [ + - ]: 86124 : S.Push( aIdxInst );
870 : : }
871 : : else{
872 : 0 : pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
873 [ # # ][ # # ]: 0 : pHS->getString( $1 ).getStr() );
[ # # ]
874 : 0 : return( ERR_ERROR );
875 : : };
876 : : }
877 : 86124 : | VARNAME '[' SYMBOL ']' '='
878 : : {
879 : 0 : RSCINST aInst;
880 : :
881 [ # # ]: 0 : aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() );
882 : :
883 [ # # ]: 0 : if( aInst.pData )
884 : : {
885 [ # # ]: 0 : long nNewLang = pTC->AddLanguage( $3 );
886 : 0 : ERRTYPE aError;
887 : 0 : RSCINST aIdxInst;
888 : :
889 [ # # ][ # # ]: 0 : aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst );
890 [ # # ][ # # ]: 0 : if( aError.IsError() || aError.IsWarning() )
[ # # ]
891 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
892 [ # # ]: 0 : if( aError.IsError() )
893 : 0 : return( ERR_ERROR );
894 [ # # ]: 0 : S.Push( aIdxInst );
895 : : }
896 : : else{
897 : 0 : pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(),
898 [ # # ][ # # ]: 0 : pHS->getString( $1 ).getStr() );
[ # # ]
899 : 0 : return( ERR_ERROR );
900 : : };
901 : : }
902 : 0 : ;
903 : : tupel_header0
904 : : :
905 : : {
906 : 10886 : RSCINST aInst;
907 : :
908 [ + - ]: 10886 : aInst = S.Top().pClass->GetTupelVar( S.Top(), 0, RSCINST() );
909 [ + - ]: 10886 : if( aInst.pData )
910 [ + - ]: 10886 : S.Push( aInst );
911 : : else
912 : : {
913 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() );
914 : 0 : return( ERR_ERROR );
915 : : };
916 : : }
917 : 10886 : ;
918 : :
919 : : tupel_header1
920 : : :
921 : : {
922 : 9070 : RSCINST aInst;
923 : :
924 [ + - ]: 9070 : aInst = S.Top().pClass->GetTupelVar( S.Top(), 1, RSCINST() );
925 [ + - ]: 9070 : if( aInst.pData )
926 [ + - ]: 9070 : S.Push( aInst );
927 : : else
928 : : {
929 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() );
930 : 0 : return( ERR_ERROR );
931 : : };
932 : : }
933 : 9070 : ;
934 : :
935 : : tupel_header2
936 : : :
937 : : {
938 : 26 : RSCINST aInst;
939 : :
940 [ + - ]: 26 : aInst = S.Top().pClass->GetTupelVar( S.Top(), 2, RSCINST() );
941 [ + - ]: 26 : if( aInst.pData )
942 [ + - ]: 26 : S.Push( aInst );
943 : : else
944 : : {
945 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() );
946 : 0 : return( ERR_ERROR );
947 : : };
948 : : }
949 : 26 : ;
950 : :
951 : : tupel_header3
952 : : :
953 : : {
954 : 26 : RSCINST aInst;
955 : :
956 [ + - ]: 26 : aInst = S.Top().pClass->GetTupelVar( S.Top(), 3, RSCINST() );
957 [ - + ]: 26 : if( !aInst.pData )
958 : : {
959 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() );
960 : 0 : return( ERR_ERROR );
961 : : };
962 [ + - ]: 26 : S.Push( aInst );
963 : : }
964 : 26 : ;
965 : :
966 : : tupel_body
967 : : : var_body
968 : : {
969 : 20008 : S.Pop();
970 : : }
971 : 20008 : ;
972 : :
973 : : var_list_header
974 : : :
975 : : {
976 : 10860 : ERRTYPE aError;
977 : 10860 : RSCINST aInst;
978 : :
979 : 21720 : aError = S.Top().pClass->GetElement( S.Top(), RscId(),
980 [ + - ][ + - ]: 21720 : NULL, RSCINST(), &aInst );
[ + - ]
981 [ + - ][ - + ]: 10860 : if( aError.IsError() || aError.IsWarning() )
[ - + ]
982 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
983 [ - + ]: 10860 : if( aError.IsError() )
984 : : { // unbedingt Instanz auf den Stack bringen
985 [ # # ]: 0 : aInst = S.Top().pClass->Create( NULL, RSCINST() );
986 : : }
987 [ + - ]: 10860 : S.Push( aInst );
988 : : }
989 : 10860 : ;
990 : :
991 : : list_body
992 : : : var_bodycomplex
993 : : {
994 : 10860 : S.Pop();
995 : : }
996 : 10860 : ;
997 : :
998 : : list_header
999 : : :
1000 : : {
1001 [ + - ]: 5930 : sal_uInt32 nCount = S.Top().pClass->GetCount( S.Top() );
1002 : : sal_uInt32 i;
1003 : :
1004 [ + + ]: 5998 : for( i = nCount; i > 0; i-- )
1005 [ + - ]: 68 : S.Top().pClass->DeletePos( S.Top(), i -1 );
1006 : : }
1007 : 5930 : ;
1008 : :
1009 : : list
1010 : : : list var_list_header list_body ';'
1011 : : | list var_bodysimple ';'
1012 : : | list class_definition ';'
1013 : : | list line_number
1014 : : |
1015 : : ;
1016 : :
1017 : : var_bodysimple
1018 : : : macro_expression
1019 : : {
1020 : : sal_Int32 l;
1021 : 42456 : ERRTYPE aError;
1022 : :
1023 [ - + ][ + - ]: 42456 : if( !$1.Evaluate( &l ) )
1024 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
1025 : : else
1026 : : {
1027 [ + - ][ + - ]: 42456 : aError = S.Top().pClass->SetRef( S.Top(), RscId( $1 ) );
[ + - ][ + - ]
1028 [ + + ]: 42456 : if( aError.IsError() )
1029 : : {
1030 : 18552 : aError.Clear();
1031 [ + - ][ + - ]: 18552 : aError = S.Top().pClass->SetNumber( S.Top(), l );
1032 : : }
1033 [ - + ]: 42456 : if( aError.IsError() )
1034 : : { // Aufwaertskompatible, Tupel probieren
1035 [ # # ]: 0 : RSCINST aInst = GetFirstTupelEle( S.Top() );
1036 [ # # ]: 0 : if( aInst.pData )
1037 : : {
1038 : 0 : aError.Clear(); // Fehler zuruecksetzen
1039 [ # # ][ # # ]: 0 : aError = aInst.pClass->SetRef( aInst, RscId( $1 ) );
[ # # ][ # # ]
1040 [ # # ]: 0 : if( aError.IsError() )
1041 : : {
1042 : 0 : aError.Clear();
1043 [ # # ][ # # ]: 0 : aError = aInst.pClass->SetNumber( aInst, l );
1044 : : }
1045 : : }
1046 : : }
1047 : : }
1048 : :
1049 [ - + ]: 42456 : if( $1.IsExpression() )
1050 [ # # ][ # # ]: 0 : delete $1.aExp.pExp;
1051 : :
1052 [ + - ][ - + ]: 42456 : if( aError.IsError() || aError.IsWarning() )
[ - + ]
1053 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
1054 : : }
1055 : 42456 : | CONSTNAME
1056 : : {
1057 : 2864 : ERRTYPE aError;
1058 [ + - ][ + - ]: 2864 : aError = S.Top().pClass->SetConst( S.Top(), $1.hashid, $1.nValue );
1059 [ - + ]: 2864 : if( aError.IsError() )
1060 : : { // Aufwaertskompatible, Tupel probieren
1061 [ # # ]: 0 : RSCINST aInst = GetFirstTupelEle( S.Top() );
1062 [ # # ]: 0 : if( aInst.pData )
1063 : : {
1064 : 0 : aError.Clear(); // Fehler zuruecksetzen
1065 [ # # ][ # # ]: 0 : aError = aInst.pClass->SetConst( aInst, $1.hashid, $1.nValue );
1066 : : }
1067 : : }
1068 : :
1069 [ + - ][ - + ]: 2864 : if( aError.IsError() || aError.IsWarning() )
[ - + ]
1070 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
1071 : : }
1072 : 2864 : | NOT CONSTNAME
1073 : : {
1074 : 0 : ERRTYPE aError;
1075 [ # # ][ # # ]: 0 : aError = S.Top().pClass->SetNotConst( S.Top(), $2.hashid );
1076 [ # # ]: 0 : if( aError.IsError() )
1077 : : { // Aufwaertskompatible, Tupel probieren
1078 [ # # ]: 0 : RSCINST aInst = GetFirstTupelEle( S.Top() );
1079 [ # # ]: 0 : if( aInst.pData )
1080 : : {
1081 : 0 : aError.Clear(); // Fehler zuruecksetzen
1082 [ # # ][ # # ]: 0 : aError = aInst.pClass->SetNotConst( aInst, $2.hashid );
1083 : : }
1084 : : }
1085 : :
1086 [ # # ][ # # ]: 0 : if( aError.IsError() || aError.IsWarning() )
[ # # ]
1087 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
1088 : : }
1089 : 0 : | BOOLEAN
1090 : : {
1091 : 56816 : ERRTYPE aError;
1092 [ + - ][ + - ]: 56816 : aError = S.Top().pClass->SetBool( S.Top(), $1 );
1093 [ - + ]: 56816 : if( aError.IsError() )
1094 : : { // Aufwaertskompatible, Tupel probieren
1095 [ # # ]: 0 : RSCINST aInst = GetFirstTupelEle( S.Top() );
1096 [ # # ]: 0 : if( aInst.pData )
1097 : : {
1098 : 0 : aError.Clear(); // Fehler zuruecksetzen
1099 [ # # ][ # # ]: 0 : aError = aInst.pClass->SetBool( aInst, $1 );
1100 : : }
1101 : : }
1102 : :
1103 [ + - ][ - + ]: 56816 : if( aError.IsError() || aError.IsWarning() )
[ - + ]
1104 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
1105 : : }
1106 : 56816 : | string_multiline
1107 : : {
1108 : 184368 : ERRTYPE aError;
1109 [ + - ][ + - ]: 184368 : aError = S.Top().pClass->SetString( S.Top(), $1 );
1110 [ + + ]: 184368 : if( aError.IsError() )
1111 : : { // Aufwaertskompatible, Tupel probieren
1112 [ + - ]: 218 : RSCINST aInst = GetFirstTupelEle( S.Top() );
1113 [ + - ]: 218 : if( aInst.pData )
1114 : : {
1115 : 218 : aError.Clear(); // Fehler zuruecksetzen
1116 [ + - ][ + - ]: 218 : aError = aInst.pClass->SetString( aInst, $1 );
1117 : : }
1118 : : }
1119 : :
1120 [ + - ][ - + ]: 184368 : if( aError.IsError() || aError.IsWarning() )
[ - + ]
1121 [ # # ][ # # ]: 0 : pTC->pEH->Error( aError, S.Top().pClass, RscId() );
1122 : : }
1123 : 184368 : | DEFAULT
1124 : : ;
1125 : :
1126 : : var_bodycomplex
1127 : : : '{' list_header list '}'
1128 : : | '<' tupel_header0 tupel_body ';' '>'
1129 : : | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' '>'
1130 : : | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';'
1131 : : tupel_header2 tupel_body ';' '>'
1132 : : | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';'
1133 : : tupel_header2 tupel_body ';' tupel_header3 tupel_body ';' '>'
1134 : : ;
1135 : :
1136 : : var_body
1137 : : : var_bodysimple
1138 : : | var_bodycomplex
1139 : : ;
1140 : :
1141 : : /********************** work on yacc stack *******************************/
1142 : : string_multiline
1143 : : : STRING
1144 : : {
1145 : 184370 : $$ = $1;
1146 : : }
1147 : 184370 : | string_multiline STRING
1148 : : {
1149 : 2582 : rtl::OStringBuffer aBuf( 256 );
1150 [ + - ]: 2582 : aBuf.append( $1 );
1151 [ + - ]: 2582 : aBuf.append( $2 );
1152 [ + - ]: 2582 : $$ = (char*)pStringContainer->putString( aBuf.getStr() );
1153 : : }
1154 : 2582 : ;
1155 : :
1156 : : long_expression
1157 : : : macro_expression
1158 : : {
1159 [ + - ][ - + ]: 156144 : if( !$1.Evaluate( &$$ ) )
1160 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
1161 [ - + ]: 156144 : if( $1.IsExpression() )
1162 [ # # ][ # # ]: 0 : delete $1.aExp.pExp;
1163 : : }
1164 : 156144 : ;
1165 : :
1166 : : macro_expression
1167 : : : RSCDEFINE
1168 : : {
1169 : 0 : $$.cType = RSCEXP_DEF;
1170 : 0 : $$.aExp.pDef = $1;
1171 : : }
1172 : 0 : | NUMBER
1173 : : {
1174 : 399996 : $$.cType = RSCEXP_LONG;
1175 : 399996 : $$.SetLong( $1 );
1176 : : }
1177 : 399996 : | '-' macro_expression %prec UNARYMINUS
1178 : : {
1179 [ + - ]: 370 : if( $2.IsNumber() ){
1180 : 370 : $$.cType = $2.cType;
1181 : 370 : $$.SetLong( - $2.GetLong() );
1182 : : }
1183 : : else{
1184 : : RscExpType aLeftExp;
1185 : :
1186 : 0 : aLeftExp.cType = RSCEXP_NOTHING;
1187 : 0 : $$.cType = RSCEXP_EXP;
1188 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( aLeftExp, '-', $2 );
1189 : : }
1190 : : }
1191 : 370 : | '+' macro_expression %prec UNARYPLUS
1192 : : {
1193 : 2 : $$ = $2;
1194 : : }
1195 : 2 : | macro_expression '+' macro_expression
1196 : : {
1197 [ + - ][ + - ]: 86296 : if( $1.IsNumber() && $3.IsNumber() ){
[ + - ]
1198 : 86296 : $$.cType = RSCEXP_LONG;
1199 : 86296 : $$.SetLong( $1.GetLong() + $3.GetLong() );
1200 : : }
1201 : : else{
1202 : 0 : $$.cType = RSCEXP_EXP;
1203 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( $1, '+', $3 );
1204 : : }
1205 : : }
1206 : 86296 : | macro_expression '-' macro_expression
1207 : : {
1208 [ + - ][ + - ]: 6774 : if( $1.IsNumber() && $3.IsNumber() ){
[ + - ]
1209 : 6774 : $$.cType = RSCEXP_LONG;
1210 : 6774 : $$.SetLong( $1.GetLong() - $3.GetLong() );
1211 : : }
1212 : : else{
1213 : 0 : $$.cType = RSCEXP_EXP;
1214 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( $1, '-', $3 );
1215 : : }
1216 : : }
1217 : 6774 : | macro_expression '*' macro_expression
1218 : : {
1219 [ + - ][ + - ]: 3574 : if( $1.IsNumber() && $3.IsNumber() ){
[ + - ]
1220 : 3574 : $$.cType = RSCEXP_LONG;
1221 : 3574 : $$.SetLong( $1.GetLong() * $3.GetLong() );
1222 : : }
1223 : : else{
1224 : 0 : $$.cType = RSCEXP_EXP;
1225 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( $1, '*', $3 );
1226 : : }
1227 : : }
1228 : 3574 : | macro_expression '/' macro_expression
1229 : : {
1230 [ + - ][ + - ]: 522 : if( $1.IsNumber() && $3.IsNumber() ){
[ + - ]
1231 [ - + ]: 522 : if( 0 == $3.GetLong() ){
1232 : 0 : $$.cType = RSCEXP_EXP;
1233 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( $1, '/', $3 );
1234 : : }
1235 : : else{
1236 : 522 : $$.cType = RSCEXP_LONG;
1237 : 522 : $$.SetLong( $1.GetLong() / $3.GetLong() );
1238 : : }
1239 : : }
1240 : : else{
1241 : 0 : $$.cType = RSCEXP_EXP;
1242 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( $1, '/', $3 );
1243 : : }
1244 : : }
1245 : 522 : | macro_expression '&' macro_expression
1246 : : {
1247 [ + - ][ + - ]: 586 : if( $1.IsNumber() && $3.IsNumber() ){
[ + - ]
1248 : 586 : $$.cType = RSCEXP_LONG;
1249 : 586 : $$.SetLong( $1.GetLong() & $3.GetLong() );
1250 : : }
1251 : : else{
1252 : 0 : $$.cType = RSCEXP_EXP;
1253 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( $1, '&', $3 );
1254 : : }
1255 : : }
1256 : 586 : | macro_expression '|' macro_expression
1257 : : {
1258 [ + - ][ + - ]: 1532 : if( $1.IsNumber() && $3.IsNumber() ){
[ + - ]
1259 : 1532 : $$.cType = RSCEXP_LONG;
1260 : 1532 : $$.SetLong( $1.GetLong() | $3.GetLong() );
1261 : : }
1262 : : else{
1263 : 0 : $$.cType = RSCEXP_EXP;
1264 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( $1, '|', $3 );
1265 : : }
1266 : : }
1267 : 1532 : | '(' macro_expression ')'
1268 : : {
1269 : 96134 : $$ = $2;
1270 : : }
1271 : 96134 : | macro_expression LEFTSHIFT macro_expression
1272 : : {
1273 [ + - ][ + - ]: 1652 : if( $1.IsNumber() && $3.IsNumber() ){
[ + - ]
1274 : 1652 : $$.cType = RSCEXP_LONG;
1275 : 1652 : $$.SetLong( $1.GetLong() << $3.GetLong() );
1276 : : }
1277 : : else{
1278 : 0 : $$.cType = RSCEXP_EXP;
1279 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( $1, 'l', $3 );
1280 : : }
1281 : : }
1282 : 1652 : | macro_expression RIGHTSHIFT macro_expression
1283 : : {
1284 [ # # ][ # # ]: 0 : if( $1.IsNumber() && $3.IsNumber() ){
[ # # ]
1285 : 0 : $$.cType = RSCEXP_LONG;
1286 : 0 : $$.SetLong( $1.GetLong() >> $3.GetLong() );
1287 : : }
1288 : : else{
1289 : 0 : $$.cType = RSCEXP_EXP;
1290 [ # # ][ # # ]: 0 : $$.aExp.pExp = new RscExpression( $1, 'r', $3 );
1291 : : }
1292 : : }
1293 : 0 : ;
1294 : :
1295 : : id_expression
1296 : : : id_expression line_number
1297 : : | macro_expression
1298 : : { // pExpession auswerten und loeschen
1299 [ - + ]: 100460 : if( RSCEXP_EXP == $1.cType ){
1300 : : sal_Int32 lValue;
1301 : :
1302 [ # # ][ # # ]: 0 : if( !$1.Evaluate( &lValue ) )
1303 [ # # ][ # # ]: 0 : pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
1304 [ # # ][ # # ]: 0 : delete $1.aExp.pExp;
1305 : 0 : $$.cType = RSCEXP_LONG;
1306 : 0 : $$.SetLong( lValue );
1307 : : }
1308 : : else
1309 : 100460 : $$ = $1;
1310 : : }
1311 : 100460 : ;
1312 : :
1313 : : DUMMY_NUMBER
1314 : : : NUMBER
1315 : : {
1316 : : }
1317 : 0 : |
1318 : : {
1319 : : }
1320 : 1324 : ;
1321 : :
1322 : : line_number
1323 : : : '#' LINE NUMBER STRING
1324 : : {
1325 : : RscFile * pFName;
1326 : :
1327 : 0 : pFI->SetLineNo( $3 );
1328 [ # # ]: 0 : pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( rtl::OString( $4 ) ) );
1329 [ # # ]: 0 : pFName = pTC->aFileTab.Get( pFI->GetFileIndex() );
1330 : 0 : pFName->bLoaded = sal_True;
1331 : 0 : pFName->bScanned = sal_True;
1332 : : }
1333 : 0 : | '#' NUMBER STRING DUMMY_NUMBER
1334 : : {
1335 : : RscFile * pFName;
1336 : :
1337 : 1324 : pFI->SetLineNo( $2 );
1338 [ + - ]: 1324 : pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( rtl::OString( $3 ) ) );
1339 [ + - ]: 1324 : pFName = pTC->aFileTab.Get( pFI->GetFileIndex() );
1340 : 1324 : pFName->bLoaded = sal_True;
1341 : 1324 : pFName->bScanned = sal_True;
1342 : : }
1343 : 1324 : | '#' NUMBER
1344 : : {
1345 : 4486 : pFI->SetLineNo( $2 );
1346 : : }
1347 : 4486 : ;
1348 : :
1349 : : %%
1350 : : #if defined _MSC_VER
1351 : : #pragma warning(pop)
1352 : : #endif
1353 : :
1354 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1355 : :
1356 : :
|