mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
Fix a bug with embedded commands and make the parser more anal about what
can be embedded.
This commit is contained in:
parent
d2edce37a4
commit
7f72596ab5
2 changed files with 14 additions and 8 deletions
|
@ -204,12 +204,6 @@ GIB_Execute (cbuf_t * cbuf)
|
|||
return;
|
||||
g->ip = g->ip ? g->ip->next : g->program;
|
||||
while (g->ip) {
|
||||
if (g->ip->flags & TREE_L_EMBED) {
|
||||
// Get ready for return values
|
||||
g->waitret = true;
|
||||
GIB_Buffer_Push_Sstack (cbuf);
|
||||
} else
|
||||
g->waitret = false;
|
||||
switch (g->ip->type) {
|
||||
case TREE_T_JUMP:
|
||||
g->ip = g->ip->jump;
|
||||
|
@ -241,7 +235,13 @@ GIB_Execute (cbuf_t * cbuf)
|
|||
case TREE_T_CMD:
|
||||
if (GIB_Execute_Prepare_Line (cbuf, g->ip))
|
||||
return;
|
||||
else if (cbuf->args->argc) {
|
||||
if (g->ip->flags & TREE_L_EMBED) {
|
||||
// Get ready for return values
|
||||
g->waitret = true;
|
||||
GIB_Buffer_Push_Sstack (cbuf);
|
||||
} else
|
||||
g->waitret = false;
|
||||
if (cbuf->args->argc) {
|
||||
if ((b = GIB_Builtin_Find (cbuf->args->argv[0]->str)))
|
||||
b->func ();
|
||||
else if ((f = GIB_Function_Find (cbuf->args->argv[0]->str))) {
|
||||
|
|
|
@ -509,6 +509,9 @@ GIB_Parse_Semantic_Preprocess (gib_tree_t * line)
|
|||
|| !line->children->next->next->next->next) {
|
||||
GIB_Parse_Error ("Malformed 'for' statement.", line->start);
|
||||
return line;
|
||||
} else if (line->flags & TREE_L_EMBED) {
|
||||
GIB_Parse_Error ("'for' statements may not be used in embedded commands.", line->start);
|
||||
return line;
|
||||
}
|
||||
// Find last token in line (contains program block)
|
||||
for (tmp = line->children->next->next->next->next; tmp->next;
|
||||
|
@ -552,8 +555,11 @@ GIB_Parse_Semantic_Preprocess (gib_tree_t * line)
|
|||
!(line->children->next->flags & TREE_A_CONCAT) &&
|
||||
line->children->next->delim == ' ' &&
|
||||
!strcmp (line->children->next->str, "=")
|
||||
)
|
||||
) {
|
||||
if (line->flags & TREE_L_EMBED)
|
||||
GIB_Parse_Error ("Assignment may not be used as an embedded command.", line->start);
|
||||
line->type = TREE_T_ASSIGN;
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue