1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Ignore comments at the beginning of the declarations section.

This commit is contained in:
Bruno Haible
2003-05-02 03:59:36 +00:00
parent c170151d67
commit 31f7c8a49e
3 changed files with 102 additions and 5 deletions

View File

@@ -620,15 +620,57 @@ Input::read_input ()
{
if (struct_decl)
{
/* Drop leading whitespace. */
/* Drop leading whitespace and comments. */
{
char *p = struct_decl;
unsigned int *l = struct_decl_linenos;
while (p[0] == '\n' || p[0] == ' ' || p[0] == '\t')
for (;;)
{
if (p[0] == ' ' || p[0] == '\t')
{
p++;
continue;
}
if (p[0] == '\n')
l++;
p++;
{
l++;
p++;
continue;
}
if (p[0] == '/')
{
if (p[1] == '*')
{
/* Skip over ANSI C style comment. */
p += 2;
while (p[0] != '\0')
{
if (p[0] == '*' && p[1] == '/')
{
p += 2;
break;
}
if (p[0] == '\n')
l++;
p++;
}
continue;
}
if (p[1] == '/')
{
/* Skip over ISO C99 or C++ style comment. */
p += 2;
while (p[0] != '\0' && p[0] != '\n')
p++;
if (p[0] == '\n')
{
l++;
p++;
}
continue;
}
}
break;
}
if (p != struct_decl)
{