trap file loading improvements

This commit is contained in:
Kelvin Sherlock 2013-07-14 15:17:59 -04:00
parent 81ce611bfc
commit 23ff00baa7

View File

@ -19,16 +19,24 @@
action emplace { action emplace {
auto iter = map.find(name); auto iter = map.find(name);
if (iter != map.end() && iter->second != trap)
if (iter == map.end())
{ {
fprintf(stderr, "Warning: redefining %s ($%04x -> $%04x)\n", map[std::move(name)] = trap;
name.c_str(), }
iter->second, else
trap {
if (iter->second != trap)
{
fprintf(stderr, "Warning: redefining %s ($%04x -> $%04x)\n",
name.c_str(),
iter->second,
trap
); );
iter->second = trap;
}
} }
map[std::move(name)] = trap;
} }
ws = [ \t]; ws = [ \t];
@ -112,7 +120,7 @@ std::unordered_map<std::string, uint32_t> LoadTrapFile(const std::string &path)
const char *p = buffer.c_str(); const char *p = buffer.c_str();
const char *pe = p + buffer.length(); const char *pe = p + buffer.length();
const char *eof = pe; //const char *eof = pe;
const char *ts; const char *ts;
const char *te; const char *te;