/** enter_scope enter a new nested scope. Increment the nesting * level. push new scope's symbol table onto the * stack. * */ void cx_symtab_stack::enter_scope(void) { if (++current_nesting_level > max_nesting_level) { cx_error(err_nesting_too_deep); abort_translation(abort_nesting_too_deep); } set_current_symtab(new cx_symtab); }
/** enter_scope enter a new nested scope. Increment the nesting * level. push new scope's symbol table onto the * stack. * */ void cx_symtab_stack::enter_scope(void) { // dont overwrite mains scope //if (current_nesting_level <= 1)++current_nesting_level; if (++current_nesting_level > max_nesting_level) { cx_error(err_nesting_too_deep); abort_translation(abort_nesting_too_deep); } set_current_symtab(new cx_symtab); }
/** Constructor Construct a input text buffer by opening the * input file. * * @param p_input_file_name : ptr to the name of the input file * @param ac : abort code to use if open failed */ cx_text_in_buffer::cx_text_in_buffer(const char *p_input_file_name, cx_abort_code ac) : p_file_name(new char[strlen(p_input_file_name) + 1]) { // Copy the input file name. strcpy(p_file_name, p_input_file_name); // Open the input file. Abort if failed. file.open(p_file_name, std::ios::in); if (!file.good()) { std::cout << p_file_name << ": " << std::strerror(errno) << std::endl; abort_translation(ac); } }