summaryrefslogtreecommitdiff
path: root/basic/source/comp/parser.cxx
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2006-05-05 07:48:18 +0000
committerRüdiger Timm <rt@openoffice.org>2006-05-05 07:48:18 +0000
commite14cf02805fe83b1b3fc105ddac460ad30adb0ae (patch)
treeda31ce3d442fbd189b7e127c9eb6f5d068cc0500 /basic/source/comp/parser.cxx
parent69a7b8dad974ae9a8607c7b37268285ed2028e3a (diff)
INTEGRATION: CWS ab26 (1.13.70); FILE MERGED
2006/04/28 07:03:49 ab 1.13.70.2: #111791# Error as command 2006/04/27 10:55:47 ab 1.13.70.1: #111951# Mid as lvalue
Diffstat (limited to 'basic/source/comp/parser.cxx')
-rw-r--r--basic/source/comp/parser.cxx77
1 files changed, 54 insertions, 23 deletions
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 99673cac0c99..c69a3cfaf8f1 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: parser.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: hr $ $Date: 2005-09-29 16:17:04 $
+ * last change: $Author: rt $ $Date: 2006-05-05 08:48:18 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -333,7 +333,9 @@ BOOL SbiParser::Parse()
EnableErrors();
+ bErrorIsSymbol = false;
Peek();
+ bErrorIsSymbol = true;
// Dateiende?
if( IsEof() )
{
@@ -484,36 +486,65 @@ void SbiParser::Symbol()
bool bEQ = ( Peek() == EQ );
RecursiveMode eRecMode = ( bEQ ? PREVENT_CALL : FORCE_CALL );
- aVar.Gen( eRecMode );
- if( !bEQ )
+ bool bSpecialMidHandling = false;
+ SbiSymDef* pDef = aVar.GetRealVar();
+ if( bEQ && pDef && pDef->GetScope() == SbRTL )
{
- aGen.Gen( _GET );
+ String aRtlName = pDef->GetName();
+ if( aRtlName.EqualsIgnoreCaseAscii("Mid") )
+ {
+ SbiExprNode* pExprNode = aVar.GetExprNode();
+ // SbiNodeType eNodeType;
+ if( pExprNode && pExprNode->GetNodeType() == SbxVARVAL )
+ {
+ SbiExprList* pPar = pExprNode->GetParameters();
+ short nParCount = pPar ? pPar->GetSize() : 0;
+ if( nParCount == 2 || nParCount == 3 )
+ {
+ if( nParCount == 2 )
+ pPar->addExpression( new SbiExpression( this, -1, SbxLONG ) );
+
+ TestToken( EQ );
+ pPar->addExpression( new SbiExpression( this ) );
+
+ bSpecialMidHandling = true;
+ }
+ }
+ }
}
- else
+ aVar.Gen( eRecMode );
+ if( !bSpecialMidHandling )
{
- // Dann muss es eine Zuweisung sein. Was anderes gibts nicht!
- if( !aVar.IsLvalue() )
- Error( SbERR_LVALUE_EXPECTED );
- TestToken( EQ );
- SbiExpression aExpr( this );
- aExpr.Gen();
- SbiOpcode eOp = _PUT;
- SbiSymDef* pDef = aVar.GetRealVar();
- if( pDef )
+ if( !bEQ )
+ {
+ aGen.Gen( _GET );
+ }
+ else
{
- if( pDef->GetConstDef() )
- Error( SbERR_DUPLICATE_DEF, pDef->GetName() );
- if( pDef->GetType() == SbxOBJECT )
+ // Dann muss es eine Zuweisung sein. Was anderes gibts nicht!
+ if( !aVar.IsLvalue() )
+ Error( SbERR_LVALUE_EXPECTED );
+ TestToken( EQ );
+ SbiExpression aExpr( this );
+ aExpr.Gen();
+ SbiOpcode eOp = _PUT;
+ // SbiSymDef* pDef = aVar.GetRealVar();
+ if( pDef )
{
- eOp = _SET;
- if( pDef->GetTypeId() )
+ if( pDef->GetConstDef() )
+ Error( SbERR_DUPLICATE_DEF, pDef->GetName() );
+ if( pDef->GetType() == SbxOBJECT )
{
- aGen.Gen( _SETCLASS, pDef->GetTypeId() );
- return;
+ eOp = _SET;
+ if( pDef->GetTypeId() )
+ {
+ aGen.Gen( _SETCLASS, pDef->GetTypeId() );
+ return;
+ }
}
}
+ aGen.Gen( eOp );
}
- aGen.Gen( eOp );
}
}