Skip to content

Commit c888316

Browse files
committed
basic: Don't determine keywords based on file extension
1 parent 3a24b76 commit c888316

File tree

1 file changed

+13
-30
lines changed

1 file changed

+13
-30
lines changed

parsers/basic.c

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,8 @@ static kindDefinition BasicKinds[] = {
4949
{true, 'g', "enum", "enumerations"}
5050
};
5151

52-
static KeyWord blitzbasic_keywords[] = {
53-
{"const", K_CONST, 0},
54-
{"global", K_VARIABLE, 0},
55-
{"dim", K_VARIABLE, 0},
56-
{"function", K_FUNCTION, 0},
57-
{"type", K_TYPE, 0},
58-
{NULL, 0, 0}
59-
};
60-
61-
static KeyWord purebasic_keywords[] = {
62-
{"newlist", K_VARIABLE, 0},
63-
{"global", K_VARIABLE, 0},
64-
{"dim", K_VARIABLE, 0},
65-
{"procedure", K_FUNCTION, 0},
66-
{"interface", K_TYPE, 0},
67-
{"structure", K_TYPE, 0},
68-
{NULL, 0, 0}
69-
};
70-
71-
static KeyWord freebasic_keywords[] = {
52+
static KeyWord basic_keywords[] = {
53+
/* freebasic */
7254
{"const", K_CONST, 0},
7355
{"dim as", K_VARIABLE, 1},
7456
{"dim", K_VARIABLE, 0},
@@ -81,6 +63,16 @@ static KeyWord freebasic_keywords[] = {
8163
{"public function", K_FUNCTION, 0},
8264
{"type", K_TYPE, 0},
8365
{"enum", K_ENUM, 0},
66+
67+
/* blitzbasic, purebasic */
68+
{"global", K_VARIABLE, 0},
69+
70+
/* purebasic */
71+
{"newlist", K_VARIABLE, 0},
72+
{"procedure", K_FUNCTION, 0},
73+
{"interface", K_TYPE, 0},
74+
{"structure", K_TYPE, 0},
75+
8476
{NULL, 0, 0}
8577
};
8678

@@ -151,15 +143,6 @@ static void match_dot_label (char const *p)
151143
static void findBasicTags (void)
152144
{
153145
const char *line;
154-
const char *extension = fileExtension (getInputFileName ());
155-
KeyWord *keywords;
156-
157-
if (strcmp (extension, "bb") == 0)
158-
keywords = blitzbasic_keywords;
159-
else if (strcmp (extension, "pb") == 0)
160-
keywords = purebasic_keywords;
161-
else
162-
keywords = freebasic_keywords;
163146

164147
while ((line = (const char *) readLineFromInputFile ()) != NULL)
165148
{
@@ -183,7 +166,7 @@ static void findBasicTags (void)
183166
continue;
184167

185168
/* In Basic, keywords always are at the start of the line. */
186-
for (kw = keywords; kw->token; kw++)
169+
for (kw = basic_keywords; kw->token; kw++)
187170
if (match_keyword (p, kw)) break;
188171

189172
/* Is it a label? */

0 commit comments

Comments
 (0)