-
Notifications
You must be signed in to change notification settings - Fork 22
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
To all Ren'Py users! We need your help! - Full Ren'Py grammar definition for 'intellisense' #335
Comments
@renpytom / @Gouvernathor does such a specification already exist? That would be very helpfull :) |
It came up some time ago for some reason and the answer was no, I doubt it has been done since. There were some bugs (in renpy/renpy#3991 for example) where a grammar would certainly have helped flagging them, but that example also means we are changing it occasionally. And it's possibly a bag of knots already, though I'm not a connaisseur of BNF so I may be wrong as compared to other languages. Our parser code is not that long and quite regular, so who knows. In any case I guess that would require warning you when we make changes to the grammar, preferably before release. It will require some discipline on our end. |
Maybe we could build an official specification together? That would help on both ends I suppose. |
@Gouvernathor, I used Bing Chat (🤣) to extract some EBNF definitions from the official Ren'Py parser source. It wasn't 100% accurate, so after it had processed most of the statements I manually went over them. The entries at the bottom of the file (after # Renpy Expressions) are the ones I manually reviewed and improved based on the source code. A review would be appreciated, but feel free to do so later :). I will continue to work on this for the next few days |
Some notes about those :
Ill increment this list. |
Ha, yes. I see it did a really bad job on the python statement. There is a lot more to it then this. Good catch |
@Gouvernathor Do I read correctly that the current parser will allow any statement to start with init? So that would mean things like:
Would all be valid? (Note that this is not an init block!)
|
The |
Yeah, kinda makes sense. I've updated the grammar file again. With the exception of (You can ignore the bits below |
I think LABEL_NAME should be
The layeredimage statement is missing, as well as a number of statements defined in renpy/common : the audio statements (some of them at least) are part of those I think. They are UserStatements, technically, but they're also built-in. It's just cosmetic maybe, but I wouldn't put the
|
Question - where is the grammar located? I'd be interested in taking a look at it, and seeing what I can do. |
I have the grammars located on this branch Thanks in advance for taking the time to help :) |
Can I put in a request as well, kinda like typescript has or even pylint allowing As such it leads to unnecessary warnings, and it'd be great to kinda have a |
Yeah we can implement this feature when the other features are implemented. I think this is a nice to have |
Something to look into: Basically we could already add python's language server features by building a virtual document of the python code and then adding the results to our own providers. This would be incomplete though, since we'd be missing a lot of the python context. It might still be nice enough to be worth adding already |
Let's add 'intellisense' features to the extension!
We're looking to improve this extension even further and would like your help!
Our next goal is to include behaviours you've come to expect from most IDEs which support intellisense features for popular languages. We want to add these features to the plugin as well.
As you know we already support some of these features, but these are limited in it's current state.
Some examples people have been asking for are:
How can you help
We are currently just two people building/maintaining this large extension.
With some help from other contributors (Special thanks to @a2937, @seanj29, @Booplicate, @pjpollina, and @Gouvernathor for your recent help! ❤️ 🚀)
To implement all these features we need a full formal grammar definition of the Ren'Py language. This will ensure that we implement these features as they should be implemented.
Just like how there already exists a Full Python grammar specification, we will need to build a Full Ren'Py grammar specification.
Now for some good news:
Ren'Py already has some formal specification! (ATL is fully specified)
Here is an example of the Transform Statement in BNF notation
Just like ATL, we will need this specification for all other renpy features.
Any help is greatly appreciated! ⭐
You can help us by adding or reviewing to the grammar specification or simply supplying us with renpy code samples showing how each language feature is used in your project.
If you want to help us out, please submit your contributions to this branch. Or leave a comment down below.
The text was updated successfully, but these errors were encountered: