mirror of
https://github.com/ZDoom/acc.git
synced 2025-02-11 22:37:54 +00:00
Enforce #library must be the first thing in an ACS file if it's used
This commit is contained in:
parent
5bf0629f2e
commit
76b8552d4d
3 changed files with 10 additions and 2 deletions
1
error.c
1
error.c
|
@ -180,6 +180,7 @@ static struct
|
|||
{ ERR_NOT_HEXEN, "Cannot save; new features are not compatible with Hexen." },
|
||||
{ ERR_SPECIAL_RANGE, "Line specials with values higher than 255 require #nocompact." },
|
||||
{ ERR_EVENT_NEEDS_3_ARG, "Event scripts must have 3 arguments." }, // [BB]
|
||||
{ ERR_LIBRARY_NOT_FIRST, "#library must come before anything else." },
|
||||
{ ERR_NONE, NULL }
|
||||
};
|
||||
|
||||
|
|
3
error.h
3
error.h
|
@ -147,7 +147,8 @@ typedef enum
|
|||
ERR_HEXEN_COMPAT,
|
||||
ERR_NOT_HEXEN,
|
||||
ERR_SPECIAL_RANGE,
|
||||
ERR_EVENT_NEEDS_3_ARG // [BB]
|
||||
ERR_EVENT_NEEDS_3_ARG, // [BB]
|
||||
ERR_LIBRARY_NOT_FIRST,
|
||||
} error_t;
|
||||
|
||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||
|
|
8
parse.c
8
parse.c
|
@ -408,14 +408,16 @@ static void CountScript(int type)
|
|||
static void Outside(void)
|
||||
{
|
||||
boolean done;
|
||||
int outertokencount;
|
||||
|
||||
done = NO;
|
||||
outertokencount = 0;
|
||||
while(done == NO)
|
||||
{
|
||||
outertokencount++;
|
||||
switch(tk_Token)
|
||||
{
|
||||
case TK_EOF:
|
||||
|
||||
done = YES;
|
||||
break;
|
||||
case TK_SCRIPT:
|
||||
|
@ -496,6 +498,10 @@ static void Outside(void)
|
|||
OuterImport();
|
||||
break;
|
||||
case TK_LIBRARY:
|
||||
if (outertokencount != 1)
|
||||
{
|
||||
ERR_Error(ERR_LIBRARY_NOT_FIRST, YES);
|
||||
}
|
||||
TK_NextTokenMustBe(TK_STRING, ERR_STRING_LIT_NOT_FOUND);
|
||||
if(ImportMode == IMPORT_None)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue