diff -r 214156d907a1 basic/source/classes/sbxmod.cxx --- a/basic/source/classes/sbxmod.cxx Thu Jan 21 00:51:35 2010 +0100 +++ b/basic/source/classes/sbxmod.cxx Mon Feb 08 12:01:01 2010 +0100 @@ -157,6 +157,11 @@ { SetName( rName ); SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH ); + + // #i92642: Set name property to intitial name + SbxVariable* pNameProp = pProps->Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_PROPERTY ); + if( pNameProp != NULL ) + pNameProp->PutString( GetName() ); } SbModule::~SbModule() @@ -416,7 +421,19 @@ } } else - SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + { + // #i92642: Special handling for name property to avoid + // side effects when using name as variable implicitely + bool bForwardToSbxObject = true; + + ULONG nId = pHint->GetId(); + if( (nId == SBX_HINT_DATAWANTED || nId == SBX_HINT_DATACHANGED) && + pVar->GetName().EqualsIgnoreCaseAscii( "name" ) ) + bForwardToSbxObject = false; + + if( bForwardToSbxObject ) + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + } } } diff -r 214156d907a1 basic/source/comp/exprtree.cxx --- a/basic/source/comp/exprtree.cxx Thu Jan 21 00:51:35 2010 +0100 +++ b/basic/source/comp/exprtree.cxx Mon Feb 08 12:01:01 2010 +0100 @@ -41,7 +41,8 @@ |* ***************************************************************************/ -SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, SbiExprMode eMode ) +SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, + SbiExprMode eMode, const KeywordSymbolInfo* pKeywordSymbolInfo ) { pParser = p; bError = bByVal = bBased = bBracket = FALSE; @@ -49,7 +50,7 @@ eCurExpr = t; m_eMode = eMode; pNext = NULL; - pExpr = (t != SbSTDEXPR ) ? Term() : Boolean(); + pExpr = (t != SbSTDEXPR ) ? Term( pKeywordSymbolInfo ) : Boolean(); if( t != SbSYMBOL ) pExpr->Optimize(); if( t == SbLVALUE && !pExpr->IsLvalue() ) @@ -180,8 +181,8 @@ // Zur Zeit sind sogar Keywords zugelassen (wg. gleichnamiger Dflt-Properties) -SbiExprNode* SbiExpression::Term( void ) -{ +SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) +{ if( pParser->Peek() == DOT ) { // eine WITH-Variable @@ -207,11 +208,11 @@ return pNd; } - SbiToken eTok = pParser->Next(); + SbiToken eTok = (pKeywordSymbolInfo == NULL) ? pParser->Next() : pKeywordSymbolInfo->m_eTok; // Anfang des Parsings merken pParser->LockColumn(); - String aSym( pParser->GetSym() ); - SbxDataType eType = pParser->GetType(); + String aSym( (pKeywordSymbolInfo == NULL) ? pParser->GetSym() : pKeywordSymbolInfo->m_aKeywordSymbol ); + SbxDataType eType = (pKeywordSymbolInfo == NULL) ? pParser->GetType() : pKeywordSymbolInfo->m_eSbxDataType; SbiParameters* pPar = NULL; SbiExprListVector* pvMoreParLcl = NULL; // Folgen Parameter? diff -r 214156d907a1 basic/source/comp/io.cxx --- a/basic/source/comp/io.cxx Thu Jan 21 00:51:35 2010 +0100 +++ b/basic/source/comp/io.cxx Mon Feb 08 12:01:01 2010 +0100 @@ -118,6 +118,30 @@ aGen.Gen( _CHAN0 ); } + +// #i92642 Handle LINE keyword outside ::Next() +void SbiParser::Line() +{ + // #i92642: Special handling to allow name as symbol + if( Peek() == INPUT ) + { + Next(); + LineInput(); + } + else + { + aGen.Statement(); + + KeywordSymbolInfo aInfo; + aInfo.m_aKeywordSymbol = String( RTL_CONSTASCII_USTRINGPARAM( "line" ) ); + aInfo.m_eSbxDataType = GetType(); + aInfo.m_eTok = SYMBOL; + + Symbol( &aInfo ); + } +} + + // LINE INPUT [prompt], var$ void SbiParser::LineInput() @@ -291,6 +315,19 @@ void SbiParser::Name() { + // #i92642: Special handling to allow name as symbol + if( Peek() == EQ ) + { + aGen.Statement(); + + KeywordSymbolInfo aInfo; + aInfo.m_aKeywordSymbol = String( RTL_CONSTASCII_USTRINGPARAM( "name" ) ); + aInfo.m_eSbxDataType = GetType(); + aInfo.m_eTok = SYMBOL; + + Symbol( &aInfo ); + return; + } SbiExpression aExpr1( this ); TestToken( AS ); SbiExpression aExpr2( this ); diff -r 214156d907a1 basic/source/comp/parser.cxx --- a/basic/source/comp/parser.cxx Thu Jan 21 00:51:35 2010 +0100 +++ b/basic/source/comp/parser.cxx Mon Feb 08 12:01:01 2010 +0100 @@ -85,6 +85,7 @@ { IMPLEMENTS, &SbiParser::Implements, Y, N, }, // IMPLEMENTS { INPUT, &SbiParser::Input, N, Y, }, // INPUT { LET, &SbiParser::Assign, N, Y, }, // LET +{ LINE, &SbiParser::Line, N, Y, }, // LINE, -> LINE INPUT (#i92642) { LINEINPUT,&SbiParser::LineInput, N, Y, }, // LINE INPUT { LOOP, &SbiParser::BadBlock, N, Y, }, // LOOP { LSET, &SbiParser::LSet, N, Y, }, // LSET @@ -474,10 +475,10 @@ // Zuweisung oder Subroutine Call -void SbiParser::Symbol() +void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo ) { SbiExprMode eMode = bVBASupportOn ? EXPRMODE_STANDALONE : EXPRMODE_STANDARD; - SbiExpression aVar( this, SbSYMBOL, eMode ); + SbiExpression aVar( this, SbSYMBOL, eMode, pKeywordSymbolInfo ); bool bEQ = ( Peek() == EQ ); if( !bEQ && bVBASupportOn && aVar.IsBracket() ) @@ -742,12 +743,16 @@ break; } case COMPARE: - switch( Next() ) - { - case TEXT: bText = TRUE; return; - case BINARY: bText = FALSE; return; - default:; - } // Fall thru! + { + SbiToken eTok = Next(); + if( eTok == BINARY ) + bText = FALSE; + else if( eTok == SYMBOL && GetSym().EqualsIgnoreCaseAscii("text") ) + bText = TRUE; + else + Error( SbERR_EXPECTED, "Text/Binary" ); + break; + } case COMPATIBLE: EnableCompatibility(); break; diff -r 214156d907a1 basic/source/comp/token.cxx --- a/basic/source/comp/token.cxx Thu Jan 21 00:51:35 2010 +0100 +++ b/basic/source/comp/token.cxx Mon Feb 08 12:01:01 2010 +0100 @@ -516,7 +516,8 @@ tp = &pTokTable[ lb + delta ]; StringCompare res = aSym.CompareIgnoreCaseToAscii( tp->s ); // Gefunden? - if( res == COMPARE_EQUAL ) goto special; + if( res == COMPARE_EQUAL ) + goto special; // Groesser? Dann untere Haelfte if( res == COMPARE_LESS ) { @@ -537,24 +538,14 @@ return eCurTok = SYMBOL; } special: - // LINE INPUT - if( tp->t == LINE ) - { - short nC1 = nCol1; - String aOldSym = aSym; - eCurTok = Peek(); - if( eCurTok == INPUT ) - { - Next(); - nCol1 = nC1; - return eCurTok = LINEINPUT; - } - else - { - aSym = aOldSym; - return eCurTok = LINE; - } - } + // #i92642 + if( eCurTok != NIL && eCurTok != REM && eCurTok != EOLN && (tp->t == NAME || tp->t == LINE) ) + return eCurTok = SYMBOL; + else if( tp->t == TEXT ) + return eCurTok = SYMBOL; + + // #i92642: Special LINE token handling -> SbiParser::Line() + // END IF, CASE, SUB, DEF, FUNCTION, TYPE, CLASS, WITH if( tp->t == END ) { diff -r 214156d907a1 basic/source/inc/expr.hxx --- a/basic/source/inc/expr.hxx Thu Jan 21 00:51:35 2010 +0100 +++ b/basic/source/inc/expr.hxx Mon Feb 08 12:01:01 2010 +0100 @@ -55,6 +55,13 @@ SbiExprListVector* pvMorePar; // Array of arrays foo(pPar)(avMorePar[0])(avMorePar[1])... }; +struct KeywordSymbolInfo +{ + String m_aKeywordSymbol; + SbxDataType m_eSbxDataType; + SbiToken m_eTok; +}; + enum SbiExprType { // Expression-Typen: SbSTDEXPR, // normaler Ausdruck SbLVALUE, // beliebiger lValue @@ -169,7 +176,7 @@ BOOL bByVal; // TRUE: ByVal-Parameter BOOL bBracket; // TRUE: Parameter list with brackets USHORT nParenLevel; - SbiExprNode* Term(); + SbiExprNode* Term( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); SbiExprNode* ObjTerm( SbiSymDef& ); SbiExprNode* Operand(); SbiExprNode* Unary(); @@ -183,7 +190,8 @@ SbiExprNode* Comp(); SbiExprNode* Boolean(); public: - SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR, SbiExprMode eMode = EXPRMODE_STANDARD ); // Parsender Ctor + SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR, + SbiExprMode eMode = EXPRMODE_STANDARD, const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Parsender Ctor SbiExpression( SbiParser*, const String& ); SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE ); SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL ); diff -r 214156d907a1 basic/source/inc/parser.hxx --- a/basic/source/inc/parser.hxx Thu Jan 21 00:51:35 2010 +0100 +++ b/basic/source/inc/parser.hxx Mon Feb 08 12:01:01 2010 +0100 @@ -102,7 +102,7 @@ BOOL TestComma(); // Komma oder EOLN? void TestEoln(); // EOLN? - void Symbol(); // Let oder Call + void Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Let oder Call void ErrorStmnt(); // ERROR n void NotImp(); // nicht implementiert void BadBlock(); // LOOP/WEND/NEXT @@ -122,6 +122,7 @@ void If(); // IF void Implements(); // IMPLEMENTS void Input(); // INPUT, INPUT # + void Line(); // LINE -> LINE INPUT [#] (#i92642) void LineInput(); // LINE INPUT, LINE INPUT # void LSet(); // LSET void Name(); // NAME .. AS .. diff -r 214156d907a1 basic/source/runtime/stdobj.cxx --- a/basic/source/runtime/stdobj.cxx Thu Jan 21 00:51:35 2010 +0100 +++ b/basic/source/runtime/stdobj.cxx Mon Feb 08 12:01:01 2010 +0100 @@ -631,6 +631,10 @@ p += ( p->nArgs & _ARGSMASK ) + 1; } + // #i92642: Remove default properties + Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_DONTCARE ); + Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Parent") ), SbxCLASS_DONTCARE ); + SetParent( pb ); pStdFactory = new SbStdFactory;