diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2016-12-19 11:16:00 -0700 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2016-12-19 11:16:00 -0700 |
| commit | 3bb307b470876561509904172d3aaede10e5eb62 (patch) | |
| tree | dd517001eb8dd3b21a527e2678646200607d9a90 /src | |
| parent | b6891480dfb41336a4dfeee95e0c52301e7e6f62 (diff) | |
| download | clic-3bb307b470876561509904172d3aaede10e5eb62.tar.gz clic-3bb307b470876561509904172d3aaede10e5eb62.tar.bz2 clic-3bb307b470876561509904172d3aaede10e5eb62.tar.xz clic-3bb307b470876561509904172d3aaede10e5eb62.zip | |
Parser updates, it's having trouble with command parameters.
should be an easy fix.
Diffstat (limited to '')
| -rw-r--r-- | src/parser.cpp | 47 |
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 | } |
