Skip to content

Commit

Permalink
init branch with slight changes to the code in gapc.cc and signature.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
dtischle committed Nov 21, 2023
1 parent 918dcfe commit e60a182
Show file tree
Hide file tree
Showing 20 changed files with 13,075 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/alt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,7 @@ void Alt::Multi::print(std::ostream &s) {
s << " > ";
}

// ret_ variablen in out.cc hier veränderbar

void Alt::Base::init_ret_decl(unsigned int i, const std::string &prefix) {
std::ostringstream o;
Expand Down
14 changes: 8 additions & 6 deletions src/cpp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ void Printer::Cpp::print_eqs(const std::list<Statement::Var_Decl*> &l, char c) {
}


void Printer::Cpp::print_most_decl(const Symbol::NT &nt) {
void Printer::Cpp::print_most_decl(const Symbol::NT &nt) { // header instance variables in class out for resulting out.hh
::Type::Base *type = new Type::Size();
for (size_t t = nt.track_pos(); t < nt.track_pos() + nt.tracks(); ++t) {
stream << indent() << *type << " t_" << t << "_left_most;" << endl;
Expand Down Expand Up @@ -1075,7 +1075,7 @@ void Printer::Cpp::print_window_inc(const Symbol::NT &nt) {
}


void Printer::Cpp::print(const Statement::Table_Decl &t) {
void Printer::Cpp::print(const Statement::Table_Decl &t) { // Should print statements in Header of out.hh
in_class = true;
bool wmode = ast && ast->window_mode;
bool checkpoint = ast && ast->checkpoint && !ast->checkpoint->is_buddy;
Expand Down Expand Up @@ -1928,8 +1928,11 @@ void Printer::Cpp::print_subseq_typedef(const AST &ast) {
<< ", unsigned> TUSubsequence;\n\n";
}

void Printer::Cpp::enum_graph_print(){
stream << indent() << "unsigned int parentID" << endl;
}

void Printer::Cpp::header(const AST &ast) {
void Printer::Cpp::header(const AST &ast) { //generates out.hh prints
if (!ast.code_mode().subopt_buddy()) {
stream << endl << make_comments(id_string, "//") << endl << endl;
stream << "#ifndef " << class_name << "_hh" << endl
Expand Down Expand Up @@ -2149,7 +2152,7 @@ void Printer::Cpp::print_stats_fn(const AST &ast) {

void Printer::Cpp::header_footer(const AST &ast) {
dec_indent();
stream << indent() << " private:" << endl;
stream << indent() << " private:" << endl; // printed unter bei cyk()
inc_indent();
if (ast.checkpoint && !ast.checkpoint->is_buddy) {
nt_tables &tabulated = ast.grammar()->tabulated;
Expand Down Expand Up @@ -2506,9 +2509,8 @@ void Printer::Cpp::print_value_pp(const AST &ast) {
stream << indent() << "} else {" << endl;
inc_indent();
stream << indent() << "out << res << '\\n';" << endl;
dec_indent();
indent();
stream << indent() << '}' << endl;

dec_indent();
stream << indent() << '}' << endl << endl;
}
Expand Down
1 change: 1 addition & 0 deletions src/cpp.hh
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class Cpp : public Base {

void print(const Type::Multi &expr);

void enum_graph_print();
void header(const AST &ast);
void header_footer(const AST &ast);
void footer(const AST &ast);
Expand Down
8 changes: 8 additions & 0 deletions src/gapc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ class Main {
*/
void back(Instance *i = 0, Instance *instance_buddy = 0) {
Instance *instance = i;

if (!i || instance_buddy) {
if (opts.backtrack || opts.subopt || opts.kbacktrack) {
instance = driver.ast.split_instance_for_backtrack(opts.instance);
Expand Down Expand Up @@ -679,6 +680,8 @@ class Main {
+ opts.plot_grammar_file + " > foo.pdf' to generate a PDF.");
}



driver.ast.set_class_name(opts.class_name);


Expand All @@ -692,6 +695,11 @@ class Main {
Printer::Cpp hh(driver.ast, opts.h_stream());
hh.set_argv(argv, argc);
hh.class_name = opts.class_name;
if (opts.product == "enum_graph") {
hh.enum_graph_print(); // Works kindly, but on wrong spot in the script. need any way to include this only with enum_graph in header method
}
// opts.product == enum_graph einfach polymorphe header methode schreiben

hh.header(driver.ast);
hh.begin_fwd_decls();
driver.ast.print_code(hh);
Expand Down
Loading

0 comments on commit e60a182

Please sign in to comment.