Handle end-of-file inside of comments, local declarations.
diff --git a/libacc/acc.cpp b/libacc/acc.cpp
index 816902e..a00a633 100644
--- a/libacc/acc.cpp
+++ b/libacc/acc.cpp
@@ -1995,18 +1995,21 @@
}
} else if ((tok == '/') & (ch == '*')) {
inp();
- while (ch) {
- while (ch != '*')
+ while (ch && ch != EOF) {
+ while (ch != '*' && ch != EOF)
inp();
inp();
if (ch == '/')
ch = 0;
}
+ if (ch == EOF) {
+ error("End of file inside comment.");
+ }
inp();
next();
} else if ((tok == '/') & (ch == '/')) {
inp();
- while (ch && (ch != '\n')) {
+ while (ch && (ch != '\n') && (ch != EOF)) {
inp();
}
inp();
@@ -2489,7 +2492,7 @@
Type base;
while (acceptType(base)) {
- while (tok != ';') {
+ while (tok != ';' && tok != EOF) {
Type t = acceptPointerDeclaration(t);
addLocalSymbol();
if (tok) {