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

Improve a bit gdscript syntax #3198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dustdfg
Copy link
Contributor

@dustdfg dustdfg commented Mar 20, 2024

  • Add some keywords
  • Add annotations support


# Operators
- statement: "[.:;,+*|=!\\%@]|<|>|/|-|&"

# Annotations
- special: "^@\\b(export|export_category|export_color_no_alpha|export_dir|export_enum|export_exp_easing|export_file|export_flags|export_flags_2d_navigation|export_flags_2d_physics|export_flags_2d_render|export_flags_3d_navigation|export_flags_3d_physics|export_flags_3d_render|export_flags_avoidance|export_global_dir|export_global_file|export_group|export_multiline|export_node_path|export_placeholder|export_range|export_subgroup|icon|onready|rpc|tool|warning_ignore)\\b+"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing with Godot docs the @static_unload annotation seems to be missing. The first \\b and the + at the end don't do anything useful.

Suggested change
- special: "^@\\b(export|export_category|export_color_no_alpha|export_dir|export_enum|export_exp_easing|export_file|export_flags|export_flags_2d_navigation|export_flags_2d_physics|export_flags_2d_render|export_flags_3d_navigation|export_flags_3d_physics|export_flags_3d_render|export_flags_avoidance|export_global_dir|export_global_file|export_group|export_multiline|export_node_path|export_placeholder|export_range|export_subgroup|icon|onready|rpc|tool|warning_ignore)\\b+"
- special: "^@(export|export_category|export_color_no_alpha|export_dir|export_enum|export_exp_easing|export_file|export_flags|export_flags_2d_navigation|export_flags_2d_physics|export_flags_2d_render|export_flags_3d_navigation|export_flags_3d_physics|export_flags_3d_render|export_flags_avoidance|export_global_dir|export_global_file|export_group|export_multiline|export_node_path|export_placeholder|export_range|export_subgroup|icon|onready|rpc|static_unload|tool|warning_ignore)\\b"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. + - typo
  2. @static_unload - thanks
  3. \\b It is used everywhere. Something starts from \\b and ends from it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\b It is used everywhere. Something starts from \b and ends from it

\b means word boundary (for example \bas\b would match both "as" and "@as" but not "gas"). In this case it is not necessary because there is always a word boundary (the previous character is a non-word character @ and the following character is a letter).

runtime/syntax/gdscript.yaml Outdated Show resolved Hide resolved
* Add some keywords
* Add annotations support

Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
Co-authored-by: Mikko <Andriamanitra@users.noreply.github.com>
@dustdfg dustdfg marked this pull request as ready for review March 20, 2024 17:11
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.

None yet

2 participants