ooo-build r13509 - in trunk: . patches/dev300 patches/test patches/vba



Author: pflin
Date: Mon Aug 11 07:09:09 2008
New Revision: 13509
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13509&view=rev

Log:
2008-08-11  Fong Lin  <pflin novell com>
	* patches/vba/vba-keyword-fix.diff: some keywords can be used as variable. 
	* patches/dev300/apply.



Added:
   trunk/patches/vba/vba-keyword-fix.diff
Removed:
   trunk/patches/test/vba-keyword-fix.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Mon Aug 11 07:09:09 2008
@@ -1507,6 +1507,8 @@
 basic-not-is-nothing.diff, n#407805, Fong
 bytearray-string-fix.diff, i#91911, Fong
 basic-replace-function-fix.diff, n#411203, Fong
+# keywords (including NAME, LINE, TEXT) can be used as variable 
+vba-keyword-fix.diff, n#403586, Fong
 
 [ VBAUntested ]
 SectionOwner => noelpwer

Added: trunk/patches/vba/vba-keyword-fix.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-keyword-fix.diff	Mon Aug 11 07:09:09 2008
@@ -0,0 +1,116 @@
+--- basic/source/inc/token.hxx.orig	2008-07-30 11:33:31.000000000 +0800
++++ basic/source/inc/token.hxx	2008-07-30 16:54:58.000000000 +0800
+@@ -162,6 +162,10 @@ public:
+ 		{ return BOOL( t >= FIRSTKWD && t <= LASTKWD ); }
+ 	static BOOL IsExtra( SbiToken t )
+ 		{ return BOOL( t >= FIRSTEXTRA ); }
++
++    // process somthing like dim Name as String
++	virtual BOOL IsSymbol( SbiToken )
++        { return FALSE; }
+ };
+ 
+ 
+--- basic/source/inc/parser.hxx.orig	2008-07-30 11:33:31.000000000 +0800
++++ basic/source/inc/parser.hxx	2008-07-30 16:54:58.000000000 +0800
+@@ -40,6 +40,7 @@
+ typedef ::std::vector< String > IfaceVector;
+ 
+ struct SbiParseStack;
++struct SbiStatement;
+ 
+ class SbiParser : public SbiTokenizer
+ {
+@@ -53,6 +54,7 @@ class SbiParser : public SbiTokenizer
+ 	BOOL		bGblDefs; 			// TRUE globale Definitionen allgemein
+ 	BOOL		bNewGblDefs; 		// TRUE globale Definitionen vor Sub
+ 	BOOL		bSingleLineIf; 		// TRUE einzeiliges if-Statement
++	SbiStatement* pCurStat;
+ 
+ 	SbiSymDef*  VarDecl( SbiDimList**,BOOL,BOOL );// Variablen-Deklaration
+ 	SbiProcDef* ProcDecl(BOOL bDecl);// Prozedur-Deklaration
+@@ -100,6 +102,7 @@ public:
+ 	BOOL TestSymbol( BOOL=FALSE );	// Symbol?
+ 	BOOL TestComma();				// Komma oder EOLN?
+ 	void TestEoln();				// EOLN?
++	virtual BOOL IsSymbol( SbiToken t ); // Process something like DIM Name as String
+ 
+ 	void Symbol();					// Let oder Call
+ 	void ErrorStmnt(); 				// ERROR n
+--- basic/source/comp/token.cxx.orig	2008-07-30 11:33:31.000000000 +0800
++++ basic/source/comp/token.cxx	2008-08-08 16:12:12.000000000 +0800
+@@ -594,6 +594,13 @@ special:
+ 		}
+ 		return eCurTok;
+ 	}
++
++	// check whether the keyword has been dim as a variable
++	if( IsSymbol( tp->t ) )
++	{
++		return eCurTok = SYMBOL;
++	}
++	
+ 	// Sind Datentypen Keywords?
+ 	// Nur nach AS, sonst sind es Symbole!
+ 	// Es gibt ja ERROR(), DATA(), STRING() etc.
+--- basic/source/comp/parser.cxx.orig	2008-07-30 11:33:33.000000000 +0800
++++ basic/source/comp/parser.cxx	2008-08-11 10:10:40.000000000 +0800
+@@ -138,6 +138,7 @@ SbiParser::SbiParser( StarBASIC* pb, SbM
+ 	pProc    = NULL;
+ 	pStack   = NULL;
+ 	pWithVar = NULL;
++	pCurStat = NULL;
+ 	nBase	 = 0;
+ 	bText	 =
+ 	bGblDefs =
+@@ -308,6 +309,26 @@ void SbiParser::TestEoln()
+ 	}
+ }
+ 
++// If some keywords e.g. Name have been dim as a variable, 
++// they should be treated as symbol
++BOOL SbiParser::IsSymbol( SbiToken t )
++{
++	// FIXME: if "name" is a argument in a subroutine like "Sub Test( name as String )".
++	if( IsVBASupportOn() && ( t == NAME || t == LINE || t == TEXT ))
++	{
++		if( pCurStat && ( pCurStat->eTok == DIM || pCurStat->eTok == PUBLIC ||
++		  pCurStat->eTok == PRIVATE || pCurStat->eTok == GLOBAL	))
++		{
++			return TRUE;
++		}
++    	if( pPool->Find(aSym) )
++    	{
++        	return TRUE;
++    	}
++	}	
++    return FALSE;
++}
++
+ // Parsing eines Statement-Blocks
+ // Das Parsing laeuft bis zum Ende-Token.
+ 
+@@ -431,7 +452,9 @@ BOOL SbiParser::Parse()
+ 				if( ( p->bSubr && (eCurTok != STATIC || Peek() == SUB || Peek() == FUNCTION ) ) ||
+ 						eCurTok == SUB || eCurTok == FUNCTION )
+ 					aGen.Statement();
++				pCurStat = p;	
+ 				(this->*( p->Func ) )();
++				pCurStat = NULL;
+ 				SbxError nSbxErr = SbxBase::GetError();
+ 				if( nSbxErr )
+ 					SbxBase::ResetError(), Error( (SbError)nSbxErr );
+--- basic/source/comp/dim.cxx.orig	2008-07-31 14:54:31.000000000 +0800
++++ basic/source/comp/dim.cxx	2008-08-11 10:12:22.000000000 +0800
+@@ -40,7 +40,10 @@
+ 
+ SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst )
+ {
+-	if( !TestSymbol() ) return NULL;
++	// Some keywords can be dim as varibles like " Sub Test( Name as String )"
++	eCurTok = Peek();
++	BOOL bKwdOk = IsVBASupportOn() ? BOOL( (eCurTok == NAME) || (eCurTok == LINE) || (eCurTok == TEXT) ): FALSE;
++	if( !TestSymbol( bKwdOk ) ) return NULL;
+ 	SbxDataType t = eScanType;
+ 	SbiSymDef* pDef = bConst ? new SbiConstDef( aSym ) : new SbiSymDef( aSym );
+ 	SbiDimList* pDim = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]