Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CXX: Improve parsing of function-try-blocks and try/catch in general #1749

Merged
merged 3 commits into from
May 8, 2018
Merged

CXX: Improve parsing of function-try-blocks and try/catch in general #1749

merged 3 commits into from
May 8, 2018

Conversation

pragmaware
Copy link
Contributor

Improved solution for #1746.

  • catch() is part of the function-try-block:
    -- the variables declared inside now have proper scope
    -- the function ends after the last catch()
  • variables declared in the catch() parenthesis are extracted
  • function-try-blocks are reported as properties

@coveralls
Copy link

coveralls commented May 1, 2018

Coverage Status

Coverage increased (+0.01%) to 84.867% when pulling cfb00b8 on pragmaware:better-handling-of-try-catch into 576c750 on universal-ctags:master.

@@ -1 +1,4 @@
--c++-kinds=+pflz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--kinds-c++=... is preferable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


// and extract variable declarations if possible
cxxParserExtractVariableDeclarations(pChain,0);
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visual Studio makes a warning on this line (https://ci.appveyor.com/project/universalctags/ctags/build/1.0.763/job/wim07v3kr02a88r6). How about using trigraph like:

bOkToExtractVariables = cxxTokenChainNextTokenOfType(
						pAndOrStar,
 						CXXTokenTypeAssignment | CXXTokenTypeSemicolon
					)? true: false;

or ...

} else if ( cxxTokenChainNextTokenOfType(
					pAndOrStar,
 						CXXTokenTypeAssignment | CXXTokenTypeSemicolon)) {
            bOkToExtractVariables = true;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -286,6 +286,9 @@ vString * cxxTagSetProperties(unsigned int uProperties)
vStringCatS(pszProperties,_szProperty); \
} while(0)

// FIXME: The property names might be too verbose. Maybe it could be a good idea
// to a switch to shorten them to 1-2 letter codes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think basically using long names is not bad.
Making shortere can be done in a post processor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@pragmaware pragmaware merged commit 744610c into universal-ctags:master May 8, 2018
@masatake
Copy link
Member

masatake commented May 8, 2018

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants