Ejemplo n.º 1
0
void preprocess(void)
{
	char *line;
	int eof = 0;

	preproc_push(stdin, current_fname, /*sysh:*/0);

	while(!eof && (line = splice_lines(&eof))){
		debug_push_line(line);

		if(option_digraphs)
			line = expand_digraphs(line);

		line = strip_comment(line);
		switch(strip_in_block){
			case NOT_IN_BLOCK:
			case IN_BLOCK_BEGIN:
			case IN_BLOCK_END:
				line = filter_macros(line);
			case IN_BLOCK_FULL: /* no thanks */
				break;
		}

		debug_pop_line();

		if(line){
			if(!no_output)
				puts(line);
			free(line);
		}
	}

	switch(strip_in_block){
		case NOT_IN_BLOCK:
		case IN_BLOCK_END:
			break;
		case IN_BLOCK_BEGIN:
		case IN_BLOCK_FULL:
			CPP_DIE("no terminating block comment");
	}

	parse_end_validate();
}
Ejemplo n.º 2
0
expr *expr_parse(char *str)
{
	expr *e;

	expr_init();

	debug_push_line(str);

	tok_begin(str);
	tok_next();

	e = parse();

	if(tok_cur != tok_eof)
		CPP_DIE("'%s' at end of expression", tok_last());

	debug_pop_line();

	return e;
}