An empty binary file terminated with __end was causing problems as the
very first peek call would return null, causing Loader to fall back to
indirect loading. However, the __end was already processed by peek, so
the parse call would fail.
{
if(p.peek(0))
load_direct(p, 0);
- else
+ else if(p) // Peek may have processed an __end, so recheck goodness
{
// Parse in raw mode so we can peek immediately after a mode change
Statement st = p.parse(true);
const StatementKey *Parser::peek(unsigned level)
{
- while(1)
+ while(good)
{
const StatementKey *key = mode->peek(level);
if(key && !key->keyword.compare(0, 2, "__"))
else
return key;
}
+
+ return 0;
}
bool Parser::parse_and_load(unsigned level, Loader &ldr, const LoaderAction &act)