Skip to content

Commit b77e76f

Browse files
committed
basic: make sure there's a space between keyword and identifier
1 parent b5cedcc commit b77e76f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

parsers/basic.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,23 @@ static int match_keyword (const char *p, KeyWord const *kw)
100100
vString *name;
101101
size_t i;
102102
int j;
103+
const char *old_p;
103104
for (i = 0; i < strlen (kw->token); i++)
104105
{
105106
if (tolower (p[i]) != kw->token[i])
106107
return 0;
107108
}
108-
name = vStringNew ();
109109
p += i;
110+
111+
old_p = p;
112+
while (isspace (*p))
113+
p++;
114+
115+
/* create tags only if there is some space between the keyword and the identifier */
116+
if (old_p == p)
117+
return 0;
118+
119+
name = vStringNew ();
110120
for (j = 0; j < 1 + kw->skip; j++)
111121
{
112122
p = extract_name (p, name);

0 commit comments

Comments
 (0)