void describe_token_history(int st, int en) {
	int i;
	if (describe_token_off) return;
	//since idx is ++ed every time a token is read,
	//the real index of last token should always - 1
	//and because of the pre-getting of token,
	//the end index should always - 1
	for(i = st - 1; i <= en - 2; i++)
		describe_token(token_history[i]);
	printf("\n");
}
Beispiel #2
0
int
main(int argc, char **argv)
{
    char *filename = argv[1];
    int tok;
    
    rb = rb_new();
    if (!yylex_push_file(filename))
    	return 1;
	
    while ((tok = yylex()) != 0)
    {
    	fprintf(stderr, "%s:%d:%s:%s\n",
	    yylocation.filename,
	    yylocation.lineno,
	    describe_token(tok),
	    describe_yylval(tok));
    }
    
    return 0;
}