paul-j-lucas / cdecl

Composing and deciphering C (or C++) declarations or casts, aka ‘‘gibberish.’’
GNU General Public License v3.0
90 stars 11 forks source link

autocomplete: add L_by to L_reference next-keyword list #26

Closed jengelh closed 1 year ago

jengelh commented 1 year ago

Ultimate target:

c++decl> declare lambda capturing [reference by default]
[&]

User input:

c++decl> declare lambda capturing [reference <TAB>

Result set of Tab Completion:

Expected result set:

paul-j-lucas commented 1 year ago

Yes, this fixes that one case, but ideally, you want AC_NEXT_KEYWORDS to have the ability to specify either which command(s) or language(s) each keyword applies to. For example, by should be included on the next-keywords list only when the current command being parsed is declare lambda since that's the only place by follows reference. But then it gets even more complicated. I'm not sure it's worth it.

jengelh commented 1 year ago

CDECL_KEYWORDS is context-free; there's no data in it about "previous keywords", so AC_NEXT_KEYWORDS can only contain all potential next keywords.

paul-j-lucas commented 1 year ago

I merged your PR; thanks. But I may add more context in the future.