parser.c

changeset 17
a034888a2227
parent 14
91f0c87b62a7
child 20
3f11f764772a
equal deleted inserted replaced
16:f597c8f0bcc9 17:a034888a2227
444 */ 444 */
445 445
446 446
447 static int arg_match(Token *tok, char c) 447 static int arg_match(Token *tok, char c)
448 { 448 {
449 static const char chs[]={0, 'l', 'd', 'c', 's', 'i', 0, 0}; 449 static const char chs[]={0, 'l', 'd', 'c', 's', 'i', 'b', 0, 0};
450 char c2; 450 char c2;
451 451
452 if(c=='.' || c=='*') 452 if(c=='.' || c=='*')
453 return 0; 453 return 0;
454 454
470 if(c2=='l' && c=='d'){ 470 if(c2=='l' && c=='d'){
471 TOK_SET_DOUBLE(tok, TOK_LONG_VAL(tok)); 471 TOK_SET_DOUBLE(tok, TOK_LONG_VAL(tok));
472 return 0; 472 return 0;
473 } 473 }
474 474
475 if(c=='b'){
476 if(c2=='l'){
477 TOK_SET_BOOL(tok, TOK_LONG_VAL(tok));
478 return 0;
479 }else if(c2=='i'){
480 if(strcmp(TOK_IDENT_VAL(tok), "TRUE")==0){
481 tok_free(tok);
482 TOK_SET_BOOL(tok, TRUE);
483 return 0;
484 }else if(strcmp(TOK_IDENT_VAL(tok), "FALSE")==0){
485 tok_free(tok);
486 TOK_SET_BOOL(tok, FALSE);
487 return 0;
488 }
489 }
490 }
491
475 return E_TOKZ_INVALID_ARGUMENT; 492 return E_TOKZ_INVALID_ARGUMENT;
476 } 493 }
477 494
478 495
479 static int check_argument(const char **pret, Token *tok, const char *p) 496 static int check_argument(const char **pret, Token *tok, const char *p)

mercurial