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

Parsing stack (#5277) #7534

Merged
merged 15 commits into from
Jan 27, 2025
Merged

Conversation

Moderocky
Copy link
Member

Re-opening the abandoned #5277 with updated changes.

Description

This PR adds the parsing stack. This is a stack that keeps track of which syntax elements are currently being parsed.
With this feature, you could for example check in an expression's init method which expression it's being used in, or which effect is using the expression.

Each stack element contains the SyntaxElementInfo (which contains info such as the syntax element class and the patterns), and which exact pattern was used.

This PR also catches StackOverflowErrors that occur during parsing, and adds the parsing stack to the exception message. AFAIK these exceptions are rare here, but the extra details don't hurt. Example stack trace (warning: long): https://pastebin.com/CNynV19h

I also plan to add a watchdog system where Skript would detect when parsing is taking a long time (either in general, or for a specific line / trigger), at which point Skript could print some warning message, including the parsing stack and possibly more information, to console.


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@Moderocky Moderocky added the feature Pull request adding a new feature. label Jan 26, 2025
@Moderocky Moderocky marked this pull request as ready for review January 26, 2025 21:35
@Moderocky Moderocky merged commit e1565dc into SkriptLang:dev/feature Jan 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull request adding a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants