From: Vadim Zeitlin Date: Sat, 20 Feb 1999 23:01:55 +0000 (+0000) Subject: 1. better 'const' and 'virtual' functions handling X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f71f5a4fe119e3914c9e763957468113f67b2af2 1. better 'const' and 'virtual' functions handling 2. operators are now supported 3. tokens such as "<=" and "!=" are now tokenized properly git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/HelpGen/src/cjparser.cpp b/utils/HelpGen/src/cjparser.cpp index b6d1dd7514..e3ae0cbe4e 100644 --- a/utils/HelpGen/src/cjparser.cpp +++ b/utils/HelpGen/src/cjparser.cpp @@ -415,9 +415,6 @@ static void skip_token( char*& cur ) if ( *cur == ',' || *cur == ';' || - *cur == '<' || - *cur == '>' || - *cur == '=' || *cur == ')' || *cur == '(' ) @@ -426,6 +423,20 @@ static void skip_token( char*& cur ) return; } + // special case of "!=", "<=", ... 2 character composite tokens + if ( *cur == '<' || + *cur == '>' || + *cur == '=' || + *cur == '!' + ) + { + cur++; + if ( *cur == '=' ) + cur++; + + return; + } + ++cur; // leading character is always skipped for( ; cur < _gSrcEnd ; ++cur ) @@ -1539,6 +1550,27 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro ) pOp->mName = get_token_str( cur ); + // checker whether it's not an operator + char chFirst = *pOp->mName.c_str(); + if ( !isalpha(chFirst) && chFirst != '_' && chFirst != '~' ) + { + // skip 'operator' + skip_next_token_back( cur ); + skip_token_back( cur ); + + string lastToken = get_token_str( cur ); + if ( lastToken == "operator" ) + { + lastToken += pOp->mName; + pOp->mName = lastToken; + } + else + { + // ok, it wasn't an operator after all + skip_token( cur ); + } + } + // go backwards to method return type skip_next_token_back( cur ); @@ -1602,8 +1634,12 @@ bool CJSourceParser::ParseArguments( char*& cur ) if ( blocksSkipped == 1 ) { // check if the empty arg. list stressed with "void" inside - if ( cmp_tokens_fast( blocks[0] , "void", 4 ) ) - return TRUE; + if ( cmp_tokens_fast( blocks[0] , "void", 4 ) ) + { + cur++; // skip ')' + + break; + } // FIXME:: TBD:: K&R-style function declarations!