summaryrefslogtreecommitdiff
path: root/basic/source/comp
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/comp')
-rw-r--r--basic/source/comp/exprtree.cxx186
-rw-r--r--basic/source/comp/io.cxx30
-rw-r--r--basic/source/comp/loops.cxx57
-rw-r--r--basic/source/comp/parser.cxx103
-rw-r--r--basic/source/comp/sbcomp.cxx12
-rw-r--r--basic/source/comp/scanner.cxx71
-rw-r--r--basic/source/comp/symtbl.cxx92
-rw-r--r--basic/source/comp/token.cxx69
8 files changed, 284 insertions, 336 deletions
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 31d285f89148..1c7ec1be4767 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -30,7 +30,7 @@
#include "precompiled_basic.hxx"
#include "sbcomp.hxx"
-#include <basic/sbx.hxx> // w.g. ...IMPL_REF(...sbxvariable)
+#include <basic/sbx.hxx> // because of ...IMPL_REF(...sbxvariable)
#include "expr.hxx"
/***************************************************************************
@@ -99,20 +99,20 @@ SbiExpression::~SbiExpression()
delete pExpr;
}
-// Einlesen eines kompletten Bezeichners
-// Ein Bezeichner hat folgende Form:
+// reading in a complete identifier
+// an identifier has the following form:
// name[(Parameter)][.Name[(parameter)]]...
-// Strukturelemente werden ueber das Element pNext verkoppelt,
-// damit sie nicht im Baum stehen.
+// structure elements are coupled via the element pNext,
+// so that they're not in the tree.
-// Folgen Parameter ohne Klammer? Dies kann eine Zahl, ein String,
-// ein Symbol oder auch ein Komma sein (wenn der 1. Parameter fehlt)
+// Are there parameters without brackets following? This may be a number,
+// a string, a symbol or also a comma (if the 1st parameter is missing)
static sal_Bool DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTok )
{
if( eTok == LPAREN )
return sal_True;
- // Aber nur, wenn CALL-aehnlich!
+ // but only if similar to CALL!
if( !p->WhiteSpace() || eCurExpr != SbSYMBOL )
return sal_False;
if ( eTok == NUMBER || eTok == MINUS || eTok == FIXSTRING
@@ -131,26 +131,26 @@ static sal_Bool DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken
return sal_False;
}
-// Definition eines neuen Symbols
+// definition of a new symbol
static SbiSymDef* AddSym
( SbiToken eTok, SbiSymPool& rPool, SbiExprType eCurExpr,
const String& rName, SbxDataType eType, SbiParameters* pPar )
{
SbiSymDef* pDef;
- // A= ist keine Prozedur
+ // A= is not a procedure
sal_Bool bHasType = sal_Bool( eTok == EQ || eTok == DOT );
if( ( !bHasType && eCurExpr == SbSYMBOL ) || pPar )
{
- // Dies ist also eine Prozedur
- // da suche man doch den richtigen Pool raus, da Procs
- // immer in einem Public-Pool landen muessen
+ // so this is a procedure
+ // the correct pool should be found out, as
+ // procs must always get into a public pool
SbiSymPool* pPool = &rPool;
if( pPool->GetScope() != SbPUBLIC )
pPool = &rPool.GetParser()->aPublics;
SbiProcDef* pProc = pPool->AddProc( rName );
- // Sonderbehandlung fuer Colls wie Documents(1)
+ // special treatment for Colls like Documents(1)
if( eCurExpr == SbSTDEXPR )
bHasType = sal_True;
@@ -158,7 +158,7 @@ static SbiSymDef* AddSym
pDef->SetType( bHasType ? eType : SbxEMPTY );
if( pPar )
{
- // Dummy-Parameter generieren
+ // generate dummy parameters
sal_uInt16 n = 1;
for( short i = 0; i < pPar->GetSize(); i++ )
{
@@ -170,22 +170,21 @@ static SbiSymDef* AddSym
}
else
{
- // oder ein normales Symbol
+ // or a normal symbol
pDef = rPool.AddSym( rName );
pDef->SetType( eType );
}
return pDef;
}
-// Zur Zeit sind sogar Keywords zugelassen (wg. gleichnamiger Dflt-Properties)
+// currently even keywords are allowed (because of Dflt properties of the same name)
SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
{
if( pParser->Peek() == DOT )
{
- // eine WITH-Variable
SbiExprNode* pWithVar = pParser->GetWithVar();
- // #26608: Ans Ende der Node-Kette gehen, um richtiges Objekt zu uebergeben
+ // #26608: get to the node-chain's end to pass the correct object
SbiSymDef* pDef = pWithVar ? pWithVar->GetRealVar() : NULL;
SbiExprNode* pNd = NULL;
if( !pDef )
@@ -207,23 +206,23 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
SbiToken eTok = (pKeywordSymbolInfo == NULL) ? pParser->Next() : pKeywordSymbolInfo->m_eTok;
- // Anfang des Parsings merken
+ // memorize the parsing's begin
pParser->LockColumn();
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?
+ // are there parameters following?
SbiToken eNextTok = pParser->Peek();
- // Ist es ein benannter Parameter?
- // Dann einfach eine Stringkonstante erzeugen. Diese wird
- // im SbiParameters-ctor erkannt und weiterverarbeitet
+ // is it a known parameter?
+ // create a string constant then, which will be recognized
+ // in the SbiParameters-ctor and is continued to be handled
if( eNextTok == ASSIGN )
{
pParser->UnlockColumn();
return new SbiExprNode( pParser, aSym );
}
- // ab hier sind keine Keywords zugelassen!
+ // no keywords allowed from here on!
if( pParser->IsKwd( eTok ) )
{
if( pParser->IsCompatible() && eTok == INPUT )
@@ -257,9 +256,9 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
eTok = pParser->Peek();
}
}
- // Es koennte ein Objektteil sein, wenn . oder ! folgt
- // Bei . muss aber die Variable bereits definiert sein; wenn pDef
- // nach der Suche NULL ist, isses ein Objekt!
+ // It might be an object part, if . or ! is following.
+ // In case of . the variable must already be defined;
+ // it's an object, if pDef is NULL after the search.
sal_Bool bObj = sal_Bool( ( eTok == DOT || eTok == EXCLAM )
&& !pParser->WhiteSpace() );
if( bObj )
@@ -269,18 +268,18 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
eType = SbxOBJECT;
else
{
- // Name%. geht wirklich nicht!
+ // Name%. really does not work!
pParser->Error( SbERR_BAD_DECLARATION, aSym );
bError = sal_True;
}
}
- // Suche:
+ // Search:
SbiSymDef* pDef = pParser->pPool->Find( aSym );
if( !pDef )
{
- // Teil der Runtime-Library?
- // AB 31.3.1996: In Parser-Methode ausgelagert
- // (wird auch in SbiParser::DefVar() in DIM.CXX benoetigt)
+ // Part of the Runtime-Library?
+ // from 31.3.1996: swapped out to parser-method
+ // (is also needed in SbiParser::DefVar() in DIM.CXX)
pDef = pParser->CheckRTLForSym( aSym, eType );
// #i109184: Check if symbol is or later will be defined inside module
@@ -291,8 +290,6 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
if( !pDef )
{
- // Falls ein Punkt angegeben war, isses Teil eines Objekts,
- // also muss der Returnwert ein Objekt sein
if( bObj )
eType = SbxOBJECT;
pDef = AddSym( eTok, *pParser->pPool, eCurExpr, aSym, eType, pPar );
@@ -305,8 +302,6 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
else
{
- // Symbol ist bereits definiert.
- // Ist es eine Konstante?
SbiConstDef* pConst = pDef->GetConstDef();
if( pConst )
{
@@ -315,9 +310,8 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
else
return new SbiExprNode( pParser, pConst->GetValue(), pConst->GetType() );
}
- // Hat es Dimensionen,
- // und sind auch Parameter angegeben?
- // (Wobei 0 Parameter () entsprechen)
+
+ // 0 parameters come up to ()
if( pDef->GetDims() )
{
if( pPar && pPar->GetSize() && pPar->GetSize() != pDef->GetDims() )
@@ -329,26 +323,26 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
// #119187 Only error if types conflict
if( eType >= SbxINTEGER && eType <= SbxSTRING && eType != eDefType )
{
- // Wie? Erst mit AS definieren und dann einen Suffix nehmen?
+ // How? Define with AS first and take a Suffix then?
pParser->Error( SbERR_BAD_DECLARATION, aSym );
bError = sal_True;
}
else if ( eType == SbxVARIANT )
- // Falls nix angegeben, den Typ des Eintrags nehmen
- // aber nur, wenn die Var nicht mit AS XXX definiert ist
- // damit erwischen wir n% = 5 : print n
+ // if there's nothing named, take the type of the entry,
+ // but only if the var hasn't been defined with AS XXX
+ // so that we catch n% = 5 : print n
eType = eDefType;
}
- // Typcheck bei Variablen:
- // ist explizit im Scanner etwas anderes angegeben?
- // Bei Methoden ist dies OK!
- if( eType != SbxVARIANT && // Variant nimmt alles
+ // checking type of variables:
+ // is there named anything different in the scanner?
+ // That's OK for methods!
+ if( eType != SbxVARIANT && // Variant takes everything
eType != pDef->GetType() &&
!pDef->GetProcDef() )
{
- // Es kann sein, dass pDef ein Objekt beschreibt, das bisher
- // nur als SbxVARIANT erkannt wurde, dann Typ von pDef aendern
- // AB, 16.12.95 (Vielleicht noch aehnliche Faelle moeglich ?!?)
+ // maybe pDef describes an object that so far has only been
+ // recognized as SbxVARIANT - then change type of pDef
+ // from 16.12.95 (similar cases possible perhaps?!?)
if( eType == SbxOBJECT && pDef->GetType() == SbxVARIANT )
{
pDef->SetType( SbxOBJECT );
@@ -367,11 +361,11 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
pNd->aVar.pvMorePar = pvMoreParLcl;
if( bObj )
{
- // AB, 8.1.95: Objekt kann auch vom Typ SbxVARIANT sein
+ // from 8.1.95: Object may also be of the type SbxVARIANT
if( pDef->GetType() == SbxVARIANT )
pDef->SetType( SbxOBJECT );
- // Falls wir etwas mit Punkt einscannen, muss der
- // Typ SbxOBJECT sein
+ // if we scan something with point,
+ // the type must be SbxOBJECT
if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT )
{
// defer error until runtime if in vba mode
@@ -384,13 +378,13 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
if( !bError )
pNd->aVar.pNext = ObjTerm( *pDef );
}
- // Merken der Spalte 1 wieder freigeben
+
pParser->UnlockColumn();
return pNd;
}
-// Aufbau eines Objekt-Terms. Ein derartiger Term ist Teil
-// eines Ausdrucks, der mit einer Objektvariablen beginnt.
+// construction of an object term. A term of this kind is part
+// of an expression that begins with an object variable.
SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
{
@@ -398,8 +392,8 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
SbiToken eTok = pParser->Next();
if( eTok != SYMBOL && !pParser->IsKwd( eTok ) && !pParser->IsExtra( eTok ) )
{
- // #66745 Einige Operatoren koennen in diesem Kontext auch
- // als Identifier zugelassen werden, wichtig fuer StarOne
+ // #66745 Some operators can also be allowed
+ // as identifiers, important for StarOne
if( eTok != MOD && eTok != NOT && eTok != AND && eTok != OR &&
eTok != XOR && eTok != EQV && eTok != IMP && eTok != IS )
{
@@ -416,7 +410,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
SbiParameters* pPar = NULL;
SbiExprListVector* pvMoreParLcl = NULL;
eTok = pParser->Peek();
- // Parameter?
+
if( DoParametersFollow( pParser, eCurExpr, eTok ) )
{
bool bStandaloneExpression = false;
@@ -443,13 +437,13 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
eType = SbxOBJECT;
else
{
- // Name%. geht wirklich nicht!
+ // Name%. does really not work!
pParser->Error( SbERR_BAD_DECLARATION, aSym );
bError = sal_True;
}
}
- // Der Symbol-Pool eines Objekts ist immer PUBLIC
+ // an object's symbol pool is always PUBLIC
SbiSymPool& rPool = rObj.GetPool();
rPool.SetScope( SbPUBLIC );
SbiSymDef* pDef = rPool.Find( aSym );
@@ -464,11 +458,6 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
pNd->aVar.pvMorePar = pvMoreParLcl;
if( bObj )
{
- // Falls wir etwas mit Punkt einscannen, muss der
- // Typ SbxOBJECT sein
-
- // Es kann sein, dass pDef ein Objekt beschreibt, das bisher
- // nur als SbxVARIANT erkannt wurde, dann Typ von pDef aendern
if( pDef->GetType() == SbxVARIANT )
pDef->SetType( SbxOBJECT );
@@ -486,20 +475,20 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
return pNd;
}
-// Als Operanden kommen in Betracht:
-// Konstante
-// skalare Variable
-// Strukturelemente
-// Array-Elemente
-// Funktionen
-// geklammerte Ausdruecke
+// an operand can be:
+// constant
+// scalar variable
+// structure elements
+// array elements
+// functions
+// bracketed expressions
SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf )
{
SbiExprNode *pRes;
SbiToken eTok;
- // Operand testen:
+ // test operand:
switch( eTok = pParser->Peek() )
{
case SYMBOL:
@@ -555,13 +544,13 @@ SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf )
pRes->bComposite = sal_True;
break;
default:
- // Zur Zeit sind Keywords hier OK!
+ // keywords here are OK at the moment!
if( pParser->IsKwd( eTok ) )
pRes = Term();
else
{
pParser->Next();
- pRes = new SbiExprNode( pParser, 1.0, SbxDOUBLE ); // bei Fehlern
+ pRes = new SbiExprNode( pParser, 1.0, SbxDOUBLE );
pParser->Error( SbERR_UNEXPECTED, eTok );
}
}
@@ -848,7 +837,7 @@ SbiExprNode* SbiExpression::Like()
SbiToken eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++;
}
- // Mehrere Operatoren hintereinander gehen nicht
+ // multiple operands in a row does not work
if( nCount > 1 && !pParser->IsVBASupportOn() )
{
pParser->Error( SbERR_SYNTAX );
@@ -882,9 +871,6 @@ SbiExprNode* SbiExpression::Boolean()
|*
***************************************************************************/
-// Parsing einer Expression, die sich zu einer numerischen
-// Konstanten verarbeiten laesst.
-
SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p )
{
if( pExpr->IsConstant() )
@@ -902,13 +888,12 @@ SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p )
}
else
{
- // #40204 Spezialbehandlung fuer sal_Bool-Konstanten
+ // #40204 special treatment for sal_Bool-constants
sal_Bool bIsBool = sal_False;
if( pExpr->eNodeType == SbxVARVAL )
{
SbiSymDef* pVarDef = pExpr->GetVar();
- // Ist es eine sal_Bool-Konstante?
sal_Bool bBoolVal = sal_False;
if( pVarDef->GetName().EqualsIgnoreCaseAscii( "true" ) )
{
@@ -922,7 +907,6 @@ SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p )
bBoolVal = sal_False;
}
- // Wenn es ein sal_Bool ist, Node austauschen
if( bIsBool )
{
delete pExpr;
@@ -988,7 +972,6 @@ SbiExprList::~SbiExprList()
}
}
-// Parameter anfordern (ab 0)
SbiExpression* SbiExprList::Get( short n )
{
@@ -1014,11 +997,11 @@ void SbiExprList::addExpression( SbiExpression* pExpr )
|*
***************************************************************************/
-// Parsender Konstruktor:
-// Die Parameterliste wird komplett geparst.
-// "Prozedurname()" ist OK.
-// Dann handelt es sich um eine Funktion ohne Parameter
-// respektive um die Angabe eines Arrays als Prozedurparameter.
+// parsing constructor:
+// the parameter list is completely parsed
+// "procedurename()" is OK
+// it's a function without parameters then
+// i. e. you give an array as procedure parameter
// #i79918/#i80532: bConst has never been set to true
// -> reused as bStandaloneExpression
@@ -1032,7 +1015,6 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
SbiExpression *pExpr;
SbiToken eTok = pParser->Peek();
- // evtl. Klammer auf weg:
bool bAssumeExprLParenMode = false;
bool bAssumeArrayMode = false;
if( eTok == LPAREN )
@@ -1049,25 +1031,25 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
}
}
- // Ende-Test
+
if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) )
{
if( eTok == RPAREN )
pParser->Next();
return;
}
- // Parametertabelle einlesen und in richtiger Folge ablegen!
+ // read in parameter table and lay down in correct order!
SbiExpression* pLast = NULL;
String aName;
while( !bError )
{
aName.Erase();
- // Fehlendes Argument
+ // missing argument
if( eTok == COMMA )
{
pExpr = new SbiExpression( pParser, 0, SbxEMPTY );
}
- // Benannte Argumente: entweder .name= oder name:=
+ // named arguments: either .name= or name:=
else
{
bool bByVal = false;
@@ -1117,7 +1099,7 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
if( pParser->Peek() == ASSIGN )
{
// VBA mode: name:=
- // SbiExpression::Term() hat einen String daraus gemacht
+ // SbiExpression::Term() has made as string out of it
aName = pExpr->GetString();
delete pExpr;
pParser->Next();
@@ -1137,7 +1119,7 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
if( bAssumeArrayMode )
break;
- // Naechstes Element?
+ // next element?
eTok = pParser->Peek();
if( eTok != COMMA )
{
@@ -1156,7 +1138,7 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
break;
}
}
- // Schliessende Klammer
+ // closing bracket
if( eTok == RPAREN )
{
pParser->Next();
@@ -1176,10 +1158,9 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
|*
***************************************************************************/
-// Parsender Konstruktor:
-// Eine Liste von Array-Dimensionen wird geparst. Die Ausdruecke werden
-// auf numerisch getestet. Das bCONST-Bit wird gesetzt, wenn alle Ausdruecke
-// Integer-Konstanten sind.
+// parsing constructor:
+// A list of array dimensions is parsed. The expressions are tested for being
+// numeric. The bCONST-Bit is reset when all expressions are Integer constants.
SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p )
{
@@ -1216,7 +1197,6 @@ SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p )
}
else
{
- // Nur eine Dim-Angabe
pExpr1->SetBased();
pExpr1->pNext = NULL;
bConst &= pExpr1->IsIntConstant();
diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx
index bc458e54305f..cff657adfb07 100644
--- a/basic/source/comp/io.cxx
+++ b/basic/source/comp/io.cxx
@@ -34,7 +34,7 @@
#include "sbcomp.hxx"
#include "iosys.hxx"
-// Test, ob ein I/O-Channel angegeben wurde
+// test if there's an I/O channel
sal_Bool SbiParser::Channel( sal_Bool bAlways )
{
@@ -54,15 +54,13 @@ sal_Bool SbiParser::Channel( sal_Bool bAlways )
return bRes;
}
-// Fuer PRINT und WRITE wird bei Objektvariablen versucht,
-// die Default-Property anzusprechen.
-
-// PRINT
+// it's tried that at object variables the Default-
+// Property is addressed for PRINT and WRITE
void SbiParser::Print()
{
sal_Bool bChan = Channel();
- // Die Ausdruecke zum Drucken:
+
while( !bAbort )
{
if( !IsEoln( Peek() ) )
@@ -93,7 +91,7 @@ void SbiParser::Print()
void SbiParser::Write()
{
sal_Bool bChan = Channel();
- // Die Ausdruecke zum Drucken:
+
while( !bAbort )
{
SbiExpression* pExpr = new SbiExpression( this );
@@ -153,7 +151,7 @@ void SbiParser::LineInput()
pExpr->Gen();
aGen.Gen( _LINPUT );
delete pExpr;
- aGen.Gen( _CHAN0 ); // ResetChannel() nicht mehr in StepLINPUT()
+ aGen.Gen( _CHAN0 ); // ResetChannel() not in StepLINPUT() anymore
}
// INPUT
@@ -178,7 +176,7 @@ void SbiParser::Input()
else break;
}
delete pExpr;
- aGen.Gen( _CHAN0 ); // ResetChannel() nicht mehr in StepINPUT()
+ aGen.Gen( _CHAN0 );
}
// OPEN stringexpr FOR mode ACCCESS access mode AS Channel [Len=n]
@@ -209,8 +207,8 @@ void SbiParser::Open()
{
Next();
eTok = Next();
- // Nur STREAM_READ,STREAM_WRITE-Flags in nMode beeinflussen
- nMode &= ~(STREAM_READ | STREAM_WRITE); // loeschen
+ // influence only STREAM_READ,STREAM_WRITE-Flags in nMode
+ nMode &= ~(STREAM_READ | STREAM_WRITE); // delete
if( eTok == READ )
{
if( Peek() == WRITE )
@@ -254,7 +252,7 @@ void SbiParser::Open()
default: break;
}
TestToken( AS );
- // Die Kanalnummer
+ // channel number
SbiExpression* pChan = new SbiExpression( this );
if( !pChan )
Error( SbERR_SYNTAX );
@@ -270,10 +268,10 @@ void SbiParser::Open()
}
}
if( !pLen ) pLen = new SbiExpression( this, 128, SbxINTEGER );
- // Der Stack fuer den OPEN-Befehl sieht wie folgt aus:
- // Blocklaenge
- // Kanalnummer
- // Dateiname
+ // the stack for the OPEN command looks as follows:
+ // block length
+ // channel number
+ // file name
pLen->Gen();
if( pChan )
pChan->Gen();
diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index c3e9159dac3b..392e3e9ccb5c 100644
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -37,18 +37,18 @@ void SbiParser::If()
{
sal_uInt32 nEndLbl;
SbiToken eTok = NIL;
- // Ende-Tokens ignorieren:
+ // ignore end-tokens
SbiExpression aCond( this );
aCond.Gen();
TestToken( THEN );
if( IsEoln( Next() ) )
{
- // Am Ende jeden Blocks muss ein Jump zu ENDIF
- // eingefuegt werden, damit bei ELSEIF nicht erneut die Bedingung
- // ausgewertet wird. Die Tabelle nimmt alle Absprungstellen auf.
+ // At the end of each block a jump to ENDIF must be inserted,
+ // so that the condition is not evaluated again at ELSEIF.
+ // The table collects all jump points.
#define JMP_TABLE_SIZE 100
- sal_uInt32 pnJmpToEndLbl[JMP_TABLE_SIZE]; // 100 ELSEIFs zulaessig
- sal_uInt16 iJmp = 0; // aktueller Tabellen-Index
+ sal_uInt32 pnJmpToEndLbl[JMP_TABLE_SIZE]; // 100 ELSEIFs allowed
+ sal_uInt16 iJmp = 0; // current table index
// multiline IF
nEndLbl = aGen.Gen( _JUMPF, 0 );
@@ -64,7 +64,7 @@ void SbiParser::If()
}
while( eTok == ELSEIF )
{
- // Bei erfolgreichem IF/ELSEIF auf ENDIF springen
+ // jump to ENDIF in case of a successful IF/ELSEIF
if( iJmp >= JMP_TABLE_SIZE )
{
Error( SbERR_PROG_TOO_LARGE ); bAbort = sal_True; return;
@@ -104,7 +104,7 @@ void SbiParser::If()
else if( eTok == ENDIF )
Next();
- // Jmp-Tabelle abarbeiten
+
while( iJmp > 0 )
{
iJmp--;
@@ -143,7 +143,7 @@ void SbiParser::If()
aGen.BackChain( nEndLbl );
}
-// ELSE/ELSEIF/ENDIF ohne IF
+// ELSE/ELSEIF/ENDIF without IF
void SbiParser::NoIf()
{
@@ -213,7 +213,7 @@ void SbiParser::For()
if( bForEach )
Next();
SbiExpression aLvalue( this, SbOPERAND );
- aLvalue.Gen(); // Variable auf dem Stack
+ aLvalue.Gen(); // variable on the Stack
if( bForEach )
{
@@ -227,10 +227,10 @@ void SbiParser::For()
{
TestToken( EQ );
SbiExpression aStartExpr( this );
- aStartExpr.Gen(); // Startausdruck auf dem Stack
+ aStartExpr.Gen();
TestToken( TO );
SbiExpression aStopExpr( this );
- aStopExpr.Gen(); // Endausdruck auf dem Stack
+ aStopExpr.Gen();
if( Peek() == STEP )
{
Next();
@@ -243,19 +243,19 @@ void SbiParser::For()
aOne.Gen();
}
TestEoln();
- // Der Stack hat jetzt 4 Elemente: Variable, Start, Ende, Inkrement
- // Startwert binden
+ // The stack has all 4 elements now: variable, start, end, increment
+ // bind start value
aGen.Gen( _INITFOR );
}
sal_uInt32 nLoop = aGen.GetPC();
- // Test durchfuehren, evtl. Stack freigeben
+ // do tests, maybe free the stack
sal_uInt32 nEndTarget = aGen.Gen( _TESTFOR, 0 );
OpenBlock( FOR );
StmntBlock( NEXT );
aGen.Gen( _NEXT );
aGen.Gen( _JUMP, nLoop );
- // Kommen Variable nach NEXT?
+ // are there variables after NEXT?
if( Peek() == SYMBOL )
{
SbiExpression aVar( this, SbOPERAND );
@@ -272,16 +272,15 @@ void SbiParser::With()
{
SbiExpression aVar( this, SbOPERAND );
- // Letzten Knoten in der Objekt-Kette ueberpruefen
SbiExprNode *pNode = aVar.GetExprNode()->GetRealNode();
SbiSymDef* pDef = pNode->GetVar();
- // Variant, AB 27.6.1997, #41090: bzw. empty -> muß Object sein
+ // Variant, from 27.6.1997, #41090: empty -> must be Object
if( pDef->GetType() == SbxVARIANT || pDef->GetType() == SbxEMPTY )
pDef->SetType( SbxOBJECT );
else if( pDef->GetType() != SbxOBJECT )
Error( SbERR_NEEDS_OBJECT );
- // Knoten auch auf SbxOBJECT setzen, damit spaeter Gen() klappt
+
pNode->SetType( SbxOBJECT );
OpenBlock( NIL, aVar.GetExprNode() );
@@ -289,7 +288,7 @@ void SbiParser::With()
CloseBlock();
}
-// LOOP/NEXT/WEND ohne Konstrukt
+// LOOP/NEXT/WEND without construct
void SbiParser::BadBlock()
{
@@ -312,11 +311,11 @@ void SbiParser::OnGoto()
Error( SbERR_EXPECTED, "GoTo/GoSub" );
eTok = GOTO;
}
- // Label-Tabelle einlesen:
+
sal_uInt32 nLbl = 0;
do
{
- Next(); // Label holen
+ Next(); // get label
if( MayBeLabel() )
{
sal_uInt32 nOff = pProc->GetLabels().Reference( aSym );
@@ -371,7 +370,7 @@ void SbiParser::Select()
sal_uInt32 nNextTarget = 0;
sal_uInt32 nDoneTarget = 0;
sal_Bool bElse = sal_False;
- // Die Cases einlesen:
+
while( !bAbort )
{
eTok = Next();
@@ -380,7 +379,7 @@ void SbiParser::Select()
if( nNextTarget )
aGen.BackChain( nNextTarget ), nNextTarget = 0;
aGen.Statement();
- // Jeden Case einlesen
+
sal_Bool bDone = sal_False;
sal_uInt32 nTrueTarget = 0;
if( Peek() == ELSE )
@@ -429,13 +428,13 @@ void SbiParser::Select()
if( Peek() == COMMA ) Next();
else TestEoln(), bDone = sal_True;
}
- // Alle Cases abgearbeitet
+
if( !bElse )
{
nNextTarget = aGen.Gen( _JUMP, nNextTarget );
aGen.BackChain( nTrueTarget );
}
- // den Statement-Rumpf bauen
+ // build the statement body
while( !bAbort )
{
eTok = Peek();
@@ -472,14 +471,14 @@ void SbiParser::On()
SbiToken eTok = Peek();
String aString = SbiTokenizer::Symbol(eTok);
if (aString.EqualsIgnoreCaseAscii("ERROR"))
- eTok = _ERROR_; // Error kommt als SYMBOL
+ eTok = _ERROR_; // Error comes as SYMBOL
if( eTok != _ERROR_ && eTok != LOCAL ) OnGoto();
else
{
if( eTok == LOCAL ) Next();
- Next (); // Kein TestToken mehr, da es sonst einen Fehler gibt
+ Next (); // no more TestToken, as there'd be an error otherwise
- Next(); // Token nach Error holen
+ Next(); // get token after error
if( eCurTok == GOTO )
{
// ON ERROR GOTO label|0
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 2ea78357882f..b8fb78f366d0 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -32,18 +32,18 @@
#include "sbcomp.hxx"
#include <com/sun/star/script/ModuleType.hpp>
-struct SbiParseStack { // "Stack" fuer Statement-Blocks
+struct SbiParseStack { // "Stack" for statement-blocks
SbiParseStack* pNext; // Chain
- SbiExprNode* pWithVar; // Variable fuer WITH
- SbiToken eExitTok; // Exit-Token
+ SbiExprNode* pWithVar;
+ SbiToken eExitTok;
sal_uInt32 nChain; // JUMP-Chain
};
struct SbiStatement {
SbiToken eTok;
- void( SbiParser::*Func )(); // Verarbeitungsroutine
- sal_Bool bMain; // sal_True: ausserhalb SUBs OK
- sal_Bool bSubr; // sal_True: in SUBs OK
+ void( SbiParser::*Func )();
+ sal_Bool bMain; // sal_True: OK outside the SUB
+ sal_Bool bSubr; // sal_True: OK inside the SUB
};
#define Y sal_True
@@ -148,16 +148,16 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
OSL_TRACE("Parser - %s, bClassModule %d", rtl::OUStringToOString( pm->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), bClassModule );
pPool = &aPublics;
for( short i = 0; i < 26; i++ )
- eDefTypes[ i ] = SbxVARIANT; // Kein expliziter Defaulttyp
+ eDefTypes[ i ] = SbxVARIANT; // no explicit default type
aPublics.SetParent( &aGlobals );
aGlobals.SetParent( &aRtlSyms );
- // Die globale Chainkette faengt bei Adresse 0 an:
+
nGblChain = aGen.Gen( _JUMP, 0 );
- rTypeArray = new SbxArray; // Array fuer Benutzerdefinierte Typen
- rEnumArray = new SbxArray; // Array for Enum types
+ rTypeArray = new SbxArray; // array for user defined types
+ rEnumArray = new SbxArray; // array for Enum types
bVBASupportOn = pm->IsVBACompat();
if ( bVBASupportOn )
EnableCompatibility();
@@ -165,7 +165,7 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
}
-// Ist Teil der Runtime-Library?
+// part of the runtime-library?
SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType )
{
SbxVariable* pVar = GetBasic()->GetRtl()->Find( rSym, SbxCLASS_DONTCARE );
@@ -187,7 +187,7 @@ SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType )
return pDef;
}
-// Globale Chainkette schliessen
+// close global chain
sal_Bool SbiParser::HasGlobalCode()
{
@@ -210,7 +210,7 @@ void SbiParser::OpenBlock( SbiToken eTok, SbiExprNode* pVar )
pStack = p;
pWithVar = pVar;
- // #29955 for-Schleifen-Ebene pflegen
+ // #29955 service the for-loop level
if( eTok == FOR )
aGen.IncForLevel();
}
@@ -221,7 +221,7 @@ void SbiParser::CloseBlock()
{
SbiParseStack* p = pStack;
- // #29955 for-Schleifen-Ebene pflegen
+ // #29955 service the for-loop level
if( p->eExitTok == FOR )
aGen.DecForLevel();
@@ -264,7 +264,7 @@ sal_Bool SbiParser::TestSymbol( sal_Bool bKwdOk )
return sal_False;
}
-// Testen auf ein bestimmtes Token
+
sal_Bool SbiParser::TestToken( SbiToken t )
{
@@ -279,7 +279,7 @@ sal_Bool SbiParser::TestToken( SbiToken t )
}
}
-// Testen auf Komma oder EOLN
+
sal_Bool SbiParser::TestComma()
{
@@ -298,7 +298,7 @@ sal_Bool SbiParser::TestComma()
return sal_True;
}
-// Testen, ob EOLN vorliegt
+
void SbiParser::TestEoln()
{
@@ -309,8 +309,7 @@ void SbiParser::TestEoln()
}
}
-// Parsing eines Statement-Blocks
-// Das Parsing laeuft bis zum Ende-Token.
+
void SbiParser::StmntBlock( SbiToken eEnd )
{
@@ -325,8 +324,7 @@ void SbiParser::StmntBlock( SbiToken eEnd )
}
}
-// Die Hauptroutine. Durch wiederholten Aufrufs dieser Routine wird
-// die Quelle geparst. Returnwert sal_False bei Ende/Fehlern.
+
sal_Bool SbiParser::Parse()
{
@@ -337,19 +335,19 @@ sal_Bool SbiParser::Parse()
bErrorIsSymbol = false;
Peek();
bErrorIsSymbol = true;
- // Dateiende?
+
if( IsEof() )
{
- // AB #33133: Falls keine Sub angelegt wurde, muss hier
- // der globale Chain abgeschlossen werden!
- // AB #40689: Durch die neue static-Behandlung kann noch
- // ein nGblChain vorhanden sein, daher vorher abfragen
+ // AB #33133: If no sub has been created before,
+ // the global chain must be closed here!
+ // AB #40689: Due to the new static-handling there
+ // can be another nGblChain, so ask for it before.
if( bNewGblDefs && nGblChain == 0 )
nGblChain = aGen.Gen( _JUMP, 0 );
return sal_False;
}
- // Leerstatement?
+
if( IsEoln( eCurTok ) )
{
Next(); return sal_True;
@@ -357,20 +355,20 @@ sal_Bool SbiParser::Parse()
if( !bSingleLineIf && MayBeLabel( sal_True ) )
{
- // Ist ein Label
+ // is a label
if( !pProc )
Error( SbERR_NOT_IN_MAIN, aSym );
else
pProc->GetLabels().Define( aSym );
Next(); Peek();
- // Leerstatement?
+
if( IsEoln( eCurTok ) )
{
Next(); return sal_True;
}
}
- // Ende des Parsings?
+ // end of parsing?
if( eCurTok == eEndTok ||
( bVBASupportOn && // #i109075
(eCurTok == ENDFUNC || eCurTok == ENDPROPERTY || eCurTok == ENDSUB) &&
@@ -382,7 +380,7 @@ sal_Bool SbiParser::Parse()
return sal_False;
}
- // Kommentar?
+ // comment?
if( eCurTok == REM )
{
Next(); return sal_True;
@@ -400,16 +398,16 @@ sal_Bool SbiParser::Parse()
ePush = eCurTok;
}
}
- // Kommt ein Symbol, ist es entweder eine Variable( LET )
- // oder eine SUB-Prozedur( CALL ohne Klammern )
- // DOT fuer Zuweisungen im WITH-Block: .A=5
+ // if there's a symbol, it's either a variable (LET)
+ // or a SUB-procedure (CALL without brackets)
+ // DOT for assignments in the WITH-block: .A=5
if( eCurTok == SYMBOL || eCurTok == DOT )
{
if( !pProc )
Error( SbERR_EXPECTED, SUB );
else
{
- // Damit Zeile & Spalte stimmen...
+ // for correct line and column...
Next();
Push( eCurTok );
aGen.Statement();
@@ -420,7 +418,7 @@ sal_Bool SbiParser::Parse()
{
Next();
- // Hier folgen nun die Statement-Parser.
+ // statement parsers
SbiStatement* p;
for( p = StmntTable; p->eTok != NIL; p++ )
@@ -434,16 +432,15 @@ sal_Bool SbiParser::Parse()
Error( SbERR_NOT_IN_SUBR, eCurTok );
else
{
- // globalen Chain pflegen
- // AB #41606/#40689: Durch die neue static-Behandlung kann noch
- // ein nGblChain vorhanden sein, daher vorher abfragen
+ // AB #41606/#40689: Due to the new static-handling there
+ // can be another nGblChain, so ask for it before.
if( bNewGblDefs && nGblChain == 0 &&
( eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY ) )
{
nGblChain = aGen.Gen( _JUMP, 0 );
bNewGblDefs = sal_False;
}
- // Statement-Opcode bitte auch am Anfang einer Sub
+ // statement-opcode at the beginning of a sub, too, please
if( ( p->bSubr && (eCurTok != STATIC || Peek() == SUB || Peek() == FUNCTION ) ) ||
eCurTok == SUB || eCurTok == FUNCTION )
aGen.Statement();
@@ -457,35 +454,34 @@ sal_Bool SbiParser::Parse()
Error( SbERR_UNEXPECTED, eCurTok );
}
- // Test auf Ende des Statements:
- // Kann auch ein ELSE sein, da vor dem ELSE kein : stehen muss!
+ // test for the statement's end -
+ // might also be an ELSE, as there must not neccessary be a : before the ELSE!
if( !IsEos() )
{
Peek();
if( !IsEos() && eCurTok != ELSE )
{
- // falls das Parsing abgebrochen wurde, bis zum ":" vorgehen:
+ // if the parsing has been aborted, jump over to the ":"
Error( SbERR_UNEXPECTED, eCurTok );
while( !IsEos() ) Next();
}
}
- // Der Parser bricht am Ende ab, das naechste Token ist noch nicht
- // geholt!
+ // The parser aborts at the end, the
+ // next token has not been fetched yet!
return sal_True;
}
-// Innerste With-Variable liefern
+
SbiExprNode* SbiParser::GetWithVar()
{
if( pWithVar )
return pWithVar;
- // Sonst im Stack suchen
SbiParseStack* p = pStack;
while( p )
{
- // LoopVar kann zur Zeit nur fuer with sein
+ // LoopVar can at the moment only be for with
if( p->pWithVar )
return p->pWithVar;
p = p->pNext;
@@ -494,7 +490,7 @@ SbiExprNode* SbiParser::GetWithVar()
}
-// Zuweisung oder Subroutine Call
+// assignment or subroutine call
void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
{
@@ -540,7 +536,7 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
else
{
- // Dann muss es eine Zuweisung sein. Was anderes gibts nicht!
+ // so it must be an assignment!
if( !aVar.IsLvalue() )
Error( SbERR_LVALUE_EXPECTED );
TestToken( EQ );
@@ -566,7 +562,6 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
}
-// Zuweisungen
void SbiParser::Assign()
{
@@ -587,7 +582,7 @@ void SbiParser::Assign()
aGen.Gen( _PUT );
}
-// Zuweisungen einer Objektvariablen
+// assignments of an object-variable
void SbiParser::Set()
{
@@ -671,7 +666,7 @@ void SbiParser::RSet()
aGen.Gen( _RSET );
}
-// DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFSTR und so weiter
+// DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFSTR and so on
void SbiParser::DefXXX()
{
@@ -705,7 +700,7 @@ void SbiParser::DefXXX()
void SbiParser::Stop()
{
aGen.Gen( _STOP );
- Peek(); // #35694: Nur Peek(), damit EOL in Single-Line-If erkannt wird
+ Peek(); // #35694: only Peek(), so that EOL is recognized in Single-Line-If
}
// IMPLEMENTS
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index 86557db46699..b2cba95a5344 100644
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -903,8 +903,8 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
#endif
-// Diese Routine ist hier definiert, damit der Compiler als eigenes Segment
-// geladen werden kann.
+// This routine is defined here, so that the
+// compiler can be loaded as a discrete segment.
sal_Bool SbModule::Compile()
{
@@ -914,7 +914,7 @@ sal_Bool SbModule::Compile()
if( !pBasic )
return sal_False;
SbxBase::ResetError();
- // Aktuelles Modul!
+
SbModule* pOld = pCMOD;
pCMOD = this;
@@ -923,14 +923,14 @@ sal_Bool SbModule::Compile()
if( !pParser->GetErrors() )
pParser->aGen.Save();
delete pParser;
- // fuer den Disassembler
+ // for the disassembler
if( pImage )
pImage->aOUSource = aOUSource;
pCMOD = pOld;
- // Beim Compilieren eines Moduls werden die Modul-globalen
- // Variablen aller Module ungueltig
+ // compiling a module, the module-global
+ // variables of all modules become invalid
sal_Bool bRet = IsCompiled();
if( bRet )
{
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 11c081d1b4b2..1dec4db83caa 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -97,12 +97,12 @@ void SbiScanner::GenError( SbError code )
if( !bError && bErrors )
{
sal_Bool bRes = sal_True;
- // Nur einen Fehler pro Statement reporten
+ // report only one error per statement
bError = sal_True;
if( pBasic )
{
- // Falls EXPECTED oder UNEXPECTED kommen sollte, bezieht es sich
- // immer auf das letzte Token, also die Col1 uebernehmen
+ // in case of EXPECTED or UNEXPECTED it always refers
+ // to the last token, so take the Col1 over
sal_uInt16 nc = nColLock ? nSavedCol1 : nCol1;
switch( code )
{
@@ -123,8 +123,8 @@ void SbiScanner::GenError( SbError code )
nErrors++;
}
-// Falls sofort ein Doppelpunkt folgt, wird sal_True zurueckgeliefert.
-// Wird von SbiTokenizer::MayBeLabel() verwendet, um einen Label zu erkennen
+
+// used by SbiTokenizer::MayBeLabel() to detect a label
sal_Bool SbiScanner::DoesColonFollow()
{
@@ -135,7 +135,7 @@ sal_Bool SbiScanner::DoesColonFollow()
else return sal_False;
}
-// Testen auf ein legales Suffix
+// test for legal suffix
static SbxDataType GetSuffixType( sal_Unicode c )
{
@@ -149,8 +149,8 @@ static SbxDataType GetSuffixType( sal_Unicode c )
return SbxVARIANT;
}
-// Einlesen des naechsten Symbols in die Variablen aSym, nVal und eType
-// Returnwert ist sal_False bei EOF oder Fehlern
+// reading the next symbol into the variables aSym, nVal and eType
+// return value is sal_False at EOF or errors
#define BUF_SIZE 80
namespace {
@@ -165,7 +165,7 @@ inline bool lclIsWhitespace( sal_Unicode cChar )
sal_Bool SbiScanner::NextSym()
{
- // Fuer den EOLN-Fall merken
+ // memorize for the EOLN-case
sal_uInt16 nOldLine = nLine;
sal_uInt16 nOldCol1 = nCol1;
sal_uInt16 nOldCol2 = nCol2;
@@ -177,7 +177,7 @@ sal_Bool SbiScanner::NextSym()
bSymbol =
bNumber = bSpaces = sal_False;
- // Zeile einlesen?
+ // read in line?
if( !pLine )
{
sal_Int32 n = nBufPos;
@@ -207,13 +207,13 @@ sal_Bool SbiScanner::NextSym()
nColLock = 0;
}
- // Leerstellen weg:
+
while( lclIsWhitespace( *pLine ) )
pLine++, nCol++, bSpaces = sal_True;
nCol1 = nCol;
- // nur Leerzeile?
+ // only blank line?
if( !*pLine )
goto eoln;
@@ -227,10 +227,10 @@ sal_Bool SbiScanner::NextSym()
bHash = sal_True;
}
- // Symbol? Dann Zeichen kopieren.
+ // copy character if symbol
if( BasicSimpleCharClass::isAlpha( *pLine, bCompatible ) || *pLine == '_' )
{
- // Wenn nach '_' nichts kommt, ist es ein Zeilenabschluss!
+ // if there's nothing behind '_' , it's the end of a line!
if( *pLine == '_' && !*(pLine+1) )
{ pLine++;
goto eoln; }
@@ -263,16 +263,16 @@ sal_Bool SbiScanner::NextSym()
}
}
- // Abschliessendes '_' durch Space ersetzen, wenn Zeilenende folgt
- // (sonst falsche Zeilenfortsetzung)
+ // replace closing '_' by space when end of line is following
+ // (wrong line continuation otherwise)
if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' )
{
aSym.GetBufferAccess(); // #109693 force copy if necessary
- *((sal_Unicode*)(pLine-1)) = ' '; // cast wegen const
+ *((sal_Unicode*)(pLine-1)) = ' '; // cast because of const
}
- // Typkennung?
- // Das Ausrufezeichen bitte nicht testen, wenn
- // danach noch ein Symbol anschliesst
+ // type recognition?
+ // don't test the exclamation mark
+ // if there's a symbol behind it
else if( *pLine != '!' || !BasicSimpleCharClass::isAlpha( pLine[ 1 ], bCompatible ) )
{
SbxDataType t = GetSuffixType( *pLine );
@@ -285,7 +285,7 @@ sal_Bool SbiScanner::NextSym()
}
}
- // Zahl? Dann einlesen und konvertieren.
+ // read in and convert if number
else if( BasicSimpleCharClass::isDigit( *pLine & 0xFF )
|| ( *pLine == '.' && BasicSimpleCharClass::isDigit( *(pLine+1) & 0xFF ) ) )
{
@@ -297,14 +297,14 @@ sal_Bool SbiScanner::NextSym()
sal_Bool bBufOverflow = sal_False;
while( strchr( "0123456789.DEde", *pLine ) && *pLine )
{
- // AB 4.1.1996: Buffer voll? -> leer weiter scannen
+ // from 4.1.1996: buffer full? -> go on scanning empty
if( (p-buf) == (BUF_SIZE-1) )
{
bBufOverflow = sal_True;
pLine++, nCol++;
continue;
}
- // Komma oder Exponent?
+ // point or exponent?
if( *pLine == '.' )
{
if( ++comma > 1 )
@@ -320,7 +320,7 @@ sal_Bool SbiScanner::NextSym()
pLine++; nCol++; continue;
}
*p++ = 'E'; pLine++; nCol++;
- // Vorzeichen hinter Exponent?
+
if( *pLine == '+' )
pLine++, nCol++;
else
@@ -336,12 +336,12 @@ sal_Bool SbiScanner::NextSym()
}
*p = 0;
aSym = p; bNumber = sal_True;
- // Komma, Exponent mehrfach vorhanden?
+
if( comma > 1 || exp > 1 )
{ aError = '.';
GenError( SbERR_BAD_CHAR_IN_NUMBER ); }
- // #57844 Lokalisierte Funktion benutzen
+ // #57844 use localized function
nVal = rtl_math_uStringToDouble( buf, buf+(p-buf), '.', ',', NULL, NULL );
ndig = ndig - comma;
@@ -356,7 +356,7 @@ sal_Bool SbiScanner::NextSym()
if( bBufOverflow )
GenError( SbERR_MATH_OVERFLOW );
- // Typkennung?
+ // type recognition?
SbxDataType t = GetSuffixType( *pLine );
if( t != SbxVARIANT )
{
@@ -366,7 +366,7 @@ sal_Bool SbiScanner::NextSym()
}
}
- // Hex/Oktalzahl? Einlesen und konvertieren:
+ // Hex/octal number? Read in and convert:
else if( *pLine == '&' )
{
pLine++; nCol++;
@@ -383,7 +383,7 @@ sal_Bool SbiScanner::NextSym()
case 'H':
break;
default :
- // Wird als Operator angesehen
+ // treated as an operator
pLine--; nCol--; nCol1 = nCol-1; aSym = '&'; return SYMBOL;
}
bNumber = sal_True;
@@ -395,7 +395,7 @@ sal_Bool SbiScanner::NextSym()
sal_Unicode ch = sal::static_int_cast< sal_Unicode >(
toupper( *pLine & 0xFF ) );
pLine++; nCol++;
- // AB 4.1.1996: Buffer voll, leer weiter scannen
+ // from 4.1.1996: buffer full, go on scanning empty
if( (p-buf) == (BUF_SIZE-1) )
bBufOverflow = sal_True;
else if( String( cmp ).Search( ch ) != STRING_NOTFOUND )
@@ -447,7 +447,7 @@ sal_Bool SbiScanner::NextSym()
aSym = aLine.copy( n - 1, nCol - n + 1);
else
aSym = aLine.copy( n, nCol - n - 1 );
- // Doppelte Stringbegrenzer raus
+ // get out duplicate string delimiters
String s( cSep );
s += cSep;
sal_uInt16 nIdx = 0;
@@ -463,12 +463,12 @@ sal_Bool SbiScanner::NextSym()
if( cSep != ']' )
eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING;
}
- // ungueltige Zeichen:
+ // invalid characters:
else if( ( *pLine & 0xFF ) >= 0x7F )
{
GenError( SbERR_SYNTAX ); pLine++; nCol++;
}
- // andere Gruppen:
+ // other groups:
else
{
short n = 1;
@@ -485,7 +485,7 @@ sal_Bool SbiScanner::NextSym()
nCol2 = nCol-1;
PrevLineCommentLbl:
- // Kommentar?
+
if( bPrevLineExtentsComment || (eScanType != SbxSTRING &&
( aSym.GetBuffer()[0] == '\'' || aSym.EqualsIgnoreCaseAscii( "REM" ) ) ) )
{
@@ -499,8 +499,7 @@ PrevLineCommentLbl:
}
return sal_True;
- // Sonst Zeilen-Ende: aber bitte auf '_' testen, ob die
- // Zeile nicht weitergeht!
+
eoln:
if( nCol && *--pLine == '_' )
{
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 128c4acf52fc..4e6e93283c2b 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -37,11 +37,11 @@
SV_IMPL_PTRARR(SbiStrings,String*)
SV_IMPL_PTRARR(SbiSymbols,SbiSymDef*)
-// Alle Symbolnamen werden im Stringpool des Symbol-Pools abgelegt, damit
-// alle Symbole im gleichen Case verarbeitet werden. Beim Speichern des
-// Code-Images wird der globale Stringpool mit den entsprechenden Sympools
-// gespeichert. Der lokale Stringpool nimmt alle Symbole auf, die nicht
-// ins Image wandern (Labels, Konstantennamen etc).
+// All symbol names are laid down int the symbol-pool's stringpool, so that
+// all symbols are handled in the same case. On saving the code-image, the
+// global stringpool with the respective symbols is also saved.
+// The local stringpool holds all the symbols that don't move to the image
+// (labels, constant names etc.).
/***************************************************************************
|*
@@ -57,7 +57,6 @@ SbiStringPool::SbiStringPool( SbiParser* p )
SbiStringPool::~SbiStringPool()
{}
-// Suchen
const String& SbiStringPool::Find( sal_uInt16 n ) const
{
@@ -67,8 +66,7 @@ const String& SbiStringPool::Find( sal_uInt16 n ) const
return *aData.GetObject( n-1 );
}
-// Hinzufuegen eines Strings. Der String wird Case-Insensitiv
-// verglichen.
+
short SbiStringPool::Add( const String& rVal, sal_Bool bNoCase )
{
@@ -117,7 +115,6 @@ SbiSymPool::SbiSymPool( SbiStringPool& r, SbiSymScope s ) : rStrings( r )
SbiSymPool::~SbiSymPool()
{}
-// Inhalt loeschen
void SbiSymPool::Clear()
{
@@ -138,7 +135,6 @@ SbiSymDef* SbiSymPool::Next()
return aData.GetObject( nCur );
}
-// Hinzufuegen eines Symbols
SbiSymDef* SbiSymPool::AddSym( const String& rName )
{
@@ -157,7 +153,7 @@ SbiProcDef* SbiSymPool::AddProc( const String& rName )
SbiProcDef* p = new SbiProcDef( pParser, rName );
p->nPos = aData.Count();
p->nId = rStrings.Add( rName );
- // Procs sind immer global
+ // procs are always local
p->nProcId = 0;
p->pIn = this;
const SbiSymDef* q = p;
@@ -165,7 +161,7 @@ SbiProcDef* SbiSymPool::AddProc( const String& rName )
return p;
}
-// Hinzufuegen einer extern aufgebauten Symboldefinition
+// adding an externally constructed symbol definition
void SbiSymPool::Add( SbiSymDef* pDef )
{
@@ -174,7 +170,7 @@ void SbiSymPool::Add( SbiSymDef* pDef )
if( pDef->pIn )
{
#ifdef DBG_UTIL
- // schon in einem anderen Pool drin!
+
pParser->Error( SbERR_INTERNAL_ERROR, "Dbl Pool" );
#endif
return;
@@ -183,8 +179,8 @@ void SbiSymPool::Add( SbiSymDef* pDef )
pDef->nPos = aData.Count();
if( !pDef->nId )
{
- // Bei statischen Variablen muss ein eindeutiger Name
- // im Stringpool erzeugt werden (Form ProcName:VarName)
+ // A unique name must be created in the string pool
+ // for static variables (Form ProcName:VarName)
String aName( pDef->aName );
if( pDef->IsStatic() )
{
@@ -194,7 +190,7 @@ void SbiSymPool::Add( SbiSymDef* pDef )
}
pDef->nId = rStrings.Add( aName );
}
- // Procs sind immer global
+
if( !pDef->GetProcDef() )
pDef->nProcId = nProcId;
pDef->pIn = this;
@@ -203,7 +199,6 @@ void SbiSymPool::Add( SbiSymDef* pDef )
}
}
-// Suchen eines Eintrags ueber den Namen. Es wird auch im Parent gesucht.
SbiSymDef* SbiSymPool::Find( const String& rName ) const
{
@@ -221,7 +216,6 @@ SbiSymDef* SbiSymPool::Find( const String& rName ) const
return NULL;
}
-// Suchen ueber ID-Nummer
SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const
{
@@ -237,7 +231,7 @@ SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const
return NULL;
}
-// Suchen ueber Position (ab 0)
+// find via position (from 0)
SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const
{
@@ -264,12 +258,11 @@ sal_uInt32 SbiSymPool::Reference( const String& rName )
SbiSymDef* p = Find( rName );
if( !p )
p = AddSym( rName );
- //Sicherheitshalber
+ // to be sure
pParser->aGen.GenStmnt();
return p->Reference();
}
-// Alle offenen Referenzen anmaulen
void SbiSymPool::CheckRefs()
{
@@ -283,7 +276,7 @@ void SbiSymPool::CheckRefs()
/***************************************************************************
|*
-|* Symbol-Definitionen
+|* symbol definitions
|*
***************************************************************************/
@@ -328,8 +321,6 @@ SbiConstDef* SbiSymDef::GetConstDef()
return NULL;
}
-// Wenn der Name benoetigt wird, den aktuellen Namen
-// aus dem Stringpool nehmen
const String& SbiSymDef::GetName()
{
@@ -338,7 +329,6 @@ const String& SbiSymDef::GetName()
return aName;
}
-// Eintragen eines Datentyps
void SbiSymDef::SetType( SbxDataType t )
{
@@ -358,9 +348,8 @@ void SbiSymDef::SetType( SbxDataType t )
eType = t;
}
-// Aufbau einer Backchain, falls noch nicht definiert
-// Es wird der Wert zurueckgeliefert, der als Operand gespeichert
-// werden soll.
+// construct a backchain, if not yet defined
+// the value that shall be stored as an operand is returned
sal_uInt32 SbiSymDef::Reference()
{
@@ -373,8 +362,6 @@ sal_uInt32 SbiSymDef::Reference()
else return nChain;
}
-// Definition eines Symbols.
-// Hier wird der Backchain aufgeloest, falls vorhanden
sal_uInt32 SbiSymDef::Define()
{
@@ -386,13 +373,13 @@ sal_uInt32 SbiSymDef::Define()
return nChain;
}
-// Eine Symboldefinition kann einen eigenen Pool haben. Dies ist
-// der Fall bei Objekten und Prozeduren (lokale Variable)
+// A symbol definition may have its own pool. This is the caseDies ist
+// for objects and procedures (local variable)
SbiSymPool& SbiSymDef::GetPool()
{
if( !pPool )
- pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL ); // wird gedumpt
+ pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL ); // is dumped
return *pPool;
}
@@ -402,22 +389,22 @@ SbiSymScope SbiSymDef::GetScope() const
}
-// Die Prozedur-Definition hat drei Pools:
-// 1) aParams: wird durch die Definition gefuellt. Enthaelt die Namen
-// der Parameter, wie sie innerhalb des Rumpfes verwendet werden.
-// Das erste Element ist der Returnwert.
-// 2) pPool: saemtliche lokale Variable
-// 3) aLabels: Labels
+// The procedure definition has three pools:
+// 1) aParams: is filled by the definition. Contains the
+// parameters' names, like they're used inside the body.
+// The first element is the return value.
+// 2) pPool: all local variables
+// 3) aLabels: labels
SbiProcDef::SbiProcDef( SbiParser* pParser, const String& rName,
sal_Bool bProcDecl )
: SbiSymDef( rName )
- , aParams( pParser->aGblStrings, SbPARAM ) // wird gedumpt
- , aLabels( pParser->aLclStrings, SbLOCAL ) // wird nicht gedumpt
+ , aParams( pParser->aGblStrings, SbPARAM ) // is dumped
+ , aLabels( pParser->aLclStrings, SbLOCAL ) // is not dumped
, mbProcDecl( bProcDecl )
{
aParams.SetParent( &pParser->aPublics );
- pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL ); // Locals
+ pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL );
pPool->SetParent( &aParams );
nLine1 =
nLine2 = 0;
@@ -425,8 +412,8 @@ SbiProcDef::SbiProcDef( SbiParser* pParser, const String& rName,
bPublic = sal_True;
bCdecl = sal_False;
bStatic = sal_False;
- // Fuer Returnwerte ist das erste Element der Parameterliste
- // immer mit dem Namen und dem Typ der Proc definiert
+ // For return values the first element of the parameter
+ // list is always defined with name and type of the proc
aParams.AddSym( aName );
}
@@ -444,30 +431,29 @@ void SbiProcDef::SetType( SbxDataType t )
aParams.Get( 0 )->SetType( eType );
}
-// Match mit einer Forward-Deklaration
-// Falls der Match OK ist, wird pOld durch this im Pool ersetzt
-// pOld wird immer geloescht!
+// match with a forward-declaration
+// if the match is OK, pOld is replaced by this in the pool
+// pOld is deleted in any case!
void SbiProcDef::Match( SbiProcDef* pOld )
{
SbiSymDef* po, *pn=NULL;
- // Parameter 0 ist der Funktionsname
+ // parameter 0 is the function name
sal_uInt16 i;
for( i = 1; i < aParams.GetSize(); i++ )
{
po = pOld->aParams.Get( i );
pn = aParams.Get( i );
- // Kein Typabgleich; das wird beim Laufen erledigt
- // aber ist sie evtl. mit zu wenigen Parametern aufgerufen
- // worden?
+ // no type matching - that is done during running
+ // but is it maybe called with too little parameters?
if( !po && !pn->IsOptional() && !pn->IsParamArray() )
break;
po = pOld->aParams.Next();
}
- // Wurden zu viele Parameter angegeben?
+
if( pn && i < aParams.GetSize() && pOld->pIn )
{
- // Die ganze Zeile markieren
+ // mark the whole line
pOld->pIn->GetParser()->SetCol1( 0 );
pOld->pIn->GetParser()->Error( SbERR_BAD_DECLARATION, aName );
}
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index df387eabc102..1027d5b683a9 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -34,11 +34,11 @@
struct TokenTable { SbiToken t; const char *s; };
-static short nToken; // Anzahl der Tokens
+static short nToken; // number of tokens
static TokenTable* pTokTable;
-static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
+static TokenTable aTokTable_Basic [] = {
{ CAT, "&" },
{ MUL, "*" },
@@ -119,7 +119,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
{ IMP, "Imp" },
{ IMPLEMENTS, "Implements" },
{ _IN_, "In" },
- { INPUT, "Input" }, // auch INPUT #
+ { INPUT, "Input" }, // also INPUT #
{ TINTEGER, "Integer" },
{ IS, "Is" },
{ LET, "Let" },
@@ -188,7 +188,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
{ WHILE, "While" },
{ WITH, "With" },
{ WITHEVENTS, "WithEvents" },
- { WRITE, "Write" }, // auch WRITE #
+ { WRITE, "Write" }, // also WRITE #
{ XOR, "Xor" },
{ NIL, "" }
};
@@ -217,7 +217,7 @@ TokenLabelInfo::~TokenLabelInfo()
}
-// Der Konstruktor ermittelt die Laenge der Token-Tabelle.
+// the constructor detects the length of the token table
SbiTokenizer::SbiTokenizer( const ::rtl::OUString& rSrc, StarBASIC* pb )
: SbiScanner( rSrc, pb )
@@ -236,7 +236,6 @@ SbiTokenizer::~SbiTokenizer()
{
}
-// Wiederablage (Pushback) eines Tokens. (Bis zu 2 Tokens)
void SbiTokenizer::Push( SbiToken t )
{
@@ -263,7 +262,7 @@ void SbiTokenizer::Error( SbError code, SbiToken tok )
Error( code );
}
-// Einlesen des naechsten Tokens, ohne dass das Token geschluckt wird
+// reading in the next token without absorbing it
SbiToken SbiTokenizer::Peek()
{
@@ -280,12 +279,11 @@ SbiToken SbiTokenizer::Peek()
return eCurTok = ePush;
}
-// Dies ist fuer die Decompilation.
-// Zahlen und Symbole liefern einen Leerstring zurueck.
+// For decompilation. Numbers and symbols return an empty string.
const String& SbiTokenizer::Symbol( SbiToken t )
{
- // Zeichen-Token?
+ // character token?
if( t < FIRSTKWD )
{
aSym = (char) t;
@@ -312,15 +310,15 @@ const String& SbiTokenizer::Symbol( SbiToken t )
return aSym;
}
-// Einlesen des naechsten Tokens und Ablage desselben
-// Tokens, die nicht in der Token-Tabelle vorkommen, werden
-// direkt als Zeichen zurueckgeliefert.
-// Einige Worte werden gesondert behandelt.
+// Reading in the next token and put it down.
+// Tokens that don't appear in the token table
+// are directly returned as a character.
+// Some words are treated in a special way.
SbiToken SbiTokenizer::Next()
{
if (bEof) return EOLN;
- // Schon eines eingelesen?
+ // have read in one already?
if( ePush != NIL )
{
eCurTok = ePush;
@@ -333,40 +331,35 @@ SbiToken SbiTokenizer::Next()
}
TokenTable *tp;
- // Sonst einlesen:
if( !NextSym() )
{
bEof = bEos = sal_True;
return eCurTok = EOLN;
}
- // Zeilenende?
+
if( aSym.GetBuffer()[0] == '\n' )
{
bEos = sal_True; return eCurTok = EOLN;
}
bEos = sal_False;
- // Zahl?
if( bNumber )
return eCurTok = NUMBER;
- // String?
else if( ( eScanType == SbxDATE || eScanType == SbxSTRING ) && !bSymbol )
return eCurTok = FIXSTRING;
- // Sonderfaelle von Zeichen, die zwischen "Z" und "a" liegen. ICompare()
- // wertet die Position dieser Zeichen unterschiedlich aus.
+ // Special cases of characters that are between "Z" and "a". ICompare()
+ // evaluates the position of these characters in different ways.
else if( aSym.GetBuffer()[0] == '^' )
return eCurTok = EXPON;
else if( aSym.GetBuffer()[0] == '\\' )
return eCurTok = IDIV;
else
{
- // Mit Typkennung oder ein Symbol und keine Keyword-Erkennung?
- // Dann kein Token-Test
if( eScanType != SbxVARIANT
|| ( !bKeywords && bSymbol ) )
return eCurTok = SYMBOL;
- // Gueltiges Token?
+ // valid token?
short lb = 0;
short ub = nToken-1;
short delta;
@@ -375,23 +368,23 @@ SbiToken SbiTokenizer::Next()
delta = (ub - lb) >> 1;
tp = &pTokTable[ lb + delta ];
StringCompare res = aSym.CompareIgnoreCaseToAscii( tp->s );
- // Gefunden?
+
if( res == COMPARE_EQUAL )
goto special;
- // Groesser? Dann untere Haelfte
+
if( res == COMPARE_LESS )
{
if ((ub - lb) == 2) ub = lb;
else ub = ub - delta;
}
- // Kleiner? Dann obere Haelfte
+
else
{
if ((ub -lb) == 2) lb = ub;
else lb = lb + delta;
}
} while( delta );
- // Symbol? Wenn nicht >= Token
+ // Symbol? if not >= token
sal_Unicode ch = aSym.GetBuffer()[0];
if( !BasicSimpleCharClass::isAlpha( ch, bCompatible ) && !bSymbol )
return eCurTok = (SbiToken) (ch & 0x00FF);
@@ -410,14 +403,14 @@ special:
// END IF, CASE, SUB, DEF, FUNCTION, TYPE, CLASS, WITH
if( tp->t == END )
{
- // AB, 15.3.96, Spezialbehandlung fuer END, beim Peek() geht die
- // aktuelle Zeile verloren, daher alles merken und danach restaurieren
+ // from 15.3.96, special treatment for END, at Peek() the current
+ // time is lost, so memorize everything and restore after
sal_uInt16 nOldLine = nLine;
sal_uInt16 nOldCol = nCol;
sal_uInt16 nOldCol1 = nCol1;
sal_uInt16 nOldCol2 = nCol2;
String aOldSym = aSym;
- SaveLine(); // pLine im Scanner sichern
+ SaveLine(); // save pLine in the scanner
eCurTok = Peek();
switch( eCurTok )
@@ -435,21 +428,20 @@ special:
nCol1 = nOldCol1;
if( eCurTok == END )
{
- // Alles zuruecksetzen, damit Token nach END ganz neu gelesen wird
+ // reset everything so that token is read completely newly after END
ePush = NIL;
nLine = nOldLine;
nCol = nOldCol;
nCol2 = nOldCol2;
aSym = aOldSym;
- RestoreLine(); // pLine im Scanner restaurieren
+ RestoreLine();
}
return eCurTok;
}
- // Sind Datentypen Keywords?
- // Nur nach AS, sonst sind es Symbole!
- // Es gibt ja ERROR(), DATA(), STRING() etc.
+ // are data types keywords?
+ // there is ERROR(), DATA(), STRING() etc.
eCurTok = tp->t;
- // AS: Datentypen sind Keywords
+ // AS: data types are keywords
if( tp->t == AS )
bAs = sal_True;
else
@@ -493,7 +485,6 @@ special:
#pragma optimize("",off)
#endif
-// Kann das aktuell eingelesene Token ein Label sein?
sal_Bool SbiTokenizer::MayBeLabel( sal_Bool bNeedsColon )
{
@@ -541,7 +532,7 @@ void SbiTokenizer::Hilite( SbTextPortions& rList )
else
aRes.eType = SB_PUNCTUATION;
}
- // Die Folge xxx.Keyword sollte nicht als Kwd geflagt werden
+ // the sequence xxx.Keyword should not be flagged as Kwd
if( aRes.eType == SB_KEYWORD
&& ( eLastTok == DOT|| eLastTok == EXCLAM ) )
aRes.eType = SB_SYMBOL;