xref: /aoo42x/main/idl/source/cmptools/lex.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_idl.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <ctype.h>
33*cdf0e10cSrcweir #include <stdio.h>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <char.hxx>
36*cdf0e10cSrcweir #include <hash.hxx>
37*cdf0e10cSrcweir #include <lex.hxx>
38*cdf0e10cSrcweir #include <globals.hxx>
39*cdf0e10cSrcweir #include <tools/bigint.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir /****************** SvToken **********************************************/
42*cdf0e10cSrcweir /*************************************************************************
43*cdf0e10cSrcweir |*
44*cdf0e10cSrcweir |*    SvToken::Print()
45*cdf0e10cSrcweir |*
46*cdf0e10cSrcweir |*    Beschreibung
47*cdf0e10cSrcweir |*
48*cdf0e10cSrcweir *************************************************************************/
49*cdf0e10cSrcweir ByteString SvToken::GetTokenAsString() const
50*cdf0e10cSrcweir {
51*cdf0e10cSrcweir     ByteString aStr;
52*cdf0e10cSrcweir     switch( nType )
53*cdf0e10cSrcweir     {
54*cdf0e10cSrcweir         case SVTOKEN_EMPTY:
55*cdf0e10cSrcweir             break;
56*cdf0e10cSrcweir         case SVTOKEN_COMMENT:
57*cdf0e10cSrcweir             aStr = aString;
58*cdf0e10cSrcweir             break;
59*cdf0e10cSrcweir         case SVTOKEN_INTEGER:
60*cdf0e10cSrcweir             aStr = ByteString::CreateFromInt64(nLong);
61*cdf0e10cSrcweir             break;
62*cdf0e10cSrcweir         case SVTOKEN_STRING:
63*cdf0e10cSrcweir             aStr = aString;
64*cdf0e10cSrcweir             break;
65*cdf0e10cSrcweir         case SVTOKEN_BOOL:
66*cdf0e10cSrcweir             aStr = bBool ? "TRUE" : "FALSE";
67*cdf0e10cSrcweir             break;
68*cdf0e10cSrcweir         case SVTOKEN_IDENTIFIER:
69*cdf0e10cSrcweir             aStr = aString;
70*cdf0e10cSrcweir             break;
71*cdf0e10cSrcweir         case SVTOKEN_CHAR:
72*cdf0e10cSrcweir             aStr = cChar;
73*cdf0e10cSrcweir             break;
74*cdf0e10cSrcweir         case SVTOKEN_RTTIBASE:
75*cdf0e10cSrcweir             aStr = "RTTIBASE";//(ULONG)pComplexObj;
76*cdf0e10cSrcweir             break;
77*cdf0e10cSrcweir         case SVTOKEN_EOF:
78*cdf0e10cSrcweir         case SVTOKEN_HASHID:
79*cdf0e10cSrcweir             break;
80*cdf0e10cSrcweir     }
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir     return aStr;
83*cdf0e10cSrcweir }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir /*************************************************************************
86*cdf0e10cSrcweir |*
87*cdf0e10cSrcweir |*    SvToken::SvToken()
88*cdf0e10cSrcweir |*
89*cdf0e10cSrcweir |*    Beschreibung
90*cdf0e10cSrcweir |*
91*cdf0e10cSrcweir *************************************************************************/
92*cdf0e10cSrcweir SvToken::SvToken( const SvToken & rObj )
93*cdf0e10cSrcweir {
94*cdf0e10cSrcweir 	nLine = rObj.nLine;
95*cdf0e10cSrcweir 	nColumn = rObj.nColumn;
96*cdf0e10cSrcweir 	nType = rObj.nType;
97*cdf0e10cSrcweir 	aString = rObj.aString;
98*cdf0e10cSrcweir /*
99*cdf0e10cSrcweir     if( SVTOKEN_RTTIBASE = nType )
100*cdf0e10cSrcweir 	{
101*cdf0e10cSrcweir 	    pComplexObj = rObj.pComplexObj;
102*cdf0e10cSrcweir 		pComplexObj->AddRef();
103*cdf0e10cSrcweir 	}
104*cdf0e10cSrcweir 	else
105*cdf0e10cSrcweir */
106*cdf0e10cSrcweir 	    nLong = rObj.nLong;
107*cdf0e10cSrcweir }
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir /*************************************************************************
110*cdf0e10cSrcweir |*
111*cdf0e10cSrcweir |*    SvToken::operator = ()
112*cdf0e10cSrcweir |*
113*cdf0e10cSrcweir |*    Beschreibung
114*cdf0e10cSrcweir |*
115*cdf0e10cSrcweir *************************************************************************/
116*cdf0e10cSrcweir SvToken & SvToken::operator = ( const SvToken & rObj )
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir 	if( this != &rObj )
119*cdf0e10cSrcweir 	{
120*cdf0e10cSrcweir /*
121*cdf0e10cSrcweir         if( SVTOKEN_RTTIBASE = nType )
122*cdf0e10cSrcweir 	    	pComplexObj->ReleaseRef();
123*cdf0e10cSrcweir */
124*cdf0e10cSrcweir 	    nLine = rObj.nLine;
125*cdf0e10cSrcweir 	    nColumn = rObj.nColumn;
126*cdf0e10cSrcweir 	    nType = rObj.nType;
127*cdf0e10cSrcweir 	    aString = rObj.aString;
128*cdf0e10cSrcweir /*
129*cdf0e10cSrcweir         if( SVTOKEN_RTTIBASE = nType )
130*cdf0e10cSrcweir 		{
131*cdf0e10cSrcweir 	    	pComplexObj = rObj.pComplexObj;
132*cdf0e10cSrcweir 			pComplexObj->AddRef();
133*cdf0e10cSrcweir 		}
134*cdf0e10cSrcweir 		else
135*cdf0e10cSrcweir */
136*cdf0e10cSrcweir 		    nLong = rObj.nLong;
137*cdf0e10cSrcweir 	}
138*cdf0e10cSrcweir     return *this;
139*cdf0e10cSrcweir }
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir /****************** SvTokenStream ****************************************/
142*cdf0e10cSrcweir /*************************************************************************
143*cdf0e10cSrcweir |*    SvTokenStream::InitCtor()
144*cdf0e10cSrcweir |*
145*cdf0e10cSrcweir |*    Beschreibung
146*cdf0e10cSrcweir *************************************************************************/
147*cdf0e10cSrcweir void SvTokenStream::InitCtor()
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir     SetCharSet( gsl_getSystemTextEncoding() );
150*cdf0e10cSrcweir 	aStrTrue	= "TRUE";
151*cdf0e10cSrcweir 	aStrFalse	= "FALSE";
152*cdf0e10cSrcweir     nLine       = nColumn = 0;
153*cdf0e10cSrcweir     nBufPos     = 0;
154*cdf0e10cSrcweir     nTabSize    = 4;
155*cdf0e10cSrcweir 	pCurToken	= NULL;
156*cdf0e10cSrcweir 	nMaxPos		= 0;
157*cdf0e10cSrcweir     c           = GetNextChar();
158*cdf0e10cSrcweir 	FillTokenList();
159*cdf0e10cSrcweir }
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir /*************************************************************************
162*cdf0e10cSrcweir |*    SvTokenStream::SvTokenStream()
163*cdf0e10cSrcweir |*
164*cdf0e10cSrcweir |*    Beschreibung
165*cdf0e10cSrcweir *************************************************************************/
166*cdf0e10cSrcweir SvTokenStream::SvTokenStream( const String & rFileName )
167*cdf0e10cSrcweir     : pInStream( new SvFileStream( rFileName, STREAM_STD_READ | STREAM_NOCREATE ) )
168*cdf0e10cSrcweir     , rInStream( *pInStream )
169*cdf0e10cSrcweir     , aFileName( rFileName )
170*cdf0e10cSrcweir 	, aTokList( 0x8000, 0x8000 )
171*cdf0e10cSrcweir {
172*cdf0e10cSrcweir     InitCtor();
173*cdf0e10cSrcweir }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir /*************************************************************************
176*cdf0e10cSrcweir |*    SvTokenStream::SvTokenStream()
177*cdf0e10cSrcweir |*
178*cdf0e10cSrcweir |*    Beschreibung
179*cdf0e10cSrcweir *************************************************************************/
180*cdf0e10cSrcweir SvTokenStream::SvTokenStream( SvStream & rStream, const String & rFileName )
181*cdf0e10cSrcweir     : pInStream( NULL )
182*cdf0e10cSrcweir     , rInStream( rStream )
183*cdf0e10cSrcweir     , aFileName( rFileName )
184*cdf0e10cSrcweir 	, aTokList( 0x8000, 0x8000 )
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir     InitCtor();
187*cdf0e10cSrcweir }
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir /*************************************************************************
190*cdf0e10cSrcweir |*    SvTokenStream::~SvTokenStream()
191*cdf0e10cSrcweir |*
192*cdf0e10cSrcweir |*    Beschreibung
193*cdf0e10cSrcweir *************************************************************************/
194*cdf0e10cSrcweir SvTokenStream::~SvTokenStream()
195*cdf0e10cSrcweir {
196*cdf0e10cSrcweir     delete pInStream;
197*cdf0e10cSrcweir     SvToken * pTok = aTokList.Last();
198*cdf0e10cSrcweir     while( pTok )
199*cdf0e10cSrcweir 	{
200*cdf0e10cSrcweir         delete pTok;
201*cdf0e10cSrcweir 		pTok = aTokList.Prev();
202*cdf0e10cSrcweir 	}
203*cdf0e10cSrcweir }
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir /*************************************************************************
206*cdf0e10cSrcweir |*    SvTokenStream::FillTokenList()
207*cdf0e10cSrcweir |*
208*cdf0e10cSrcweir |*    Beschreibung
209*cdf0e10cSrcweir *************************************************************************/
210*cdf0e10cSrcweir void SvTokenStream::FillTokenList()
211*cdf0e10cSrcweir {
212*cdf0e10cSrcweir 	SvToken * pToken = new SvToken();
213*cdf0e10cSrcweir 	aTokList.Insert( pToken, LIST_APPEND );
214*cdf0e10cSrcweir 	do
215*cdf0e10cSrcweir 	{
216*cdf0e10cSrcweir 	    if( !MakeToken( *pToken ) )
217*cdf0e10cSrcweir 		{
218*cdf0e10cSrcweir 			SvToken * p = aTokList.Prev();
219*cdf0e10cSrcweir 	        *pToken = SvToken();
220*cdf0e10cSrcweir 			if( p )
221*cdf0e10cSrcweir 			{
222*cdf0e10cSrcweir 				pToken->SetLine( p->GetLine() );
223*cdf0e10cSrcweir 				pToken->SetColumn( p->GetColumn() );
224*cdf0e10cSrcweir 			}
225*cdf0e10cSrcweir 			break;
226*cdf0e10cSrcweir 		}
227*cdf0e10cSrcweir 		else if( pToken->IsComment() )
228*cdf0e10cSrcweir 			*pToken = SvToken();
229*cdf0e10cSrcweir 		else if( pToken->IsEof() )
230*cdf0e10cSrcweir 			break;
231*cdf0e10cSrcweir 		else
232*cdf0e10cSrcweir 		{
233*cdf0e10cSrcweir 			pToken = new SvToken();
234*cdf0e10cSrcweir 			aTokList.Insert( pToken, LIST_APPEND );
235*cdf0e10cSrcweir 		}
236*cdf0e10cSrcweir 	}
237*cdf0e10cSrcweir 	while( !pToken->IsEof() );
238*cdf0e10cSrcweir 	pCurToken = aTokList.First();
239*cdf0e10cSrcweir }
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir /*************************************************************************
242*cdf0e10cSrcweir |*    SvTokenStrem::SetCharSet()
243*cdf0e10cSrcweir |*
244*cdf0e10cSrcweir |*    Beschreibung
245*cdf0e10cSrcweir *************************************************************************/
246*cdf0e10cSrcweir void SvTokenStream::SetCharSet( CharSet nSet )
247*cdf0e10cSrcweir {
248*cdf0e10cSrcweir     nCharSet = nSet;
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir     pCharTab = SvChar::GetTable( nSet, gsl_getSystemTextEncoding() );
251*cdf0e10cSrcweir }
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir /*************************************************************************
254*cdf0e10cSrcweir |*    SvTokeStream::GetNextChar()
255*cdf0e10cSrcweir |*
256*cdf0e10cSrcweir |*    Beschreibung
257*cdf0e10cSrcweir *************************************************************************/
258*cdf0e10cSrcweir int SvTokenStream::GetNextChar()
259*cdf0e10cSrcweir {
260*cdf0e10cSrcweir     int nChar;
261*cdf0e10cSrcweir     if( (int)aBufStr.Len() < nBufPos )
262*cdf0e10cSrcweir     {
263*cdf0e10cSrcweir         if( rInStream.ReadLine( aBufStr ) )
264*cdf0e10cSrcweir         {
265*cdf0e10cSrcweir             nLine++;
266*cdf0e10cSrcweir             nColumn = 0;
267*cdf0e10cSrcweir             nBufPos = 0;
268*cdf0e10cSrcweir         }
269*cdf0e10cSrcweir         else
270*cdf0e10cSrcweir 		{
271*cdf0e10cSrcweir 			aBufStr.Erase();
272*cdf0e10cSrcweir             nColumn = 0;
273*cdf0e10cSrcweir             nBufPos = 0;
274*cdf0e10cSrcweir 			return '\0';
275*cdf0e10cSrcweir 		}
276*cdf0e10cSrcweir     }
277*cdf0e10cSrcweir     nChar = aBufStr.GetChar( (sal_uInt16)nBufPos++ );
278*cdf0e10cSrcweir     nColumn += nChar == '\t' ? nTabSize : 1;
279*cdf0e10cSrcweir     return nChar;
280*cdf0e10cSrcweir }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir /*************************************************************************
283*cdf0e10cSrcweir |*    SvTokenStrem::GetNumber()
284*cdf0e10cSrcweir |*
285*cdf0e10cSrcweir |*    Beschreibung
286*cdf0e10cSrcweir *************************************************************************/
287*cdf0e10cSrcweir sal_uLong SvTokenStream::GetNumber()
288*cdf0e10cSrcweir {
289*cdf0e10cSrcweir     sal_uLong   l = 0;
290*cdf0e10cSrcweir     short   nLog = 10;
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir     if( '0' == c )
293*cdf0e10cSrcweir     {
294*cdf0e10cSrcweir         c = GetFastNextChar();
295*cdf0e10cSrcweir         if( 'x' == c )
296*cdf0e10cSrcweir         {
297*cdf0e10cSrcweir             nLog = 16;
298*cdf0e10cSrcweir             c = GetFastNextChar();
299*cdf0e10cSrcweir         }
300*cdf0e10cSrcweir     };
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir     if( nLog == 16 )
303*cdf0e10cSrcweir     {
304*cdf0e10cSrcweir         while( isxdigit( c ) )
305*cdf0e10cSrcweir         {
306*cdf0e10cSrcweir             if( isdigit( c ) )
307*cdf0e10cSrcweir                 l = l * nLog + (c - '0');
308*cdf0e10cSrcweir             else
309*cdf0e10cSrcweir                 l = l * nLog + (toupper( c ) - 'A' + 10 );
310*cdf0e10cSrcweir             c = GetFastNextChar();
311*cdf0e10cSrcweir         }
312*cdf0e10cSrcweir     }
313*cdf0e10cSrcweir     else
314*cdf0e10cSrcweir     {
315*cdf0e10cSrcweir         while( isdigit( c ) || 'x' == c )
316*cdf0e10cSrcweir         {
317*cdf0e10cSrcweir             l = l * nLog + (c - '0');
318*cdf0e10cSrcweir             c = GetFastNextChar();
319*cdf0e10cSrcweir         }
320*cdf0e10cSrcweir     }
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir     return( l );
323*cdf0e10cSrcweir }
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir /*************************************************************************
326*cdf0e10cSrcweir |*    SvTokenStream::MakeToken()
327*cdf0e10cSrcweir |*
328*cdf0e10cSrcweir |*    Beschreibung
329*cdf0e10cSrcweir *************************************************************************/
330*cdf0e10cSrcweir sal_Bool SvTokenStream::MakeToken( SvToken & rToken )
331*cdf0e10cSrcweir {
332*cdf0e10cSrcweir     int             c1;
333*cdf0e10cSrcweir     sal_uInt16          i;
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir 	do
336*cdf0e10cSrcweir 	{
337*cdf0e10cSrcweir 		if( 0 == c )
338*cdf0e10cSrcweir 	        c = GetNextChar();
339*cdf0e10cSrcweir 	    // Leerzeichen ueberlesen
340*cdf0e10cSrcweir 	    while( isspace( c ) || 26 == c )
341*cdf0e10cSrcweir 		{
342*cdf0e10cSrcweir 	        c = GetFastNextChar();
343*cdf0e10cSrcweir 		    nColumn += c == '\t' ? nTabSize : 1;
344*cdf0e10cSrcweir 		}
345*cdf0e10cSrcweir 	}
346*cdf0e10cSrcweir 	while( 0 == c && !IsEof() && ( SVSTREAM_OK == rInStream.GetError() ) );
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir     sal_uLong nLastLine		= nLine;
349*cdf0e10cSrcweir     sal_uLong nLastColumn	= nColumn;
350*cdf0e10cSrcweir     // Kommentar
351*cdf0e10cSrcweir     if( '/' == c )
352*cdf0e10cSrcweir     {
353*cdf0e10cSrcweir 		// Zeit Optimierung, keine Kommentare
354*cdf0e10cSrcweir         //ByteString aComment( (char)c );
355*cdf0e10cSrcweir         c1 = c;
356*cdf0e10cSrcweir         c = GetFastNextChar();
357*cdf0e10cSrcweir         if( '/' == c )
358*cdf0e10cSrcweir         {
359*cdf0e10cSrcweir             while( '\0' != c )
360*cdf0e10cSrcweir             {
361*cdf0e10cSrcweir                 //aComment += (char)c;
362*cdf0e10cSrcweir                 c = GetFastNextChar();
363*cdf0e10cSrcweir             }
364*cdf0e10cSrcweir             c = GetNextChar();
365*cdf0e10cSrcweir             rToken.nType 	= SVTOKEN_COMMENT;
366*cdf0e10cSrcweir 			//rToken.aString	= aComment;
367*cdf0e10cSrcweir         }
368*cdf0e10cSrcweir         else if( '*' == c )
369*cdf0e10cSrcweir         {
370*cdf0e10cSrcweir             //aComment += (char)c;
371*cdf0e10cSrcweir             c = GetFastNextChar();
372*cdf0e10cSrcweir             do
373*cdf0e10cSrcweir 			{
374*cdf0e10cSrcweir                 //aComment += (char)c;
375*cdf0e10cSrcweir                 while( '*' != c )
376*cdf0e10cSrcweir                 {
377*cdf0e10cSrcweir 	                if( '\0' == c )
378*cdf0e10cSrcweir 					{
379*cdf0e10cSrcweir 	                	c = GetNextChar();
380*cdf0e10cSrcweir 	                	if( IsEof() )
381*cdf0e10cSrcweir 	                    	return sal_False;
382*cdf0e10cSrcweir 					}
383*cdf0e10cSrcweir 					else
384*cdf0e10cSrcweir                     	c = GetFastNextChar();
385*cdf0e10cSrcweir                     //aComment += (char)c;
386*cdf0e10cSrcweir                 }
387*cdf0e10cSrcweir                 c = GetFastNextChar();
388*cdf0e10cSrcweir             }
389*cdf0e10cSrcweir             while( '/' != c && !IsEof() && ( SVSTREAM_OK == rInStream.GetError() ) );
390*cdf0e10cSrcweir             if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) )
391*cdf0e10cSrcweir                 return sal_False;
392*cdf0e10cSrcweir             //aComment += (char)c;
393*cdf0e10cSrcweir             c = GetNextChar();
394*cdf0e10cSrcweir             rToken.nType = SVTOKEN_COMMENT;
395*cdf0e10cSrcweir 			//rToken.aString = aComment;
396*cdf0e10cSrcweir 			CalcColumn();
397*cdf0e10cSrcweir         }
398*cdf0e10cSrcweir         else
399*cdf0e10cSrcweir 		{
400*cdf0e10cSrcweir 			rToken.nType = SVTOKEN_CHAR;
401*cdf0e10cSrcweir             rToken.cChar = (char)c1;
402*cdf0e10cSrcweir 		}
403*cdf0e10cSrcweir     }
404*cdf0e10cSrcweir     else if( c == '"' )
405*cdf0e10cSrcweir     {
406*cdf0e10cSrcweir         ByteString          aStr;
407*cdf0e10cSrcweir         i = 0;
408*cdf0e10cSrcweir         sal_Bool bDone = sal_False;
409*cdf0e10cSrcweir         while( !bDone && !IsEof() && c )
410*cdf0e10cSrcweir         {
411*cdf0e10cSrcweir             c = GetFastNextChar();
412*cdf0e10cSrcweir 	        if( '\0' == c )
413*cdf0e10cSrcweir 			{
414*cdf0e10cSrcweir 				// Strings auch "uber das Zeilenende hinauslesen
415*cdf0e10cSrcweir 				aStr += '\n';
416*cdf0e10cSrcweir 	            c = GetNextChar();
417*cdf0e10cSrcweir 	            if( IsEof() )
418*cdf0e10cSrcweir 					return sal_False;
419*cdf0e10cSrcweir 			}
420*cdf0e10cSrcweir             if( c == '"' )
421*cdf0e10cSrcweir             {
422*cdf0e10cSrcweir                 c = GetFastNextChar();
423*cdf0e10cSrcweir                 if( c == '"' )
424*cdf0e10cSrcweir                 {
425*cdf0e10cSrcweir                     aStr += '"';
426*cdf0e10cSrcweir                     aStr += '"';
427*cdf0e10cSrcweir                 }
428*cdf0e10cSrcweir                 else
429*cdf0e10cSrcweir                     bDone = sal_True;
430*cdf0e10cSrcweir             }
431*cdf0e10cSrcweir             else if( c == '\\' )
432*cdf0e10cSrcweir             {
433*cdf0e10cSrcweir                 aStr += '\\';
434*cdf0e10cSrcweir                 c = GetFastNextChar();
435*cdf0e10cSrcweir                 if( c )
436*cdf0e10cSrcweir                     aStr += (char)c;
437*cdf0e10cSrcweir             }
438*cdf0e10cSrcweir             else
439*cdf0e10cSrcweir                 aStr += (char)c;
440*cdf0e10cSrcweir         }
441*cdf0e10cSrcweir         if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) )
442*cdf0e10cSrcweir             return sal_False;
443*cdf0e10cSrcweir         char * pStr = (char *)aStr.GetBuffer();
444*cdf0e10cSrcweir         while( *pStr )
445*cdf0e10cSrcweir         {
446*cdf0e10cSrcweir             *pStr = pCharTab[ (unsigned char)*pStr ];
447*cdf0e10cSrcweir             pStr++;
448*cdf0e10cSrcweir         };
449*cdf0e10cSrcweir         rToken.nType   = SVTOKEN_STRING;
450*cdf0e10cSrcweir 		rToken.aString = aStr;
451*cdf0e10cSrcweir     }
452*cdf0e10cSrcweir     else if( isdigit( c ) )
453*cdf0e10cSrcweir     {
454*cdf0e10cSrcweir         rToken.nType = SVTOKEN_INTEGER;
455*cdf0e10cSrcweir         rToken.nLong = GetNumber();
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir     }
458*cdf0e10cSrcweir     else if( isalpha (c) || (c == '_') )
459*cdf0e10cSrcweir     {
460*cdf0e10cSrcweir         ByteString aStr;
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir         while( isalnum( c ) || c == '_' )
463*cdf0e10cSrcweir         {
464*cdf0e10cSrcweir             aStr += (char)c;
465*cdf0e10cSrcweir             c = GetFastNextChar();
466*cdf0e10cSrcweir         }
467*cdf0e10cSrcweir         if( aStr.EqualsIgnoreCaseAscii( aStrTrue ) )
468*cdf0e10cSrcweir 		{
469*cdf0e10cSrcweir             rToken.nType = SVTOKEN_BOOL;
470*cdf0e10cSrcweir 			rToken.bBool = sal_True;
471*cdf0e10cSrcweir         }
472*cdf0e10cSrcweir         else if( aStr.EqualsIgnoreCaseAscii( aStrFalse ) )
473*cdf0e10cSrcweir 		{
474*cdf0e10cSrcweir             rToken.nType = SVTOKEN_BOOL;
475*cdf0e10cSrcweir 			rToken.bBool = sal_False;
476*cdf0e10cSrcweir         }
477*cdf0e10cSrcweir         else
478*cdf0e10cSrcweir         {
479*cdf0e10cSrcweir             sal_uInt32 nHashId;
480*cdf0e10cSrcweir             if( IDLAPP->pHashTable->Test( aStr, &nHashId ) )
481*cdf0e10cSrcweir                 rToken.SetHash( IDLAPP->pHashTable->Get( nHashId ) );
482*cdf0e10cSrcweir 			else
483*cdf0e10cSrcweir 			{
484*cdf0e10cSrcweir             	rToken.nType   = SVTOKEN_IDENTIFIER;
485*cdf0e10cSrcweir 				rToken.aString = aStr;
486*cdf0e10cSrcweir 			}
487*cdf0e10cSrcweir         }
488*cdf0e10cSrcweir     }
489*cdf0e10cSrcweir     else if( IsEof() )
490*cdf0e10cSrcweir     {
491*cdf0e10cSrcweir         rToken.nType = SVTOKEN_EOF;
492*cdf0e10cSrcweir     }
493*cdf0e10cSrcweir     else
494*cdf0e10cSrcweir     {
495*cdf0e10cSrcweir         rToken.nType = SVTOKEN_CHAR;
496*cdf0e10cSrcweir 		rToken.cChar = (char)c;
497*cdf0e10cSrcweir         c = GetFastNextChar();
498*cdf0e10cSrcweir     }
499*cdf0e10cSrcweir     rToken.SetLine( nLastLine );
500*cdf0e10cSrcweir     rToken.SetColumn( nLastColumn );
501*cdf0e10cSrcweir 	return rInStream.GetError() == SVSTREAM_OK;
502*cdf0e10cSrcweir }
503*cdf0e10cSrcweir 
504