mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-23 11:32:07 +00:00
Merge pull request #119 from Ben10do/add-end-checks
Verify that IFs, REPTs and MACROs are terminated
This commit is contained in:
@@ -182,6 +182,10 @@ void copyrept( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (level != 0) {
|
||||||
|
fatalerror("Unterminated REPT block");
|
||||||
|
}
|
||||||
|
|
||||||
len=src-pCurrentBuffer->pBuffer-4;
|
len=src-pCurrentBuffer->pBuffer-4;
|
||||||
|
|
||||||
src=pCurrentBuffer->pBuffer;
|
src=pCurrentBuffer->pBuffer;
|
||||||
@@ -257,6 +261,10 @@ void copymacro( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (level != 0) {
|
||||||
|
fatalerror("Unterminated MACRO definition");
|
||||||
|
}
|
||||||
|
|
||||||
len=src-pCurrentBuffer->pBuffer-4;
|
len=src-pCurrentBuffer->pBuffer-4;
|
||||||
|
|
||||||
src=pCurrentBuffer->pBuffer;
|
src=pCurrentBuffer->pBuffer;
|
||||||
@@ -348,6 +356,10 @@ void if_skip_to_else( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (level != 0) {
|
||||||
|
fatalerror("Unterminated IF construct");
|
||||||
|
}
|
||||||
|
|
||||||
len=src-pCurrentBuffer->pBuffer;
|
len=src-pCurrentBuffer->pBuffer;
|
||||||
|
|
||||||
yyskipbytes( len );
|
yyskipbytes( len );
|
||||||
@@ -403,6 +415,10 @@ void if_skip_to_endc( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (level != 0) {
|
||||||
|
fatalerror("Unterminated IF construct");
|
||||||
|
}
|
||||||
|
|
||||||
len=src-pCurrentBuffer->pBuffer;
|
len=src-pCurrentBuffer->pBuffer;
|
||||||
|
|
||||||
yyskipbytes( len );
|
yyskipbytes( len );
|
||||||
|
|||||||
Reference in New Issue
Block a user