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

main: introduce --_paramdef-<LANG>=<NAME>,<DESCRIPTION> option #3613

Merged
merged 12 commits into from
Dec 29, 2022

Conversation

masatake
Copy link
Member

@masatake masatake commented Dec 29, 2022

With the option, you can define a parser-specific parameter to your optlib parser.
In the following example, we define a parser, Foo with a parser-specific parameter VAR. If the parser sees "x" in an input stream, a code fragment of optscript attached to the pattern /(x)/ runs. The code fragment (1) checks whether a value for VAR is given, (2) emits a tag with the value given to parameter VAR as name and with xval kind, and (3) removes the cork index from the operand stack.

args.ctags:

--langdef=Foo
--map-Foo=.foo
--kinddef-Foo=v,xval,externally defined values
--_paramdef-Foo=VAR,desc
--regex-Foo=/(x)//{{
    /VAR _param { % if VAR is defined ....
        /xval _tag _commit pop
    } if
    % if VAR is not defined, we do nothing.
}}

input.foo:

x

When running the parser, we can give a value ("hereiam" in the following example) for the parameter VAR:

$ ./ctags --options=args.ctags --param-Foo.VAR=hereiam -o - input.foo
hereiam	input.foo	/^x$/;"	v

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Like kindControlBlock, paramControlBlock is a building block
for adding --paramdef-<LANG>=... option.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…<LANG>...

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@codecov
Copy link

codecov bot commented Dec 29, 2022

Codecov Report

Base: 82.84% // Head: 82.85% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (e8847f7) compared to base (50e7a74).
Patch coverage: 92.21% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3613      +/-   ##
==========================================
+ Coverage   82.84%   82.85%   +0.01%     
==========================================
  Files         223      223              
  Lines       54279    54379     +100     
==========================================
+ Hits        44965    45057      +92     
- Misses       9314     9322       +8     
Impacted Files Coverage Δ
main/mini-geany.c 80.95% <ø> (ø)
main/options.c 83.81% <80.00%> (-0.01%) ⬇️
main/parse.c 95.64% <88.88%> (-0.16%) ⬇️
main/param.c 94.64% <92.85%> (-5.36%) ⬇️
main/lregex.c 84.52% <95.65%> (+0.15%) ⬆️
parsers/asm.c 99.26% <100.00%> (+<0.01%) ⬆️
parsers/cpreprocessor.c 95.68% <100.00%> (+0.01%) ⬆️
parsers/fypp.c 99.42% <100.00%> (+<0.01%) ⬆️
parsers/itcl.c 92.50% <100.00%> (+0.09%) ⬆️
parsers/tcloo.c 94.11% <100.00%> (+0.11%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake merged commit 02c5ae5 into universal-ctags:master Dec 29, 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.

None yet

1 participant