CppCXY / EmmyLuaCodeStyle

fast, powerful, and feature-rich Lua formatting and checking tool.
MIT License
140 stars 27 forks source link

Add additional namestyle configuration for const variables #160

Closed AndreaWalchshoferSCCH closed 10 months ago

AndreaWalchshoferSCCH commented 10 months ago

This PR adds a name style configuration option for variables marked with the attribute <const>, as described in https://github.com/CppCXY/EmmyLuaCodeStyle/issues/158

How it's designed:

CppCXY commented 10 months ago

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.