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

[optional] argument #109

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

[optional] argument #109

wants to merge 3 commits into from

Conversation

justinmk
Copy link
Member

@justinmk justinmk commented Jun 25, 2023

Note: do a release before merging this


  • Parse [foo] as optional optional_arg (naming suggestions?)
  • Don't treat [{arg}] as optional, else it clobbers the nested {arg}.

fix #1

Todo

  • ✅ Will need to work through similar issues as for {argument}. These examples cause errors:
    nvim_buf_changedtick_event[{buf},]
    A list of [text, hl_group] arrays
    to change) ["win", winid, bufnr, row]
    
    • ✅ Fixed by defined optional as a regex instead of using _word().

@justinmk justinmk force-pushed the argument branch 4 times, most recently from fe9d516 to d772790 Compare June 25, 2023 22:45
@justinmk justinmk marked this pull request as draft June 25, 2023 22:49
@justinmk justinmk changed the title optional [argument] [optional] arguments Jun 26, 2023
@justinmk justinmk changed the title [optional] arguments [optional] argument Jun 26, 2023
@justinmk justinmk marked this pull request as ready for review June 26, 2023 09:42
justinmk added 3 commits June 19, 2024 14:43
Problem:
Using _word() to define an optional arg leads to a lot of syntax errors in
real-world :help files because [brackets] are commonly used for non-args.

Solution:
Define (optional) with a regex, like (keycode) instead of using the more
"formal" mechanism. Regex has "best-effort" behavior, while seq() behaves more
strictly.

Don't treat `[{arg}]` as (optional), else it clobbers the nested `{arg}`.

fix #1
@justinmk justinmk marked this pull request as draft June 19, 2024 12:49
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.

more syntax features: keycodes, special, parameters
1 participant