summaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 4ad4ff9..4d9f793 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1,3 +1,10 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#include "bu/parser.h" 8#include "bu/parser.h"
2#include "bu/lexer.h" 9#include "bu/lexer.h"
3 10
@@ -172,12 +179,12 @@ void Bu::Parser::setRootNonTerminal( int iRoot )
172 iRootNonTerminal = iRoot; 179 iRootNonTerminal = iRoot;
173} 180}
174 181
175void Bu::Parser::setRootNonTerminal( const Bu::FString &sRoot ) 182void Bu::Parser::setRootNonTerminal( const Bu::String &sRoot )
176{ 183{
177 setRootNonTerminal( hNonTerminalName.get( sRoot ) ); 184 setRootNonTerminal( hNonTerminalName.get( sRoot ) );
178} 185}
179 186
180int Bu::Parser::addNonTerminal( const Bu::FString &sName, NonTerminal &nt ) 187int Bu::Parser::addNonTerminal( const Bu::String &sName, NonTerminal &nt )
181{ 188{
182 int iId = aNonTerminal.getSize(); 189 int iId = aNonTerminal.getSize();
183 aNonTerminal.append( nt ); 190 aNonTerminal.append( nt );
@@ -186,7 +193,7 @@ int Bu::Parser::addNonTerminal( const Bu::FString &sName, NonTerminal &nt )
186 return iId; 193 return iId;
187} 194}
188 195
189int Bu::Parser::addNonTerminal( const Bu::FString &sName ) 196int Bu::Parser::addNonTerminal( const Bu::String &sName )
190{ 197{
191 int iId = aNonTerminal.getSize(); 198 int iId = aNonTerminal.getSize();
192 aNonTerminal.append( NonTerminal() ); 199 aNonTerminal.append( NonTerminal() );
@@ -195,22 +202,22 @@ int Bu::Parser::addNonTerminal( const Bu::FString &sName )
195 return iId; 202 return iId;
196} 203}
197 204
198void Bu::Parser::setNonTerminal( const Bu::FString &sName, NonTerminal &nt ) 205void Bu::Parser::setNonTerminal( const Bu::String &sName, NonTerminal &nt )
199{ 206{
200 aNonTerminal[hNonTerminalName.get(sName)] = nt; 207 aNonTerminal[hNonTerminalName.get(sName)] = nt;
201} 208}
202 209
203int Bu::Parser::getNonTerminalId( const Bu::FString &sName ) 210int Bu::Parser::getNonTerminalId( const Bu::String &sName )
204{ 211{
205 return hNonTerminalName.get( sName ); 212 return hNonTerminalName.get( sName );
206} 213}
207 214
208bool Bu::Parser::hasNonTerminal( const Bu::FString &sName ) 215bool Bu::Parser::hasNonTerminal( const Bu::String &sName )
209{ 216{
210 return hNonTerminalName.has( sName ); 217 return hNonTerminalName.has( sName );
211} 218}
212 219
213int Bu::Parser::addReduction( const Bu::FString &sName, const Reduction &r ) 220int Bu::Parser::addReduction( const Bu::String &sName, const Reduction &r )
214{ 221{
215 int iId = aReduction.getSize(); 222 int iId = aReduction.getSize();
216 aReduction.append( r ); 223 aReduction.append( r );
@@ -218,7 +225,7 @@ int Bu::Parser::addReduction( const Bu::FString &sName, const Reduction &r )
218 return iId; 225 return iId;
219} 226}
220 227
221int Bu::Parser::addReduction( const Bu::FString &sName ) 228int Bu::Parser::addReduction( const Bu::String &sName )
222{ 229{
223 int iId = aReduction.getSize(); 230 int iId = aReduction.getSize();
224 aReduction.append( Reduction() ); 231 aReduction.append( Reduction() );
@@ -226,17 +233,17 @@ int Bu::Parser::addReduction( const Bu::FString &sName )
226 return iId; 233 return iId;
227} 234}
228 235
229void Bu::Parser::setReduction( const Bu::FString &sName, const Reduction &r ) 236void Bu::Parser::setReduction( const Bu::String &sName, const Reduction &r )
230{ 237{
231 aReduction[hReductionName.get(sName)] = r; 238 aReduction[hReductionName.get(sName)] = r;
232} 239}
233 240
234int Bu::Parser::getReductionId( const Bu::FString &sName ) 241int Bu::Parser::getReductionId( const Bu::String &sName )
235{ 242{
236 return hReductionName.get( sName ); 243 return hReductionName.get( sName );
237} 244}
238 245
239bool Bu::Parser::hasReduction( const Bu::FString &sName ) 246bool Bu::Parser::hasReduction( const Bu::String &sName )
240{ 247{
241 return hReductionName.has( sName ); 248 return hReductionName.has( sName );
242} 249}