Commit bf19c1a0 authored by John Stiles's avatar John Stiles

Remove switch

GCC and Clang cannot agree on what constitutes a good switch statement.
parent e7fd7076
...@@ -139,50 +139,33 @@ bool LookaheadParser::EnterArray() { ...@@ -139,50 +139,33 @@ bool LookaheadParser::EnterArray() {
} }
const char* LookaheadParser::NextObjectKey() { const char* LookaheadParser::NextObjectKey() {
switch (st_) { if (st_ == kHasKey) {
case kHasKey: { const char* result = v_.GetString();
const char* result = v_.GetString(); ParseNext();
ParseNext(); return result;
return result; }
}
if (st_ == kExitingObject) {
case kExitingObject: ParseNext();
ParseNext(); return 0;
return 0;
case kError:
case kHasNull:
case kHasBool:
case kHasNumber:
case kHasString:
case kEnteringObject:
case kEnteringArray:
case kExitingArray:
st_ = kError;
return 0;
} }
st_ = kError;
return 0;
} }
bool LookaheadParser::NextArrayValue() { bool LookaheadParser::NextArrayValue() {
switch (st_) { if (st_ == kExitingArray) {
case kExitingArray: ParseNext();
ParseNext(); return false;
return false; }
case kError: if (st_ == kError || st_ == kExitingObject || st_ == kHasKey) {
case kExitingObject: st_ = kError;
case kHasKey: return false;
st_ = kError;
return false;
case kHasNull:
case kHasBool:
case kHasNumber:
case kHasString:
case kEnteringObject:
case kEnteringArray:
return true;
} }
return true;
} }
int LookaheadParser::GetInt() { int LookaheadParser::GetInt() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment