runner and parser together add entries ok
This commit is contained in:
10
src/runner.c
10
src/runner.c
@ -59,7 +59,7 @@ int check_flag(char *arg, char *alpha) {
|
||||
|
||||
int run(FILE *alpha) {
|
||||
int token;
|
||||
curr = CreateScope(NULL, 1, 1);
|
||||
cur = CreateScope(NULL, 1, 1);
|
||||
|
||||
// If file is not found
|
||||
if (alpha == NULL) {
|
||||
@ -108,7 +108,7 @@ int run(FILE *alpha) {
|
||||
|
||||
yyparse();
|
||||
FILE *f = fdopen(1, "w");
|
||||
print_symbol_table(getAncestor(curr), f);
|
||||
print_symbol_table(getAncestor(cur), f);
|
||||
fclose(f);
|
||||
|
||||
if (yyin != NULL) {
|
||||
@ -179,12 +179,12 @@ int is_alpha_file(char *alpha, int file_len) {
|
||||
}
|
||||
|
||||
void enter_scope(int line, int column) {
|
||||
curr = CreateScope(curr, line, column);
|
||||
cur = CreateScope(cur, line, column);
|
||||
}
|
||||
void exit_scope() {
|
||||
if (curr->Parent_Scope == NULL) {
|
||||
if (cur->Parent_Scope == NULL) {
|
||||
printf("Can't close top");
|
||||
return;
|
||||
}
|
||||
curr = curr->Parent_Scope;
|
||||
cur = cur->Parent_Scope;
|
||||
}
|
||||
|
Reference in New Issue
Block a user