Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed memory leaks in parser #23

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
extern FILE *yyin;
int yylex(void);
void yyerror(const char *);
int yylex_destroy(void);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int yylex_destroy(void);
int yylex_destroy(void);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine in ide, github indentation just looks weird

Copy link
Collaborator

@Jpnock Jpnock Mar 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are using a tab. The rest of this block is using 4 spaces.

}

// Represents the value associated with any kind of AST node.
Expand Down Expand Up @@ -202,5 +203,7 @@ Node *ParseAST(std::string file_name)
}
g_root = nullptr;
yyparse();
fclose(yyin);
yylex_destroy();
return g_root;
}
3 changes: 3 additions & 0 deletions src/parser_full.y.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
extern FILE *yyin;
int yylex(void);
void yyerror(const char *);
int yylex_destroy(void);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int yylex_destroy(void);
int yylex_destroy(void);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

}

// Represents the value associated with any kind of AST node.
Expand Down Expand Up @@ -468,5 +469,7 @@ Node *ParseAST(std::string file_name)
}
g_root = nullptr;
yyparse();
fclose(yyin);
yylex_destroy();
return g_root;
}
Loading