KviKvsTreeNode * KviKvsParser::parseComment() { KVSP_ASSERT((KVSP_curCharUnicode == '#') || (KVSP_curCharUnicode == '/')); switch(KVSP_curCharUnicode) { case '#': // bash style skipToNextLine(); break; case '/': KVSP_skipChar; switch(KVSP_curCharUnicode) { case '/': // c++ style skipToNextLine(); break; case '*': { const QChar * pBegin = KVSP_curCharPointer; // c style, multiline KVSP_skipChar; for(;;) { switch(KVSP_curCharUnicode) { case 0: warning(pBegin,__tr2qs_ctx("Unterminated c-style multiline comment","kvs")); error(KVSP_curCharPointer,__tr2qs_ctx("Unexpected end of script in multiline comment","kvs")); return 0; break; case '*': while(KVSP_curCharUnicode == '*') KVSP_skipChar; if(KVSP_curCharUnicode == '/') { KVSP_skipChar; return 0; } break; } KVSP_skipChar; } } break; default: error(KVSP_curCharPointer,__tr2qs_ctx("Unexpected character '%q' (unicode %x) after a slash (is it a typo or a malformed comment begin?)","kvs"),KVSP_curCharPointer,KVSP_curCharUnicode); return 0; break; } break; default: // shouldn't be here :/ KVSP_ASSERT(false); break; } return 0; }
bool CTokenizerNoComments::nextToken() { while(CTokenizer::nextToken()){ if(token == "//"){ skipToNextLine(); } else { return true; } } return false; }