summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/parser.cpp47
1 files changed, 42 insertions, 5 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 8e30d24..c83c156 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -201,13 +201,50 @@ void Parser::statement()
201 { 201 {
202 lex.setMode( Lexer::modeCommand ); 202 lex.setMode( Lexer::modeCommand );
203 output( lex[0] ); 203 output( lex[0] );
204 for(;;) 204 switch( lex[0].eType )
205 { 205 {
206 lex.nextToken(); 206 case Token::tCmdScale:
207 if( lex[0].eType == Token::tEndOfLine || 207 {
208 lex[0].eType == Token::tEndOfInput ) 208 lex.nextToken();
209 Bu::sio << "token: " << lex[0] << Bu::sio.nl;
210 if( lex[0].eType != Token::tCmdParam )
211 throw Bu::ExceptionBase("\\scale requires a single parameter.");
212 int iScale = strtol(lex[0].sVal->getStr(), NULL, 10);
213 output( lex[0] );
214 lex.nextToken();
215 if( lex[0].eType != Token::tCmdEndParams )
216 throw Bu::ExceptionBase("\\scale requires a single parameter.");
217 output( lex[0] );
218
219 lex.setScale( iScale );
220 }
221 break;
222
223 case Token::tCmdRadix:
224 {
225 lex.nextToken();
226 if( lex[0].eType != Token::tCmdParam )
227 throw Bu::ExceptionBase("\\radix requires a single parameter.");
228 int iRadix = strtol(lex[0].sVal->getStr(), NULL, 10);
229 output( lex[0] );
230 lex.nextToken();
231 if( lex[0].eType != Token::tCmdEndParams )
232 throw Bu::ExceptionBase("\\radix requires a single parameter.");
233 output( lex[0] );
234
235 lex.setRadix( iRadix );
236 }
237 break;
238
239 default:
240 for(;;)
241 {
242 lex.nextToken();
243 output( lex[0] );
244 if( lex[0].eType == Token::tCmdEndParams )
245 break;
246 }
209 break; 247 break;
210 output( lex[0] );
211 } 248 }
212 lex.setMode( Lexer::modeNormal ); 249 lex.setMode( Lexer::modeNormal );
213 } 250 }