Skip to content

Commit

Permalink
Cxx: apply cxxTokenTypeIs and cxxTokenTypeIsOneOf to more areas
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Mar 24, 2024
1 parent 565ed70 commit d8118fc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion parsers/cxx/cxx_parser_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bool cxxParserParseBlockHandleOpeningBracket(void)
CXX_DEBUG_ENTER();

CXX_DEBUG_ASSERT(
g_cxx.pToken->eType == CXXTokenTypeOpeningBracket,
cxxTokenTypeIs(g_cxx.pToken, CXXTokenTypeOpeningBracket),
"This must be called when pointing at an opening bracket!"
);

Expand Down
2 changes: 1 addition & 1 deletion parsers/cxx/cxx_parser_function.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ bool cxxParserLookForFunctionSignature(
// hmm.. probably a template specialisation
pAux = pSmallerThan->pPrev;
pInfo->uFlags |= CXXFunctionSignatureInfoScopeTemplateSpecialization;
} else if(pAux->eType == CXXTokenTypeAngleBracketChain)
} else if(cxxTokenTypeIs(pAux, CXXTokenTypeAngleBracketChain))
{
// same as above, but already condensed (though it should never happen)
if(!pAux->pPrev)
Expand Down
6 changes: 3 additions & 3 deletions parsers/cxx/cxx_parser_variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ bool cxxParserExtractVariableDeclarations(CXXTokenChain * pChain,unsigned int uF
return bGotVariable;
}

if(t->eType == CXXTokenTypeSmallerThanSign)
if(cxxTokenTypeIs(t, CXXTokenTypeSmallerThanSign))
{
// Must be part of template type name (so properly balanced).
t = cxxTokenChainSkipToEndOfTemplateAngleBracket(t);
Expand Down Expand Up @@ -469,7 +469,7 @@ bool cxxParserExtractVariableDeclarations(CXXTokenChain * pChain,unsigned int uF
break;
default:
// Must be identifier
if(t->pPrev->eType != CXXTokenTypeIdentifier)
if(!cxxTokenTypeIs(t->pPrev, CXXTokenTypeIdentifier))
{
CXX_DEBUG_LEAVE_TEXT("No identifier before the notable token");
return bGotVariable;
Expand Down Expand Up @@ -511,7 +511,7 @@ bool cxxParserExtractVariableDeclarations(CXXTokenChain * pChain,unsigned int uF
CXXToken * pScopeStart = NULL;

// Skip back to the beginning of the scope, if any
while(pTokenBefore->eType == CXXTokenTypeMultipleColons)
while(cxxTokenTypeIs(pTokenBefore, CXXTokenTypeMultipleColons))
{
if(!cxxParserCurrentLanguageIsCPP())
{
Expand Down
2 changes: 1 addition & 1 deletion parsers/cxx/cxx_scope.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void cxxScopeSetAccess(enum CXXScopeAccess eAccess)
void cxxScopePushTop(CXXToken * t)
{
CXX_DEBUG_ASSERT(
t->eType == CXXTokenTypeIdentifier,
cxxTokenTypeIs(t, CXXTokenTypeIdentifier),
"The scope name must be an identifier"
);
CXX_DEBUG_ASSERT(
Expand Down
26 changes: 13 additions & 13 deletions parsers/cxx/cxx_token_chain.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ CXXToken * cxxTokenChainSkipBackToStartOfTemplateAngleBracket(CXXToken * t)
if(!t)
return NULL;
CXX_DEBUG_ASSERT(
t->eType == CXXTokenTypeGreaterThanSign,
cxxTokenTypeIs(t, CXXTokenTypeGreaterThanSign),
"This function must be called when pointing to a >"
);
int iLevel = 1;
Expand Down Expand Up @@ -653,7 +653,7 @@ CXXToken * cxxTokenChainFirstTokenOfType(
CXXToken * t = tc->pHead;
while(t)
{
if(t->eType & uTokenTypes)
if(cxxTokenTypeIsOneOf(t, uTokenTypes))
return t;
t = t->pNext;
}
Expand All @@ -670,7 +670,7 @@ CXXToken * cxxTokenChainNextTokenOfType(
t = t->pNext;
while(t)
{
if(t->eType & uTokenTypes)
if(cxxTokenTypeIsOneOf(t, uTokenTypes))
return t;
t = t->pNext;
}
Expand All @@ -687,7 +687,7 @@ CXXToken * cxxTokenChainPreviousTokenOfType(
t = t->pPrev;
while(t)
{
if(t->eType & uTokenTypes)
if(cxxTokenTypeIsOneOf(t, uTokenTypes))
return t;
t = t->pPrev;
}
Expand All @@ -704,7 +704,7 @@ CXXToken * cxxTokenChainPreviousTokenNotOfType(
t = t->pPrev;
while(t)
{
if(!(t->eType & uTokenTypes))
if(!(cxxTokenTypeIsOneOf(t, uTokenTypes)))
return t;
t = t->pPrev;
}
Expand All @@ -721,7 +721,7 @@ CXXToken * cxxTokenChainLastTokenOfType(
CXXToken * t = tc->pTail;
while(t)
{
if(t->eType & uTokenTypes)
if(cxxTokenTypeIsOneOf(t, uTokenTypes))
return t;
t = t->pPrev;
}
Expand All @@ -739,13 +739,13 @@ CXXToken * cxxTokenChainLastPossiblyNestedTokenOfType(
CXXToken * t = tc->pTail;
while(t)
{
if(t->eType & uTokenTypes)
if(cxxTokenTypeIsOneOf(t, uTokenTypes))
{
if(ppParentChain)
*ppParentChain = tc;
return t;
}
if(t->eType == CXXTokenTypeParenthesisChain)
if(cxxTokenTypeIs(t, CXXTokenTypeParenthesisChain))
{
CXXToken * tmp = cxxTokenChainLastPossiblyNestedTokenOfType(
t->pChain,
Expand All @@ -772,13 +772,13 @@ CXXToken * cxxTokenChainFirstPossiblyNestedTokenOfType(
CXXToken * t = tc->pHead;
while(t)
{
if(t->eType & uTokenTypes)
if(cxxTokenTypeIsOneOf(t, uTokenTypes))
{
if(ppParentChain)
*ppParentChain = tc;
return t;
}
if(t->eType == CXXTokenTypeParenthesisChain)
if(cxxTokenTypeIs(t, CXXTokenTypeParenthesisChain))
{
CXXToken * tmp = cxxTokenChainFirstPossiblyNestedTokenOfType(
t->pChain,
Expand All @@ -805,7 +805,7 @@ CXXToken * cxxTokenChainFirstTokenNotOfType(
CXXToken * t = tc->pHead;
while(t)
{
if(!(t->eType & uTokenTypes))
if(!(cxxTokenTypeIsOneOf(t, uTokenTypes)))
return t;
t = t->pNext;
}
Expand Down Expand Up @@ -840,7 +840,7 @@ CXXToken * cxxTokenChainNextTokenNotOfType(
t = t->pNext;
while(t)
{
if(!(t->eType & uTokenTypes))
if(!(cxxTokenTypeIsOneOf(t, uTokenTypes)))
return t;
t = t->pNext;
}
Expand All @@ -857,7 +857,7 @@ CXXToken * cxxTokenChainLastTokenNotOfType(
CXXToken * t = tc->pTail;
while(t)
{
if(!(t->eType & uTokenTypes))
if(!(cxxTokenTypeIsOneOf(t, uTokenTypes)))
return t;
t = t->pPrev;
}
Expand Down

0 comments on commit d8118fc

Please sign in to comment.