Kaydet (Commit) 634b2116 authored tarafından Noel Power's avatar Noel Power

allow keyword Append to be used as a variable. bnc#745930

statements like
  Dim AppEnd As Integer
will generate compiler errors because Append is a special symbol/keyword in libreoffice basic. This restriction though is too strict because 'Append' is only such a keyword when used within the 'Open' statement ( where it refers to one of the possible values for a paramater ).
üst 136f53f5
...@@ -178,6 +178,7 @@ void SbiParser::Input() ...@@ -178,6 +178,7 @@ void SbiParser::Input()
void SbiParser::Open() void SbiParser::Open()
{ {
bInStatement = true;
SbiExpression aFileName( this ); SbiExpression aFileName( this );
SbiToken eTok; SbiToken eTok;
TestToken( FOR ); TestToken( FOR );
...@@ -273,6 +274,7 @@ void SbiParser::Open() ...@@ -273,6 +274,7 @@ void SbiParser::Open()
aGen.Gen( _OPEN, nMode, nFlags ); aGen.Gen( _OPEN, nMode, nFlags );
delete pLen; delete pLen;
delete pChan; delete pChan;
bInStatement = false;
} }
// NAME file AS file // NAME file AS file
......
...@@ -53,9 +53,10 @@ SbiScanner::SbiScanner( const ::rtl::OUString& rBuf, StarBASIC* p ) : aBuf( rBuf ...@@ -53,9 +53,10 @@ SbiScanner::SbiScanner( const ::rtl::OUString& rBuf, StarBASIC* p ) : aBuf( rBuf
bSymbol = bSymbol =
bCompatible = bCompatible =
bVBASupportOn = bVBASupportOn =
bPrevLineExtentsComment = sal_False; bInStatement =
bPrevLineExtentsComment = false;
bHash = bHash =
bErrors = sal_True; bErrors = true;
} }
SbiScanner::~SbiScanner() SbiScanner::~SbiScanner()
......
...@@ -401,6 +401,15 @@ special: ...@@ -401,6 +401,15 @@ special:
return eCurTok = SYMBOL; return eCurTok = SYMBOL;
else if( tp->t == TEXT ) else if( tp->t == TEXT )
return eCurTok = SYMBOL; return eCurTok = SYMBOL;
// maybe we can expand this for other statements that have parameters
// that are keywords ( and those keywords are only used within such
// statements )
// what's happening here is that if we come across 'append' ( and we are
// not in the middle of parsing a special statement ( like 'Open')
// we just treat keyword 'append' as a normal 'SYMBOL'.
// Also we accept Dim APPEND
else if ( ( !bInStatement || eCurTok == DIM ) && tp->t == APPEND )
return eCurTok = SYMBOL;
// #i92642: Special LINE token handling -> SbiParser::Line() // #i92642: Special LINE token handling -> SbiParser::Line()
......
...@@ -73,6 +73,7 @@ protected: ...@@ -73,6 +73,7 @@ protected:
bool bVBASupportOn; // sal_True: OPTION VBASupport 1 otherwise default False bool bVBASupportOn; // sal_True: OPTION VBASupport 1 otherwise default False
bool bPrevLineExtentsComment; // sal_True: Previous line is comment and ends on "... _" bool bPrevLineExtentsComment; // sal_True: Previous line is comment and ends on "... _"
bool bInStatement;
void GenError( SbError ); void GenError( SbError );
public: public:
SbiScanner( const ::rtl::OUString&, StarBASIC* = NULL ); SbiScanner( const ::rtl::OUString&, StarBASIC* = NULL );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment