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

Feature/default expressions #130

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

Conversation

Mwexim
Copy link
Owner

@Mwexim Mwexim commented Jan 1, 2022

This pull request adds support for default expressions. The system is fundamentally different from Skript's though.

One can now append the '?' flag (or nullable flag) to make the parser search for default values if the expression would be omitted (ex: because of an optional group).

An example could be: %duration% before [%date?%].

If the 'date' type would be omitted, the parser expects (rather than tries) to find a default expression. Support for registering these default expressions is also added. In Skript, the parser will always try to find default expressions unless specified explicitly. Skript-parser will only expect to find default expressions if specified explicitly. That's the main difference between the systems.

This pull request is marked as draft because:

  • The test for this system is really wanky and not constructed well.
  • The EventExpression class throws an exception when it can't find a context value that corresponds to the type. It should just not work instead.
  • The EventExpression class also throws an exception when it has multiple possibilities, but maybe it shouldn't do that.
  • The default expressions might not have full clearance (meaning I need to investigate if there are edge-cases where the parser will not try to find a default expression)
  • Context values should have support for changers.
  • Code needs to be optimized a lot. I created this without performance/code optimization in mind as of now.
  • Javadoc needs to be added

Furthermore:

  • Fixed some typos
  • Renamed a test
  • Added default changers to Expressions.

@Mwexim Mwexim mentioned this pull request Jan 5, 2022
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.

1 participant