Replies: 2 comments
-
FWIW I support this proposal. Generating the syntax files consistently would be a nice and welcome additional feature. |
Beta Was this translation helpful? Give feedback.
0 replies
-
PR opened for the auto-generation: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
Currently, each list on firejail.vim is generated/updated by manually running a
set of commands that try to find all applicable items by running regexes and
then pasting the result.
I managed to create a few targets to automate this (WIP), but I noticed that
the regexes for profile.c miss some commands, as they parse the actual source
code and what they look for is very specific.
For example, the following code from firejail.vim:
It has the following comment:
Having to create and maintain workarounds makes it harder to ensure that each
list is complete and that it does not have extraneous commands.
Proposal
So to make the regexes less brittle (and therefore easier to maintain), for
every command being parsed on profile.c I propose adding a comment above it
that names the command and specifies whether it has any arguments or not (which
is currently the main way that commands are grouped in firejail.vim).
For example:
No arguments:
Single argument:
This should make the regex matching much simpler and less error-prone.
For example:
More comment examples:
Note: The items in the other source files (such as in errno.c) seem to follow a
simpler format, so their regexes can maybe be left as is.
Considerations
This would require ensuring that whenever a command is added/modified/removed,
that the same is done to its comment, in order to keep the syntax lists
up-to-date. And also running
make
(or something likemake syntax
) afterdoing that.
Before:
git diff
and check that the command was added/modified/removed infirejail.vim
After:
make
(ormake syntax
)git diff
and check that the command was added/modified/removed in thesyntax files
Note: The above could be checked also in CI.
Note2: If the auto-generation of syntax files works reliably, it should be much
easier to maintain multiple syntax files (such as the one from #5502).
Future Work
Maybe the command comments could be expanded later to also include a brief
description in order to also generate --help (in usage.c), but for now this is
just the simplest way that I could think of to generate the syntax files in a
consistent manner.
Relates to:
Cc: @glitsj16 @laomaiweng @netblue30 @reinerh @rusty-snake @smitsohu (as
contributors to firejail.vim)
Beta Was this translation helpful? Give feedback.
All reactions