diff options
Diffstat (limited to 'patches/vba/vba-keyword-fix.diff')
-rw-r--r-- | patches/vba/vba-keyword-fix.diff | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/patches/vba/vba-keyword-fix.diff b/patches/vba/vba-keyword-fix.diff deleted file mode 100644 index 32ced0329..000000000 --- a/patches/vba/vba-keyword-fix.diff +++ /dev/null @@ -1,116 +0,0 @@ ---- 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; |