// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-# pragma implementation "acell.h"
-#endif
-
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
// statics used by inline'ed C helper-functions
static char* _gSrcStart = 0;
static char* _gSrcEnd = 0;
-static wxChar* _gLastSuppresedComment = 0;
+static char* _gLastSuppresedComment = 0;
static int _gLineNo = 0;
// FOR NOW:: comments queue is static
++cur; // position after the trailing charcter of the prev token
}
-static string get_token_str( char* cur )
+static wxString get_token_str( char* cur )
{
- return string( cur, get_token_len( cur ) );
+ return wxString( cur, get_token_len( cur ) );
}
// skips token or whole expression which may have
{
// TBD:: FIXME:: return value of operators !
- while ( identifier[0u] == _T('*') ||
- identifier[0u] == _T('&')
+ while ( identifier[0u] == '*' ||
+ identifier[0u] == '&'
)
{
type += identifier[0u];
return i == __gMultiLangMap.end() ? false : true;
}
-static inline void get_string_between( wxChar* start, wxChar* end,
+static inline void get_string_between( char* start, char* end,
wxString* pStr )
{
char saved = *end;
- *end = _T('\0');
+ *end = '\0';
*pStr = start;
*end = saved;
}
-static wxChar* set_comment_text( wxString& text, wxChar* start )
+static char* set_comment_text( wxString& text, char* start )
{
- wxChar* end = start;
+ char* end = start;
// to avoid poluting the queue with this comment
_gLastSuppresedComment = start;
skip_comments( end );
- if ( *(end-1) == _T('/') )
+ if ( *(end-1) == '/' )
end -= 2;
start += 2;
// skip multiple leading '/''s or '*''s
- while( *start == _T('/') && start < end ) ++start;
- while( *start == _T('*') && start < end ) ++start;
+ while( *start == '/' && start < end ) ++start;
+ while( *start == '*' && start < end ) ++start;
get_string_between( start, end, &text );
mIsTemplate = 0;
mNestingLevel = 0;
- cur = start;
+ m_cur = start;
mpStart = start;
mpEnd = end;
do
{
- if ( !get_next_token( cur ) )
+ if ( !get_next_token( m_cur ) )
// end of source reached
return pTopCtx;
- if ( memcmp( cur, "ScriptSection( const string&",
+ if ( memcmp( m_cur, "ScriptSection( const string&",
strlen( "ScriptSection( const string&" )
) == 0
)
// ++o;
}
- switch (*cur)
+ switch (*m_cur)
{
case '#' :
{
- AddMacroNode( cur );
+ AddMacroNode( m_cur );
continue;
}
case ':' :
{
- skip_token( cur );
+ skip_token( m_cur );
continue;
}
case ';' :
{
- skip_token( cur );
+ skip_token( m_cur );
continue;
}
case ')' :
{
- skip_token( cur );
+ skip_token( m_cur );
continue;
}
case '=' :
{
- skip_token( cur );
+ skip_token( m_cur );
continue;
}
}
// 'const' is a part of the return type, not a keyword here
- if ( strncmp(cur, "const", 5) != 0 && is_keyword( cur ) )
+ if ( strncmp(m_cur, "const", 5) != 0 && is_keyword( m_cur ) )
{
// parses, token, if token identifies
// the container context (e.g. class/namespace)
// the corresponding context object is created
// and set as current context
- ParseKeyword( cur );
+ ParseKeyword( m_cur );
continue;
}
- if ( *cur >= '0' && *cur <= '9' )
+ if ( *m_cur >= '0' && *m_cur <= '9' )
{
- skip_token( cur );
+ skip_token( m_cur );
continue;
}
- if ( *cur == '}' )
+ if ( *m_cur == '}' )
{
if ( mCurCtxType != SP_CTX_CLASS )
{
// DBG:: unexpected closing-bracket found
//ASSERT(0);
- skip_token( cur ); // just skip it
+ skip_token( m_cur ); // just skip it
continue;
}
if ( mpCurCtx->GetType() == SP_CTX_CLASS )
{
- int curOfs = ( (cur+1) - _gSrcStart );
+ int curOfs = ( (m_cur+1) - _gSrcStart );
mpCurCtx->mContextLength = ( curOfs - mpCurCtx->mSrcOffset );
}
mIsTemplate = 0;
}
- skip_token( cur );
+ skip_token( m_cur );
continue;
}
bool isAMacro = false;
- if ( is_function( cur, isAMacro ) )
+ if ( is_function( m_cur, isAMacro ) )
{
if ( isAMacro )
{
- skip_token( cur );
+ skip_token( m_cur );
continue;
}
- char* savedPos = cur;
+ char* savedPos = m_cur;
int tmpLnNo;
store_line_no( tmpLnNo );
isAMacro = false;
- if ( !ParseNameAndRetVal( cur, isAMacro ) )
+ if ( !ParseNameAndRetVal( m_cur, isAMacro ) )
{
if ( !isAMacro )
{
- cur = savedPos;
- SkipFunction( cur );
+ m_cur = savedPos;
+ SkipFunction( m_cur );
}
continue;
}
- if ( !ParseArguments( cur ) )
+ if ( !ParseArguments( m_cur ) )
{
// failure while parsing arguments,
// remove enclosing operation context
mpCurCtx = mpCurCtx->GetOutterContext();
mpCurCtx->RemoveChild( pFailed );
- skip_to_eol( cur );
- //cur = savedPos;
+ skip_to_eol( m_cur );
+ //m_cur = savedPos;
}
else
{
clear_commets_queue();
- SkipFunctionBody( cur );
+ SkipFunctionBody( m_cur );
mpCurCtx = mpCurCtx->GetOutterContext();
{
// non-class members are ignored
- skip_token( cur ); // skip the end of statement
+ skip_token( m_cur ); // skip the end of statement
continue;
}
- ParseMemberVar( cur );
+ ParseMemberVar( m_cur );
}
} while( 1 );
}
-void CJSourceParser::AttachComments( spContext& ctx, wxChar* cur )
+void CJSourceParser::AttachComments( spContext& ctx, char* cur )
{
if ( !mCommentsOn ) return;
// of the new paragraph in the comment text
if ( i == 0 )
-
+ {
pComment->mStartsPar = true;
- else
- if ( pComment->mIsMultiline )
-
+ }
+ else if ( pComment->mIsMultiline )
+ {
pComment->mStartsPar = true;
+ }
else
{
// find out wheather there is a new-line
// between to adjecent comments
-
char* prevLine = start;
skip_to_prev_line(prevLine);
if ( prevLine >= prevComEnd )
-
pComment->mStartsPar = true;
else
pComment->mStartsPar = false;
prevComEnd = set_comment_text( pComment->m_Text, start );
}
-
// attach comments which are at the end of the line
// of the given context (if any)
clear_commets_queue();
}
-void CJSourceParser::AddMacroNode( wxChar*& cur )
+void CJSourceParser::AddMacroNode( char*& cur )
{
- wxChar* start = cur;
+ char* start = cur;
int lineNo = get_line_no();
// determine the type exactly and assign
// a name to the context
- if ( *start == _T('d') )
+ if ( *start == 'd' )
{
- if ( cmp_tokens_fast( start, _T("define"), 6 ) )
+ if ( cmp_tokens_fast( start, "define", 6 ) )
{
char* tok = start+6;
pPL->mDefType = SP_PREP_DEF_REDEFINE_SYMBOL;
}
}
- else if ( *start == _T('i') )
+ else if ( *start == 'i' )
{
- if ( cmp_tokens_fast( start, _T("include"), 7 ) )
+ if ( cmp_tokens_fast( start, "include", 7 ) )
{
pPL->mDefType = SP_PREP_DEF_INCLUDE_FILE;
}
- else if ( *++start == _T('f') )
+ else if ( *++start == 'f' )
{
// either "#if" or "#ifdef"
cur = start;
skip_token( cur );
get_next_token( cur );
- string condition = get_token_str( cur );
+ wxString condition = get_token_str( cur );
// currently, everything except '0' is true
- if ( condition == _T("0") ) {
+ if ( condition == "0" ) {
// skip until the following else or enif
while ( cur < _gSrcEnd ) {
skip_to_eol( cur );
skip_eol( cur );
get_next_token( cur );
- if ( *cur++ == _T('#') && *cur == _T('e') )
+ if ( *cur++ == '#' && *cur == 'e' )
break;
}
}
// TODO parse the condition...
}
}
- else if ( cmp_tokens_fast( start, _T("else"), 4 ) )
+ else if ( cmp_tokens_fast( start, "else", 4 ) )
{
// skip until "#endif"
while ( cur < _gSrcEnd ) {
skip_eol( cur );
get_next_token( cur );
- if ( *cur++ == _T('#') && cmp_tokens_fast( cur, "endif", 5 ) )
+ if ( *cur++ == '#' && cmp_tokens_fast( cur, "endif", 5 ) )
break;
}
}
skip_next_token_back( cur );
skip_token_back( cur );
- string lastToken = get_token_str( cur );
+ wxString lastToken = get_token_str( cur );
if ( lastToken == "operator" ) {
lastToken += pOp->m_Name;
pOp->m_Name = lastToken;
else if ( pOp->m_Name == "operator" ) {
skip_token( cur );
get_next_token( cur );
- string oper = get_token_str( cur );
+ wxString oper = get_token_str( cur );
pOp->m_Name += oper;
}
if ( cur >= start )
{
- string rettype = string( start, size_t( cur-start ) );
+ wxString rettype = wxString( start, size_t( cur-start ) );
// FIXME just for now...
- string::size_type pos = 0;
- string toerase("WXDLLEXPORT ");
- while((pos = rettype.find(toerase, pos)) != string::npos)
+ wxString::size_type pos = 0;
+ wxString toerase("WXDLLEXPORT ");
+ while((pos = rettype.find(toerase, pos)) != wxString::npos)
rettype.erase(pos, toerase.length());
pOp->m_RetType = rettype;
}
continue;
}
- pPar->mInitVal = string( blocks[nameBlock], blockSizes[nameBlock] );
+ pPar->m_InitVal = wxString( blocks[nameBlock], blockSizes[nameBlock] );
nameBlock = nameBlock - 2; // skip '=' token and default value block
typeBlock = nameBlock - 1;
AttachComments( *pPar, blocks[nameBlock] );
// retrieve argument name
- pPar->m_Name = string( blocks[nameBlock], blockSizes[nameBlock] );
+ pPar->m_Name = wxString( blocks[nameBlock], blockSizes[nameBlock] );
// retreive argument type
size_t len = blockSizes[ typeBlock ];
len = size_t ( (blocks[ typeBlock ] + len) - blocks[ 0 ] );
- pPar->m_Type = string( blocks[0], len );
+ pPar->m_Type = wxString( blocks[0], len );
arrange_indirection_tokens_between( pPar->m_Type, pPar->m_Name );
bool firstMember = true;
- string type;
+ wxString type;
// jump to the end of statement
// and start collecting same-type varibles
{
// yes, we've mistaken, it was not a identifier,
// but it's default value
- pAttr->mInitVal =
- pAttr->m_Name;
+ pAttr->m_InitVal = pAttr->m_Name;
// skip default value and '=' symbol
skip_next_token_back( cur );
{
char* ctxStart = cur;
- string classkeyword = get_token_str( cur );
+ wxString classkeyword = get_token_str( cur );
skip_token( cur ); // skip 'class' keyword
if ( !get_next_token( cur ) ) return;
if ( *tok != ':' && *cur != ':' )
- pClass->mSuperClassNames.push_back( string( cur, len ) );
+ pClass->m_SuperClassNames.push_back( wxString( cur, len ) );
} while(1);
int tmpLn;
store_line_no( tmpLn );
- while ( pClass->mSuperClassNames.size() )
+ while ( pClass->m_SuperClassNames.size() )
- pClass->mSuperClassNames.erase( &pClass->mSuperClassNames[0] );
+ pClass->m_SuperClassNames.erase( &pClass->m_SuperClassNames[0] );
char* tok = cur;