Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinniefalco/61f868c0a5de82365ad9e1c6210fbc87 to your computer and use it in GitHub Desktop.
Save vinniefalco/61f868c0a5de82365ad9e1c6210fbc87 to your computer and use it in GitHub Desktop.
void parse_white_and_comments()
{
for(;;)
{
maybe_skip_white();
if(*cs != '/')
return;
++cs;
do_wht1:
if(! cs)
return suspend(state::wht1);
if(*cs == '/')
{
// C++ comment
++cs;
do_wht2:
if(! skip_to_newline())
return suspend(state::wht2);
}
else if(*cs == '*')
{
// C comment
++cs;
do_wht3:
if(! skip_to_closing_comment())
return suspend(state::wht3);
}
else
{
ec_ = error::bad_comment;
return;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment