2 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
4 * This file is part of the LibreOffice project.
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/.
10 * This file incorporates work covered by the following license notice:
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 .
21 #include "sal/config.h"
27 #include <rtl/strbuf.hxx>
30 #include <rsctools.hxx>
31 #include <rscclass.hxx>
32 #include <rsccont.hxx>
33 #include <rsctree.hxx>
45 RSCINST GetVarInst
( const RSCINST
& rInst
, const char * pVarName
)
49 aInst
= rInst.pClass
->GetVariable
( rInst
, pHS
->getID
( pVarName
),
53 pTC
->pEH
->Error
( ERR_NOVARIABLENAME
, rInst.pClass
, RscId
() );
58 void SetNumber
( const RSCINST
& rInst
, const char * pVarName
, sal_Int32 lValue
)
62 aInst
= GetVarInst
( rInst
, pVarName
);
66 aError
= aInst.pClass
->SetNumber
( aInst
, lValue
);
68 if
( aError.IsError
() )
69 pTC
->pEH
->Error
( aError
, aInst.pClass
, RscId
() );
73 void SetConst
( const RSCINST
& rInst
, const char * pVarName
,
74 Atom nValueId
, sal_Int32 nVal
)
78 aInst
= GetVarInst
( rInst
, pVarName
);
82 aError
= aInst.pClass
->SetConst
( aInst
, nValueId
, nVal
);
84 if
( aError.IsError
() )
85 pTC
->pEH
->Error
( aError
, aInst.pClass
, RscId
() );
89 void SetString
( const RSCINST
& rInst
, const char * pVarName
, const char * pStr
)
93 aInst
= GetVarInst
( rInst
, pVarName
);
96 aError
= aInst.pClass
->SetString
( aInst
, pStr
);
98 if
( aError.IsError
() )
99 pTC
->pEH
->Error
( aError
, aInst.pClass
, RscId
() );
103 RscId MakeRscId
( RscExpType aExpType
)
105 if
( !aExpType.IsNothing
() )
109 if
( !aExpType.Evaluate
( &lValue
) )
110 pTC
->pEH
->Error
( ERR_ZERODIVISION
, NULL
, RscId
() );
111 if
( lValue
< 1 || lValue
> (sal_Int32
)0x7FFF )
113 pTC
->pEH
->Error
( ERR_IDRANGE
, NULL
, RscId
(),
114 rtl
::OString
::valueOf
(lValue
).getStr
() );
117 if
( aExpType.IsDefinition
() )
118 return RscId
( aExpType.aExp.pDef
);
120 return RscId
( lValue
);
125 sal_Bool DoClassHeader
( RSCHEADER
* pHeader
, sal_Bool bMember
)
128 RscId aName1
= MakeRscId
( pHeader
->nName1
);
129 RscId aName2
= MakeRscId
( pHeader
->nName2
);
131 if
( pHeader
->pRefClass
)
132 aCopyInst.pClass
= pHeader
->pRefClass
;
134 aCopyInst.pClass
= pHeader
->pClass
;
136 if
( TYPE_COPY
== pHeader
->nTyp
)
138 ObjNode
* pCopyObj
= aCopyInst.pClass
->GetObjNode
( aName2
);
142 rtl
::OStringBuffer aMsg
( pHS
->getString
( aCopyInst.pClass
->GetId
() ) );
144 aMsg.append
(aName2.GetName
());
145 pTC
->pEH
->Error
( ERR_NOCOPYOBJ
, pHeader
->pClass
, aName1
,
149 aCopyInst.pData
= pCopyObj
->GetRscObj
();
154 // Angabe von Superklassen oder abgeleiteten Klassen ist jetzt erlaubt
155 if
( S.Top
().pClass
->InHierarchy
( pHeader
->pClass
)
156 || pHeader
->pClass
->InHierarchy
( S.Top
().pClass
) )
158 if
( aCopyInst.IsInst
() )
160 RSCINST aTmpI
( S.Top
() );
161 aTmpI.pClass
->Destroy
( aTmpI
);
162 aTmpI.pClass
->Create
( &aTmpI
, aCopyInst
);
166 pTC
->pEH
->Error
( ERR_FALSETYPE
, S.Top
().pClass
, aName1
,
167 pHS
->getString
( pHeader
->pClass
->GetId
() ).getStr
() );
173 if
( (sal_Int32
)aName1
< 256 )
174 pTC
->pEH
->Error
( WRN_GLOBALID
, pHeader
->pClass
, aName1
);
176 if
( aCopyInst.IsInst
() )
177 S.Push
( pHeader
->pClass
->Create
( NULL
, aCopyInst
) );
179 S.Push
( pHeader
->pClass
->Create
( NULL
, RSCINST
() ) );
181 pTC
->pEH
->StdOut
( ".", RscVerbosityVerbose
);
184 pTC
->pEH
->Error
( ERR_IDEXPECTED
, pHeader
->pClass
, aName1
);
187 ObjNode
* pNode
= new ObjNode
( aName1
, S.Top
().pData
,
188 pFI
->GetFileIndex
() );
189 if
( !pHeader
->pClass
->PutObjNode
( pNode
) )
190 pTC
->pEH
->Error
( ERR_DOUBLEID
, pHeader
->pClass
, aName1
);
198 if
( (sal_Int32
)aName1
>= 256 && aName1.IsId
() )
199 pTC
->pEH
->Error
( WRN_LOCALID
, pHeader
->pClass
, aName1
);
200 aError
= S.Top
().pClass
->GetElement
( S.Top
(), aName1
,
201 pHeader
->pClass
, aCopyInst
, &aTmpI
);
203 if
( aError.IsWarning
() )
204 pTC
->pEH
->Error
( aError
, pHeader
->pClass
, aName1
);
205 else if
( aError.IsError
() )
207 if
( ERR_CONT_INVALIDTYPE
== aError
)
208 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, aName1
,
209 pHS
->getString
( pHeader
->pClass
->GetId
() ).getStr
() );
211 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, aName1
);
212 S.Top
().pClass
->GetElement
( S.Top
(), RscId
(),
213 pHeader
->pClass
, RSCINST
(), &aTmpI
);
215 if
( !aTmpI.IsInst
() )
221 if
( TYPE_REF
== pHeader
->nTyp
)
225 aError
= S.Top
().pClass
->SetRef
( S.Top
(), aName2
);
226 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, aName1
);
232 RSCINST GetFirstTupelEle
( const RSCINST
& rTop
)
233 { // Aufwaertskompatible, Tupel probieren
237 aErr
= rTop.pClass
->GetElement
( rTop
, RscId
(), NULL
, RSCINST
(), &aInst
);
238 if
( !aErr.IsError
() )
239 aInst
= aInst.pClass
->GetTupelVar
( aInst
, 0, RSCINST
() );
246 #define YYMAXDEPTH 2000
248 #define YYMAXDEPTH 800
252 #pragma warning(push, 1)
253 #pragma warning(disable:4129 4273 4701 4702)
255 #if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY
256 #pragma GCC diagnostic ignored "-Wwrite-strings"
257 #elif defined __SUNPRO_CC
282 RscDefine
* defineele
;
284 RscExpType macrostruct
;
288 %token
<value
> NUMBER
289 %token
<string> SYMBOL
290 %token
<defineele
> RSCDEFINE
291 %token
<string> STRING
292 %token
<string> INCLUDE_STRING
293 %token
<character
> CHARACTER
294 %token
<svbool
> BOOLEAN
305 %token INZOOMOUTPUTSIZE
313 %token
<pClass
> CLASSNAME
314 %token
<varid
> VARNAME
315 %token
<constname
> CONSTNAME
321 %type
<macrostruct
> macro_expression
322 %type
<macrostruct
> id_expression
323 %type
<value
> long_expression
324 %type
<string> string_multiline
327 %type
<pClass
> type_base
328 %type
<header
> class_header_body
329 %type
<header
> class_header
330 %type
<header
> var_header_class
331 %type
<copyref
> copy_ref
332 %type
<ushort
> type_flags
337 %left LEFTSHIFT RIGHTSHIFT
348 %start resource_definitions
354 | resource_definitions resource_definition
355 | MACROTARGET macro_expression
360 aExpType.cType
= RSCEXP_NOTHING
;
361 pExp
= new RscExpression
( aExpType
, '+', $2 );
362 if
( !pExp
->Evaluate
( &lValue
) )
363 pTC
->pEH
->Error
( ERR_ZERODIVISION
, NULL
, RscId
() );
369 |
'#' DEFINE SYMBOL macro_expression
371 sal_Bool bError
= sal_False
;
374 if
( !pTC
->aFileTab.NewDef
( pFI
->GetFileIndex
(),
376 $4.GetLong
(), ULONG_MAX
) )
379 else if
( $4.IsDefinition
() ){
381 RscExpression
* pExpr
;
383 aExpType.cType
= RSCEXP_NOTHING
;
384 aExpType.SetLong
( 0 );
385 aExpType.cType
= RSCEXP_LONG
;
386 pExpr
= new RscExpression
( aExpType
, '+', $4 );
388 if
( !pTC
->aFileTab.NewDef
( pFI
->GetFileIndex
(),
389 rtl
::OString
( $3 ), pExpr
, ULONG_MAX
) )
392 else if
( $4.IsExpression
() ){
393 if
( !pTC
->aFileTab.NewDef
( pFI
->GetFileIndex
(),
394 rtl
::OString
( $3 ), $4.aExp.pExp
,
400 pTC
->pEH
->Error
( ERR_DECLAREDEFINE
, NULL
, RscId
(), $3 );
403 |
'#' DEFINE RSCDEFINE macro_expression
405 pTC
->pEH
->Error
( ERR_DOUBLEDEFINE
, NULL
, RscId
(), $3->GetName
().getStr
() );
410 |
'#' INCLUDE INCLUDE_STRING
413 | class_definition
';'
417 pMem
= rtl_allocateMemory
( 20000 );
418 rtl_freeMemory
( pMem
);
421 | new_class_definition_header
'{' new_class_definition_body
'}' ';'
422 | new_class_definition_header
';'
425 new_class_definition_header
426 : CLASS SYMBOL id_expression
':' CLASSNAME
430 $3.Evaluate
( &lType
);
433 Atom nId
= pHS
->getID
( $2 );
434 pCurClass
= new RscClass
( nId
, lType
, $5 );
436 pTC
->aNmTb.Put
( nId
, CLASSNAME
, pCurClass
);
437 pTC
->GetRoot
()->Insert
( pCurClass
);
439 | CLASS CLASSNAME id_expression
':' CLASSNAME
446 new_class_definition_body
448 | property_definition
';' new_class_definition_body
452 : type_flags type SYMBOL
455 Atom nId
= pTC
->aNmTb.Put
( $3, VARNAME
);
456 pCurClass
->SetVariable
( nId
, $2, NULL
, $1, nCurMask
);
459 | type_flags type VARNAME
461 pCurClass
->SetVariable
( $3, $2, NULL
, $1, nCurMask
);
467 : type_flags EXTENDABLE
469 $$
= $1 | VAR_EXTENDABLE
;
471 | type_flags WRITEIFSET
473 $$
= $1 | VAR_SVDYNAMIC
;
490 rtl
::OString aTypeName
= rtl
::OStringBuffer
(pHS
->getString
($1->GetId
())).
491 append
("[]").makeStringAndClear
();
492 $$
= pTC
->SearchType
( pHS
->getID
( aTypeName.getStr
(), true
) );
496 pCont
= new RscCont
( pHS
->getID
( aTypeName.getStr
() ), RSC_NOTYPE
);
497 pCont
->SetTypeClass
( $1 );
498 pTC
->InsertType
( pCont
);
514 RscTop
* pType
= pTC
->SearchType
( pHS
->getID
( $1, true
) );
516 pTC
->pEH
->Error
( ERR_NOTYPE
, pCurClass
, RscId
() );
522 : class_header class_body
524 if
( TYPE_REF
== $1.nTyp
)
525 pTC
->pEH
->Error
( ERR_REFNOTALLOWED
, S.Top
().pClass
,
526 RscId
( $1.nName1
) );
532 RscId aRscId
( $1.nName1
);
534 if
( TYPE_NOTHING
== $1.nTyp
&& aRscId.IsId
() )
535 aError
= S.Top
().pClass
->SetRef
( S.Top
(), aRscId
);
536 else if
( TYPE_COPY
== $1.nTyp
)
537 aError
= ERR_COPYNOTALLOWED
;
538 if
( aError.IsError
() || aError.IsWarning
() )
539 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, aRscId
);
547 if
( !DoClassHeader
( &$1, sal_False
) )
565 : CLASSNAME id_expression copy_ref CLASSNAME id_expression
573 | CLASSNAME id_expression copy_ref id_expression
581 | CLASSNAME id_expression
585 $$.nTyp
= TYPE_NOTHING
;
587 $$.nName2.cType
= RSCEXP_NOTHING
;
589 | CLASSNAME copy_ref id_expression
592 $$.nName1.cType
= RSCEXP_NOTHING
;
597 | CLASSNAME copy_ref CLASSNAME id_expression
600 $$.nName1.cType
= RSCEXP_NOTHING
;
608 $$.nName1.cType
= RSCEXP_NOTHING
;
609 $$.nTyp
= TYPE_NOTHING
;
610 $$.nName2.cType
= RSCEXP_NOTHING
;
615 : '{' var_definitions
'}'
619 SetString
( S.Top
(), "TEXT", $1 );
625 | var_definitions var_definition
631 SetConst
( S.Top
(), "_XYMAPMODE", $1.hashid
, $1.nValue
);
639 SetConst
( S.Top
(), "_WHMAPMODE", $1.hashid
, $1.nValue
);
647 SetConst
( S.Top
(), "_XYMAPMODE", $1.hashid
, $1.nValue
);
648 SetConst
( S.Top
(), "_WHMAPMODE", $1.hashid
, $1.nValue
);
655 | var_header var_body
';'
659 | class_definition
';'
660 | var_header_class class_body
';'
662 if
( TYPE_REF
== $1.nTyp
)
663 pTC
->pEH
->Error
( ERR_REFNOTALLOWED
, S.Top
().pClass
,
664 RscId
( $1.nName1
) );
666 if
( S.Top
().pClass
->GetCount
( S.Top
() ) )
667 pTC
->pEH
->Error
( WRN_SUBINMEMBER
, S.Top
().pClass
,
668 RscId
( $1.nName1
) );
672 | var_header_class
';'
675 RscId aRscId
( $1.nName1
);
677 if
( TYPE_NOTHING
== $1.nTyp
&& aRscId.IsId
() )
678 aError
= S.Top
().pClass
->SetRef
( S.Top
(), aRscId
);
679 else if
( TYPE_COPY
== $1.nTyp
)
680 aError
= ERR_COPYNOTALLOWED
;
681 if
( S.Top
().pClass
->GetCount
( S.Top
() ) )
682 aError
= WRN_SUBINMEMBER
;
683 if
( aError.IsError
() || aError.IsWarning
() )
684 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, aRscId
);
688 | XSCALE
'=' '(' long_expression
',' long_expression
')' ';'
690 SetNumber
( S.Top
(), "_XNUMERATOR", $4 );
691 SetNumber
( S.Top
(), "_XDENOMINATOR", $6 );
693 | YSCALE
'=' '(' long_expression
',' long_expression
')' ';'
695 SetNumber
( S.Top
(), "_YNUMERATOR", $4 );
696 SetNumber
( S.Top
(), "_YDENOMINATOR", $6 );
698 | RGB
'=' '(' long_expression
',' long_expression
699 ',' long_expression
')' ';'
701 SetNumber
( S.Top
(), "RED", $4 );
702 SetNumber
( S.Top
(), "GREEN", $6 );
703 SetNumber
( S.Top
(), "BLUE", $8 );
705 | GEOMETRY
'=' xywh_mapmode
'(' long_expression
',' long_expression
','
706 long_expression
',' long_expression
')' ';'
708 SetNumber
( S.Top
(), "_X", $5 );
709 SetNumber
( S.Top
(), "_Y", $7 );
710 SetNumber
( S.Top
(), "_WIDTH", $9 );
711 SetNumber
( S.Top
(), "_HEIGHT", $11 );
713 | POSITION
'=' xy_mapmode
'(' long_expression
',' long_expression
716 SetNumber
( S.Top
(), "_X", $5 );
717 SetNumber
( S.Top
(), "_Y", $7 );
719 | DIMENSION
'=' wh_mapmode
'(' long_expression
',' long_expression
722 SetNumber
( S.Top
(), "_WIDTH", $5 );
723 SetNumber
( S.Top
(), "_HEIGHT", $7 );
725 | INZOOMOUTPUTSIZE
'=' CONSTNAME
'(' long_expression
',' long_expression
728 SetConst
( S.Top
(), "_ZOOMINMAPMODE", $3.hashid
, $3.nValue
);
729 SetNumber
( S.Top
(), "_ZOOMINWIDTH", $5 );
730 SetNumber
( S.Top
(), "_ZOOMINHEIGHT", $7 );
732 | INZOOMOUTPUTSIZE
'=' '(' long_expression
',' long_expression
')' ';'
734 SetNumber
( S.Top
(), "_ZOOMINWIDTH", $4 );
735 SetNumber
( S.Top
(), "_ZOOMINHEIGHT", $6 );
737 | FLOATINGPOS
'=' CONSTNAME
'(' long_expression
',' long_expression
740 SetConst
( S.Top
(), "_FLOATINGPOSMAPMODE", $3.hashid
, $3.nValue
);
741 SetNumber
( S.Top
(), "_FLOATINGPOSX", $5 );
742 SetNumber
( S.Top
(), "_FLOATINGPOSY", $7 );
744 | FLOATINGPOS
'=' '(' long_expression
',' long_expression
')' ';'
746 SetNumber
( S.Top
(), "_FLOATINGPOSX", $4 );
747 SetNumber
( S.Top
(), "_FLOATINGPOSY", $6 );
752 : VARNAME
'=' class_header_body
756 aInst
= S.Top
().pClass
->GetVariable
( S.Top
(), $1, RSCINST
(), sal_False
, $3.pClass
);
762 pTC
->pEH
->Error
( ERR_NOVARIABLENAME
, S.Top
().pClass
, RscId
(),
763 pHS
->getString
( $1 ).getStr
() );
767 if
( !DoClassHeader
( &$3, sal_True
) )
771 | VARNAME
'[' CONSTNAME
']' '=' class_header_body
775 aInst
= S.Top
().pClass
->GetVariable
( S.Top
(), $1, RSCINST
() );
782 aError
= aInst.pClass
->GetArrayEle
( aInst
, $3.hashid
, NULL
, &aIdxInst
);
783 if
( aError.IsError
() || aError.IsWarning
() )
784 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
785 if
( aError.IsError
() )
791 pTC
->pEH
->Error
( ERR_NOVARIABLENAME
, S.Top
().pClass
, RscId
(),
792 pHS
->getString
( $1 ).getStr
() );
795 if
( !DoClassHeader
( &$6, sal_True
) )
799 | VARNAME
'[' SYMBOL
']' '=' class_header_body
803 aInst
= S.Top
().pClass
->GetVariable
( S.Top
(), $1, RSCINST
() );
807 long nNewLang
= pTC
->AddLanguage
( $3 );
811 aError
= aInst.pClass
->GetArrayEle
( aInst
, nNewLang
, NULL
, &aIdxInst
);
812 if
( aError.IsError
() || aError.IsWarning
() )
813 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
814 if
( aError.IsError
() )
820 pTC
->pEH
->Error
( ERR_NOVARIABLENAME
, S.Top
().pClass
, RscId
(),
821 pHS
->getString
( $1 ).getStr
() );
824 if
( !DoClassHeader
( &$6, sal_True
) )
835 aInst
= S.Top
().pClass
->GetVariable
( S.Top
(), $1, RSCINST
() );
840 pTC
->pEH
->Error
( ERR_NOVARIABLENAME
, S.Top
().pClass
, RscId
(),
841 pHS
->getString
( $1 ).getStr
() );
845 | VARNAME
'[' CONSTNAME
']' '='
849 aInst
= S.Top
().pClass
->GetVariable
( S.Top
(), $1, RSCINST
() );
856 aError
= aInst.pClass
->GetArrayEle
( aInst
, $3.hashid
, NULL
, &aIdxInst
);
857 if
( aError.IsError
() || aError.IsWarning
() )
858 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
859 if
( aError.IsError
() )
864 pTC
->pEH
->Error
( ERR_NOVARIABLENAME
, S.Top
().pClass
, RscId
(),
865 pHS
->getString
( $1 ).getStr
() );
869 | VARNAME
'[' SYMBOL
']' '='
873 aInst
= S.Top
().pClass
->GetVariable
( S.Top
(), $1, RSCINST
() );
877 long nNewLang
= pTC
->AddLanguage
( $3 );
881 aError
= aInst.pClass
->GetArrayEle
( aInst
, nNewLang
, NULL
, &aIdxInst
);
882 if
( aError.IsError
() || aError.IsWarning
() )
883 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
884 if
( aError.IsError
() )
889 pTC
->pEH
->Error
( ERR_NOVARIABLENAME
, S.Top
().pClass
, RscId
(),
890 pHS
->getString
( $1 ).getStr
() );
900 aInst
= S.Top
().pClass
->GetTupelVar
( S.Top
(), 0, RSCINST
() );
905 pTC
->pEH
->Error
( ERR_NOTUPELNAME
, S.Top
().pClass
, RscId
() );
916 aInst
= S.Top
().pClass
->GetTupelVar
( S.Top
(), 1, RSCINST
() );
921 pTC
->pEH
->Error
( ERR_NOTUPELNAME
, S.Top
().pClass
, RscId
() );
932 aInst
= S.Top
().pClass
->GetTupelVar
( S.Top
(), 2, RSCINST
() );
937 pTC
->pEH
->Error
( ERR_NOTUPELNAME
, S.Top
().pClass
, RscId
() );
948 aInst
= S.Top
().pClass
->GetTupelVar
( S.Top
(), 3, RSCINST
() );
951 pTC
->pEH
->Error
( ERR_NOTUPELNAME
, S.Top
().pClass
, RscId
() );
971 aError
= S.Top
().pClass
->GetElement
( S.Top
(), RscId
(),
972 NULL
, RSCINST
(), &aInst
);
973 if
( aError.IsError
() || aError.IsWarning
() )
974 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
975 if
( aError.IsError
() )
976 { // unbedingt Instanz auf den Stack bringen
977 aInst
= S.Top
().pClass
->Create
( NULL
, RSCINST
() );
993 sal_uInt32 nCount
= S.Top
().pClass
->GetCount
( S.Top
() );
996 for
( i
= nCount
; i
> 0; i
-- )
997 S.Top
().pClass
->DeletePos
( S.Top
(), i
-1 );
1002 : list var_list_header list_body
';'
1003 | list var_bodysimple
';'
1004 | list class_definition
';'
1015 if
( !$1.Evaluate
( &l
) )
1016 pTC
->pEH
->Error
( ERR_ZERODIVISION
, NULL
, RscId
() );
1019 aError
= S.Top
().pClass
->SetRef
( S.Top
(), RscId
( $1 ) );
1020 if
( aError.IsError
() )
1023 aError
= S.Top
().pClass
->SetNumber
( S.Top
(), l
);
1025 if
( aError.IsError
() )
1026 { // Aufwaertskompatible, Tupel probieren
1027 RSCINST aInst
= GetFirstTupelEle
( S.Top
() );
1030 aError.Clear
(); // Fehler zuruecksetzen
1031 aError
= aInst.pClass
->SetRef
( aInst
, RscId
( $1 ) );
1032 if
( aError.IsError
() )
1035 aError
= aInst.pClass
->SetNumber
( aInst
, l
);
1041 if
( $1.IsExpression
() )
1042 delete
$1.aExp.pExp
;
1044 if
( aError.IsError
() || aError.IsWarning
() )
1045 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
1050 aError
= S.Top
().pClass
->SetConst
( S.Top
(), $1.hashid
, $1.nValue
);
1051 if
( aError.IsError
() )
1052 { // Aufwaertskompatible, Tupel probieren
1053 RSCINST aInst
= GetFirstTupelEle
( S.Top
() );
1056 aError.Clear
(); // Fehler zuruecksetzen
1057 aError
= aInst.pClass
->SetConst
( aInst
, $1.hashid
, $1.nValue
);
1061 if
( aError.IsError
() || aError.IsWarning
() )
1062 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
1067 aError
= S.Top
().pClass
->SetNotConst
( S.Top
(), $2.hashid
);
1068 if
( aError.IsError
() )
1069 { // Aufwaertskompatible, Tupel probieren
1070 RSCINST aInst
= GetFirstTupelEle
( S.Top
() );
1073 aError.Clear
(); // Fehler zuruecksetzen
1074 aError
= aInst.pClass
->SetNotConst
( aInst
, $2.hashid
);
1078 if
( aError.IsError
() || aError.IsWarning
() )
1079 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
1084 aError
= S.Top
().pClass
->SetBool
( S.Top
(), $1 );
1085 if
( aError.IsError
() )
1086 { // Aufwaertskompatible, Tupel probieren
1087 RSCINST aInst
= GetFirstTupelEle
( S.Top
() );
1090 aError.Clear
(); // Fehler zuruecksetzen
1091 aError
= aInst.pClass
->SetBool
( aInst
, $1 );
1095 if
( aError.IsError
() || aError.IsWarning
() )
1096 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
1101 aError
= S.Top
().pClass
->SetString
( S.Top
(), $1 );
1102 if
( aError.IsError
() )
1103 { // Aufwaertskompatible, Tupel probieren
1104 RSCINST aInst
= GetFirstTupelEle
( S.Top
() );
1107 aError.Clear
(); // Fehler zuruecksetzen
1108 aError
= aInst.pClass
->SetString
( aInst
, $1 );
1112 if
( aError.IsError
() || aError.IsWarning
() )
1113 pTC
->pEH
->Error
( aError
, S.Top
().pClass
, RscId
() );
1119 : '{' list_header list
'}'
1120 |
'<' tupel_header0 tupel_body
';' '>'
1121 |
'<' tupel_header0 tupel_body
';' tupel_header1 tupel_body
';' '>'
1122 |
'<' tupel_header0 tupel_body
';' tupel_header1 tupel_body
';'
1123 tupel_header2 tupel_body
';' '>'
1124 |
'<' tupel_header0 tupel_body
';' tupel_header1 tupel_body
';'
1125 tupel_header2 tupel_body
';' tupel_header3 tupel_body
';' '>'
1138 | string_multiline STRING
1140 rtl
::OStringBuffer aBuf
( 256 );
1143 $$
= (char*)pStringContainer
->putString
( aBuf.getStr
() );
1150 if
( !$1.Evaluate
( &$$
) )
1151 pTC
->pEH
->Error
( ERR_ZERODIVISION
, NULL
, RscId
() );
1152 if
( $1.IsExpression
() )
1153 delete
$1.aExp.pExp
;
1160 $$.cType
= RSCEXP_DEF
;
1165 $$.cType
= RSCEXP_LONG
;
1168 |
'-' macro_expression %prec UNARYMINUS
1170 if
( $2.IsNumber
() ){
1171 $$.cType
= $2.cType
;
1172 $$.SetLong
( - $2.GetLong
() );
1175 RscExpType aLeftExp
;
1177 aLeftExp.cType
= RSCEXP_NOTHING
;
1178 $$.cType
= RSCEXP_EXP
;
1179 $$.aExp.pExp
= new RscExpression
( aLeftExp
, '-', $2 );
1182 |
'+' macro_expression %prec UNARYPLUS
1186 | macro_expression
'+' macro_expression
1188 if
( $1.IsNumber
() && $3.IsNumber
() ){
1189 $$.cType
= RSCEXP_LONG
;
1190 $$.SetLong
( $1.GetLong
() + $3.GetLong
() );
1193 $$.cType
= RSCEXP_EXP
;
1194 $$.aExp.pExp
= new RscExpression
( $1, '+', $3 );
1197 | macro_expression
'-' macro_expression
1199 if
( $1.IsNumber
() && $3.IsNumber
() ){
1200 $$.cType
= RSCEXP_LONG
;
1201 $$.SetLong
( $1.GetLong
() - $3.GetLong
() );
1204 $$.cType
= RSCEXP_EXP
;
1205 $$.aExp.pExp
= new RscExpression
( $1, '-', $3 );
1208 | macro_expression
'*' macro_expression
1210 if
( $1.IsNumber
() && $3.IsNumber
() ){
1211 $$.cType
= RSCEXP_LONG
;
1212 $$.SetLong
( $1.GetLong
() * $3.GetLong
() );
1215 $$.cType
= RSCEXP_EXP
;
1216 $$.aExp.pExp
= new RscExpression
( $1, '*', $3 );
1219 | macro_expression
'/' macro_expression
1221 if
( $1.IsNumber
() && $3.IsNumber
() ){
1222 if
( 0 == $3.GetLong
() ){
1223 $$.cType
= RSCEXP_EXP
;
1224 $$.aExp.pExp
= new RscExpression
( $1, '/', $3 );
1227 $$.cType
= RSCEXP_LONG
;
1228 $$.SetLong
( $1.GetLong
() / $3.GetLong
() );
1232 $$.cType
= RSCEXP_EXP
;
1233 $$.aExp.pExp
= new RscExpression
( $1, '/', $3 );
1236 | macro_expression
'&' macro_expression
1238 if
( $1.IsNumber
() && $3.IsNumber
() ){
1239 $$.cType
= RSCEXP_LONG
;
1240 $$.SetLong
( $1.GetLong
() & $3.GetLong
() );
1243 $$.cType
= RSCEXP_EXP
;
1244 $$.aExp.pExp
= new RscExpression
( $1, '&', $3 );
1247 | macro_expression
'|' macro_expression
1249 if
( $1.IsNumber
() && $3.IsNumber
() ){
1250 $$.cType
= RSCEXP_LONG
;
1251 $$.SetLong
( $1.GetLong
() |
$3.GetLong
() );
1254 $$.cType
= RSCEXP_EXP
;
1255 $$.aExp.pExp
= new RscExpression
( $1, '|', $3 );
1258 |
'(' macro_expression
')'
1262 | macro_expression LEFTSHIFT macro_expression
1264 if
( $1.IsNumber
() && $3.IsNumber
() ){
1265 $$.cType
= RSCEXP_LONG
;
1266 $$.SetLong
( $1.GetLong
() << $3.GetLong
() );
1269 $$.cType
= RSCEXP_EXP
;
1270 $$.aExp.pExp
= new RscExpression
( $1, 'l', $3 );
1273 | macro_expression RIGHTSHIFT macro_expression
1275 if
( $1.IsNumber
() && $3.IsNumber
() ){
1276 $$.cType
= RSCEXP_LONG
;
1277 $$.SetLong
( $1.GetLong
() >> $3.GetLong
() );
1280 $$.cType
= RSCEXP_EXP
;
1281 $$.aExp.pExp
= new RscExpression
( $1, 'r', $3 );
1287 : id_expression line_number
1289 { // pExpession auswerten und loeschen
1290 if
( RSCEXP_EXP
== $1.cType
){
1293 if
( !$1.Evaluate
( &lValue
) )
1294 pTC
->pEH
->Error
( ERR_ZERODIVISION
, NULL
, RscId
() );
1295 delete
$1.aExp.pExp
;
1296 $$.cType
= RSCEXP_LONG
;
1297 $$.SetLong
( lValue
);
1314 : '#' LINE NUMBER STRING
1318 pFI
->SetLineNo
( $3 );
1319 pFI
->SetFileIndex
( pTC
->aFileTab.NewCodeFile
( rtl
::OString
( $4 ) ) );
1320 pFName
= pTC
->aFileTab.Get
( pFI
->GetFileIndex
() );
1321 pFName
->bLoaded
= sal_True
;
1322 pFName
->bScanned
= sal_True
;
1324 |
'#' NUMBER STRING DUMMY_NUMBER
1328 pFI
->SetLineNo
( $2 );
1329 pFI
->SetFileIndex
( pTC
->aFileTab.NewCodeFile
( rtl
::OString
( $3 ) ) );
1330 pFName
= pTC
->aFileTab.Get
( pFI
->GetFileIndex
() );
1331 pFName
->bLoaded
= sal_True
;
1332 pFName
->bScanned
= sal_True
;
1336 pFI
->SetLineNo
( $2 );
1341 #if defined _MSC_VER
1342 #pragma warning(pop)
1345 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */