int main() { int32_t s, tk; lexer_t lex; init_smt_stdin_lexer(&lex); /* * NOTE: Clang (version 3.2) gives the following warning for s<NSTATES: * * comparison of constant 64 with expression of type 'state_t' * (aka 'enum state_s') is always true. * * It gives no warning for tk<NUM_SMT_TOKENS. * * I've changed the declaration of s: it used to be 'state_t s' * instead of 'int32_t s' */ for (s=0; s<NSTATES; s++) { printf("Source state %s\n", state2string[s]); for (tk=SMT_TK_LP; tk<NUM_SMT_TOKENS; tk++) { printf(" %20s %s\n", smt_token_to_string(tk), action2string[get_action(s, tk)]); } printf("\n"); } close_lexer(&lex); return 0; }
static void print_token(token_t tk) { uint32_t n; char *s; int32_t code; printf("---> Token %s\n", smt_token_to_string(tk)); printf(" pos = %"PRIu64", line = %"PRIu32", column = %"PRIu32"\n", lexer.tk_pos, lexer.tk_line, lexer.tk_column); n = current_token_length(&lexer); s = current_token_value(&lexer); if (n > 0) { printf(" value: %s\n", s); printf(" length: %"PRIu32"\n", n); } switch (tk) { case SMT_TK_BV_BINCONSTANT: if (n < 5) { printf("***** ERROR ******\n"); } else { n = n - 5; // remove bvbin prefix if (n < 100) { code = bvconst_set_from_string(bitvector, n, s + 5); if (code < 0) { printf("***** ERROR ******\n"); } else { printf(" val: "); bvconst_print(stdout, bitvector, n); printf("\n\n"); } } } break; case SMT_TK_BV_HEXCONSTANT: if (n < 5) { printf("***** ERROR ******\n"); } else { n = n - 5; // remove bvhex prefix and null terminator if (n < 100) { code = bvconst_set_from_hexa_string(bitvector, n, s + 5); if (code < 0) { printf("***** ERROR ******\n"); } else { printf(" val: "); bvconst_print(stdout, bitvector, 4 * n); printf("\n\n"); } } } break; } }