MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / scan_comment

Method scan_comment

extern/json/json.hpp:8149–8214  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

8147 * @return whether comment could be scanned successfully
8148 */
8149 bool scan_comment()
8150 {
8151 switch (get())
8152 {
8153 // single-line comments skip input until a newline or EOF is read
8154 case '/':
8155 {
8156 while (true)
8157 {
8158 switch (get())
8159 {
8160 case '\n':
8161 case '\r':
8162 case std::char_traits<char_type>::eof():
8163 case '\0':
8164 return true;
8165
8166 default:
8167 break;
8168 }
8169 }
8170 }
8171
8172 // multi-line comments skip input until */ is read
8173 case '*':
8174 {
8175 while (true)
8176 {
8177 switch (get())
8178 {
8179 case std::char_traits<char_type>::eof():
8180 case '\0':
8181 {
8182 error_message = "invalid comment; missing closing '*/'";
8183 return false;
8184 }
8185
8186 case '*':
8187 {
8188 switch (get())
8189 {
8190 case '/':
8191 return true;
8192
8193 default:
8194 {
8195 unget();
8196 continue;
8197 }
8198 }
8199 }
8200
8201 default:
8202 continue;
8203 }
8204 }
8205 }
8206

Callers

nothing calls this directly

Calls 2

ungetFunction · 0.85
getFunction · 0.70

Tested by

no test coverage detected