diff options
Diffstat (limited to 'src/parser.cpp')
-rw-r--r-- | src/parser.cpp | 29 |
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 | ||
175 | void Bu::Parser::setRootNonTerminal( const Bu::FString &sRoot ) | 182 | void Bu::Parser::setRootNonTerminal( const Bu::String &sRoot ) |
176 | { | 183 | { |
177 | setRootNonTerminal( hNonTerminalName.get( sRoot ) ); | 184 | setRootNonTerminal( hNonTerminalName.get( sRoot ) ); |
178 | } | 185 | } |
179 | 186 | ||
180 | int Bu::Parser::addNonTerminal( const Bu::FString &sName, NonTerminal &nt ) | 187 | int 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 | ||
189 | int Bu::Parser::addNonTerminal( const Bu::FString &sName ) | 196 | int 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 | ||
198 | void Bu::Parser::setNonTerminal( const Bu::FString &sName, NonTerminal &nt ) | 205 | void 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 | ||
203 | int Bu::Parser::getNonTerminalId( const Bu::FString &sName ) | 210 | int Bu::Parser::getNonTerminalId( const Bu::String &sName ) |
204 | { | 211 | { |
205 | return hNonTerminalName.get( sName ); | 212 | return hNonTerminalName.get( sName ); |
206 | } | 213 | } |
207 | 214 | ||
208 | bool Bu::Parser::hasNonTerminal( const Bu::FString &sName ) | 215 | bool Bu::Parser::hasNonTerminal( const Bu::String &sName ) |
209 | { | 216 | { |
210 | return hNonTerminalName.has( sName ); | 217 | return hNonTerminalName.has( sName ); |
211 | } | 218 | } |
212 | 219 | ||
213 | int Bu::Parser::addReduction( const Bu::FString &sName, const Reduction &r ) | 220 | int 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 | ||
221 | int Bu::Parser::addReduction( const Bu::FString &sName ) | 228 | int 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 | ||
229 | void Bu::Parser::setReduction( const Bu::FString &sName, const Reduction &r ) | 236 | void 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 | ||
234 | int Bu::Parser::getReductionId( const Bu::FString &sName ) | 241 | int Bu::Parser::getReductionId( const Bu::String &sName ) |
235 | { | 242 | { |
236 | return hReductionName.get( sName ); | 243 | return hReductionName.get( sName ); |
237 | } | 244 | } |
238 | 245 | ||
239 | bool Bu::Parser::hasReduction( const Bu::FString &sName ) | 246 | bool Bu::Parser::hasReduction( const Bu::String &sName ) |
240 | { | 247 | { |
241 | return hReductionName.has( sName ); | 248 | return hReductionName.has( sName ); |
242 | } | 249 | } |