Add additional namestyle configuration for const variables#160
Merged
CppCXY merged 1 commit intoCppCXY:masterfrom Feb 5, 2024
Merged
Add additional namestyle configuration for const variables#160CppCXY merged 1 commit intoCppCXY:masterfrom
CppCXY merged 1 commit intoCppCXY:masterfrom
Conversation
Owner
|
Good job, it seems that you need a more user-friendly syntax tree and node API, just like what I did with C#, in this case, writing such diagnostics would only need to be like: auto nodes = tree.Children<NameExpr>().Where([](auto it) -> { return it.Declaration(tree).Is<LocalName>(); });
// make diagnostic
of course I didn't design such an API for this project, for this project, I didn't initially intend to implement complex diagnostic algorithms, including format checking, which was just written casually. therefore, although the AST has the shadow of the red-green tree, it is not strongly typed, which leads to a very unfriendly API. I might take the time to write a C++ parser that can parse all LuaCats and emmyluadoc, if I have the time. Many people should need it to write tools. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a name style configuration option for variables marked with the attribute
<const>, as described in #158How it's designed:
const_variable_name_styleImportModuleNameandModuleNameare not affected<const>are affectedSnakeCaseandUpperSnakeCaseare allowed, so it should not affect existing code bases using the default name style configuration. If preferred, we could also set it toIgnoreas the default, but as the name styles themselves are still quite recent, I wouldn't assume it would annoy people.