MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / scan_comment

Method scan_comment

Source/Utils/json.hpp:6715–6780  ·  view source on GitHub ↗

! * @brief scan a comment * @return whether comment could be scanned successfully */

Source from the content-addressed store, hash-verified

6713 * @return whether comment could be scanned successfully
6714 */
6715 bool scan_comment()
6716 {
6717 switch (get())
6718 {
6719 // single-line comments skip input until a newline or EOF is read
6720 case '/':
6721 {
6722 while (true)
6723 {
6724 switch (get())
6725 {
6726 case '\n':
6727 case '\r':
6728 case std::char_traits<char_type>::eof():
6729 case '\0':
6730 return true;
6731
6732 default:
6733 break;
6734 }
6735 }
6736 }
6737
6738 // multi-line comments skip input until */ is read
6739 case '*':
6740 {
6741 while (true)
6742 {
6743 switch (get())
6744 {
6745 case std::char_traits<char_type>::eof():
6746 case '\0':
6747 {
6748 error_message = "invalid comment; missing closing '*/'";
6749 return false;
6750 }
6751
6752 case '*':
6753 {
6754 switch (get())
6755 {
6756 case '/':
6757 return true;
6758
6759 default:
6760 {
6761 unget();
6762 continue;
6763 }
6764 }
6765 }
6766
6767 default:
6768 continue;
6769 }
6770 }
6771 }
6772

Callers

nothing calls this directly

Calls 2

getFunction · 0.85
ungetFunction · 0.85

Tested by

no test coverage detected