Created
March 22, 2020 02:47
-
-
Save vinniefalco/c0e026a2ffc4cf622b0ff6f09e2651e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void | |
basic_parser:: | |
parse_null(char_stream& cs0) | |
{ | |
state st; | |
detail::local_char_stream cs(cs0); | |
if(BOOST_JSON_LIKELY(stk_.empty())) | |
{ | |
BOOST_ASSERT(cs[0] == 'n'); | |
if(BOOST_JSON_LIKELY(cs.remain() >= 4)) | |
{ | |
if(BOOST_JSON_LIKELY( | |
cs[1] == 'u' && | |
cs[2] == 'l' && | |
cs[3] == 'l')) | |
{ | |
this->on_null(ec_); | |
if(BOOST_JSON_LIKELY(! ec_)) | |
cs.skip(4); | |
return; | |
} | |
ec_ = error::expected_null; | |
return; | |
} | |
cs.get(); | |
st = state::nul1; | |
} | |
else | |
{ | |
stk_.pop(st); | |
} | |
char c; | |
switch(st) | |
{ | |
case state::nul1: | |
c = cs.peek(); | |
if(c != 'u') | |
{ | |
if(c != 0) | |
{ | |
ec_ = error::expected_null; | |
return; | |
} | |
stk_.push(state::nul1); | |
ec_ = error::end_of_stream; | |
return; | |
} | |
cs.get(); | |
BOOST_FALLTHROUGH; | |
case state::nul2: | |
c = cs.peek(); | |
if(c != 'l') | |
{ | |
if(c != 0) | |
{ | |
ec_ = error::expected_null; | |
return; | |
} | |
stk_.push(state::nul2); | |
ec_ = error::end_of_stream; | |
return; | |
} | |
cs.get(); | |
BOOST_FALLTHROUGH; | |
case state::nul3: | |
c = cs.peek(); | |
if(c != 'l') | |
{ | |
if(c != 0) | |
{ | |
ec_ = error::expected_null; | |
return; | |
} | |
stk_.push(state::nul3); | |
ec_ = error::end_of_stream; | |
return; | |
} | |
cs.get(); | |
break; | |
} | |
this->on_null(ec_); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment