Index: basic/source/comp/exprtree.cxx
===================================================================
RCS file: /cvs/script/basic/source/comp/exprtree.cxx,v
retrieving revision 1.18
diff -u -p -r1.18 exprtree.cxx
--- basic/source/comp/exprtree.cxx	12 Oct 2006 14:27:12 -0000	1.18
+++ basic/source/comp/exprtree.cxx	24 Jul 2007 21:21:14 -0000
@@ -46,9 +46,10 @@
 |*
 ***************************************************************************/
 
-SbiExpression::SbiExpression( SbiParser* p, SbiExprType t )
+SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, BOOL bNested )
 {
 	pParser = p;
+	mbNested = bNested;
 	bError = bByVal = bBased = FALSE;
 	eCurExpr = t;
 	pNext = NULL;
@@ -61,9 +62,10 @@ SbiExpression::SbiExpression( SbiParser*
 		p->Error( SbERR_VAR_EXPECTED );
 }
 
-SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t )
+SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t, BOOL bNested )
 {
 	pParser = p;
+	mbNested = bNested;
 	eCurExpr = SbOPERAND;
 	pNext = NULL;
 	bError = bByVal = bBased = FALSE;
@@ -71,27 +73,30 @@ SbiExpression::SbiExpression( SbiParser*
 	pExpr->Optimize();
 }
 
-SbiExpression::SbiExpression( SbiParser* p, const String& r )
+SbiExpression::SbiExpression( SbiParser* p, const String& r, BOOL bNested )
 {
 	pParser = p;
+	mbNested = bNested;
 	pNext = NULL;
 	bError = bByVal = bBased = FALSE;
 	eCurExpr = SbOPERAND;
 	pExpr = new SbiExprNode( pParser, r );
 }
 
-SbiExpression::SbiExpression( SbiParser* p, const SbiSymDef& r, SbiExprList* pPar )
+SbiExpression::SbiExpression( SbiParser* p, const SbiSymDef& r, SbiExprList* pPar, BOOL bNested )
 {
 	pParser = p;
+	mbNested = bNested;
 	pNext = NULL;
 	bError = bByVal = bBased = FALSE;
 	eCurExpr = SbOPERAND;
 	pExpr = new SbiExprNode( pParser, r, SbxVARIANT, pPar );
 }
 
-SbiExpression::SbiExpression( SbiParser* p, SbiToken t )
+SbiExpression::SbiExpression( SbiParser* p, SbiToken t, BOOL bNested  )
 {
 	pParser = p;
+	mbNested = bNested;
 	pNext = NULL;
 	bError = bByVal = bBased = FALSE;
 	eCurExpr = SbOPERAND;
@@ -242,7 +247,7 @@ SbiExprNode* SbiExpression::Term()
 
 	if( DoParametersFollow( pParser, eCurExpr, eTok = eNextTok ) )
 	{
-		pPar = new SbiParameters( pParser );
+		pPar = new SbiParameters( pParser, FALSE, TRUE, mbNested );
 		bError |= !pPar->IsValid();
 		eTok = pParser->Peek();
 	}
@@ -348,7 +353,7 @@ SbiExprNode* SbiExpression::Term()
 	}
 	SbiExprNode* pNd = new SbiExprNode( pParser, *pDef, eType );
 	if( !pPar )
-		pPar = new SbiParameters( pParser,FALSE,FALSE );
+		pPar = new SbiParameters( pParser,FALSE,FALSE, mbNested );
 	pNd->aVar.pPar = pPar;
 	if( bObj )
 	{
@@ -405,7 +410,7 @@ SbiExprNode* SbiExpression::ObjTerm( Sbi
 	// Parameter?
 	if( DoParametersFollow( pParser, eCurExpr, eTok ) )
 	{
-		pPar = new SbiParameters( pParser );
+		pPar = new SbiParameters( pParser, FALSE, TRUE, mbNested );
 		bError |= !pPar->IsValid();
 		eTok = pParser->Peek();
 	}
@@ -813,8 +818,8 @@ void SbiExprList::addExpression( SbiExpr
 // Dann handelt es sich um eine Funktion ohne Parameter
 // respektive um die Angabe eines Arrays als Prozedurparameter.
 
-SbiParameters::SbiParameters( SbiParser* p, BOOL bConst, BOOL bPar) :
-	SbiExprList( p )
+SbiParameters::SbiParameters( SbiParser* p, BOOL bConst, BOOL bPar, BOOL bNested ) :
+	SbiExprList( p ) 
 {
 	if (bPar)
 	{
@@ -843,7 +848,7 @@ SbiParameters::SbiParameters( SbiParser*
 			// Fehlendes Argument
 			if( eTok == COMMA )
 			{
-				pExpr = new SbiExpression( pParser, 0, SbxEMPTY );
+				pExpr = new SbiExpression( pParser, 0, SbxEMPTY, TRUE );
 				if( bConst )
 					pParser->Error( SbERR_SYNTAX ), bError = TRUE;
 			}
@@ -851,7 +856,7 @@ SbiParameters::SbiParameters( SbiParser*
 			else
 			{
 				pExpr = bConst ? new SbiConstExpression( pParser )
-								: new SbiExpression( pParser );
+								: new SbiExpression( pParser, SbSTDEXPR, TRUE  );
 				if( pParser->Peek() == ASSIGN )
 				{
 					// VBA mode: name:=
@@ -876,14 +881,36 @@ SbiParameters::SbiParameters( SbiParser*
 			eTok = pParser->Peek();
 			if( eTok != COMMA )
 			{
-				if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) )
+				if ( bBracket && eTok == RPAREN )
+				{
+					if ( !bNested )
+					{
+						SbiTokenizer tokens( *(SbiTokenizer*)pParser );
+						tokens.Next();
+						if ( tokens.Peek() == COMMA )
+						{
+							// advance the parser to the comma
+							pParser->Next();
+							pParser->Peek();
+						}
+						else
+							break;
+					}
+					else
+						break;
+				}
+				else if(  pParser->IsEoln( eTok ) )
 					break;
-				pParser->Error( bBracket
-								? SbERR_BAD_BRACKETS
-								: SbERR_EXPECTED, COMMA );
-				bError = TRUE;
+				else
+				{
+					pParser->Error( bBracket
+					? SbERR_BAD_BRACKETS
+					: SbERR_EXPECTED, COMMA );
+					bError = TRUE;
+				}
 			}
-			else
+			//else
+			if ( !bError )
 			{
 				pParser->Next();
 				eTok = pParser->Peek();
? basic/source/inc/errobject.hxx
Index: basic/source/inc/expr.hxx
===================================================================
RCS file: /cvs/script/basic/source/inc/expr.hxx,v
retrieving revision 1.10
diff -u -p -r1.10 expr.hxx
--- basic/source/inc/expr.hxx	5 May 2006 08:48:52 -0000	1.10
+++ basic/source/inc/expr.hxx	24 Jul 2007 21:21:24 -0000
@@ -169,11 +169,12 @@ protected:
 	SbiExprNode* Comp();
 	SbiExprNode* Boolean();
 public:
-	SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR ); // Parsender Ctor
-	SbiExpression( SbiParser*, const String& );
-	SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE );
-	SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL );
-	SbiExpression( SbiParser*, SbiToken );        // Spezial-Expr mit Spezial-Tokens
+	SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR, BOOL bNested = FALSE ); // Parsender Ctor
+	SbiExpression( SbiParser*, const String& , BOOL bNested = FALSE);
+	SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE , BOOL bNested = FALSE);
+	SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL , BOOL bNested = FALSE);
+	SbiExpression( SbiParser*, SbiToken , BOOL bNested = FALSE);        // Spezial-Expr mit Spezial-Tokens
+	BOOL mbNested;
    ~SbiExpression();
 	String& GetName()               { return aArgName;            }
 	void SetBased()					{ bBased = TRUE; 			  }
@@ -232,7 +233,7 @@ public:
 
 class SbiParameters : public SbiExprList {
 public:
-	SbiParameters( SbiParser*, BOOL bConst = FALSE, BOOL bPar = TRUE);// parsender Ctor
+	SbiParameters( SbiParser*, BOOL bConst = FALSE, BOOL bPar = TRUE, BOOL bNested = FALSE );// parsender Ctor
 };
 
 class SbiDimList : public SbiExprList {
