aboutsummaryrefslogtreecommitdiff
path: root/src/tools/bnfcompile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/bnfcompile.cpp')
-rw-r--r--src/tools/bnfcompile.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tools/bnfcompile.cpp b/src/tools/bnfcompile.cpp
index 16e75a5..b7b363c 100644
--- a/src/tools/bnfcompile.cpp
+++ b/src/tools/bnfcompile.cpp
@@ -123,7 +123,7 @@ public:
123 } 123 }
124 } 124 }
125 125
126 virtual FString tokenToString( const Token &t ) 126 virtual String tokenToString( const Token &t )
127 { 127 {
128 switch( (TokenType)t.iToken ) 128 switch( (TokenType)t.iToken )
129 { 129 {
@@ -146,7 +146,7 @@ public:
146private: 146private:
147 Stream &rSrc; 147 Stream &rSrc;
148 QueueBuf qbIn; 148 QueueBuf qbIn;
149 FString sBuf; 149 String sBuf;
150}; 150};
151 151
152class BnfParser 152class BnfParser
@@ -201,9 +201,9 @@ private:
201 next(); 201 next();
202 if( pCur->iToken == tokIdentifier ) 202 if( pCur->iToken == tokIdentifier )
203 { 203 {
204 hTokens.insert( pCur->vExtra.get<Bu::FString>(), ++iLastToken ); 204 hTokens.insert( pCur->vExtra.get<Bu::String>(), ++iLastToken );
205 sio << "Added token[" << iLastToken << "]: " 205 sio << "Added token[" << iLastToken << "]: "
206 << pCur->vExtra.get<Bu::FString>() << sio.nl; 206 << pCur->vExtra.get<Bu::String>() << sio.nl;
207 } 207 }
208 else if( pCur->iToken == tokSemiColon ) 208 else if( pCur->iToken == tokSemiColon )
209 break; 209 break;
@@ -214,7 +214,7 @@ private:
214 214
215 void nonTerminal() 215 void nonTerminal()
216 { 216 {
217 Bu::FString sNtName = pCur->vExtra.get<Bu::FString>(); 217 Bu::String sNtName = pCur->vExtra.get<Bu::String>();
218 Parser::NonTerminal nt; 218 Parser::NonTerminal nt;
219 p.addNonTerminal( sNtName ); 219 p.addNonTerminal( sNtName );
220 sio.incIndent(); 220 sio.incIndent();
@@ -258,8 +258,8 @@ private:
258 { 258 {
259 case tokIdentifier: 259 case tokIdentifier:
260 { 260 {
261 const Bu::FString &sName = 261 const Bu::String &sName =
262 pCur->vExtra.get<Bu::FString>(); 262 pCur->vExtra.get<Bu::String>();
263 if( hTokens.has( sName ) ) 263 if( hTokens.has( sName ) )
264 { 264 {
265 pr.append( 265 pr.append(
@@ -292,8 +292,8 @@ private:
292 next(); 292 next();
293 if( pCur->iToken != tokIdentifier ) 293 if( pCur->iToken != tokIdentifier )
294 tokenError("tokIdentifier"); 294 tokenError("tokIdentifier");
295 Bu::FString sName = 295 Bu::String sName =
296 pCur->vExtra.get<Bu::FString>(); 296 pCur->vExtra.get<Bu::String>();
297 next(); 297 next();
298 if( pCur->iToken != tokCloseSquare ) 298 if( pCur->iToken != tokCloseSquare )
299 tokenError("tokCloseSquare"); 299 tokenError("tokCloseSquare");
@@ -317,8 +317,8 @@ private:
317 next(); 317 next();
318 if( pCur->iToken != tokIdentifier ) 318 if( pCur->iToken != tokIdentifier )
319 tokenError("tokIdentifier"); 319 tokenError("tokIdentifier");
320 Bu::FString sName = 320 Bu::String sName =
321 pCur->vExtra.get<Bu::FString>(); 321 pCur->vExtra.get<Bu::String>();
322 next(); 322 next();
323 if( pCur->iToken != tokCloseCurly ) 323 if( pCur->iToken != tokCloseCurly )
324 tokenError("tokCloseCurly"); 324 tokenError("tokCloseCurly");
@@ -366,14 +366,14 @@ private:
366 pCur = l.nextToken(); 366 pCur = l.nextToken();
367 } 367 }
368 368
369 void tokenError( const FString &s ) 369 void tokenError( const String &s )
370 { 370 {
371 throw ExceptionBase( ("Expected " + s + " but found " 371 throw ExceptionBase( ("Expected " + s + " but found "
372 + l.tokenToString( *pCur ) + ".").getStr() ); 372 + l.tokenToString( *pCur ) + ".").getStr() );
373 } 373 }
374 374
375private: 375private:
376 typedef Bu::Hash<Bu::FString, int> TokenHash; 376 typedef Bu::Hash<Bu::String, int> TokenHash;
377 TokenHash hTokens; 377 TokenHash hTokens;
378 BnfLexer &l; 378 BnfLexer &l;
379 BnfLexer::Token *pCur; 379 BnfLexer::Token *pCur;