xref: /Universal-ctags/optlib/mesonOptions.ctags (revision 57835cd4fc9319a16d4806aee3f34b951b88a1e3)
1#
2#  mesonOptions.ctags --- multitable regex parser for meson_options files
3#
4#  Copyright (c) 2021 Masatake YAMATO
5#  Copyright (c) 2021 Red Hat, Inc.
6#
7#  This source code is released for free distribution under the terms of the
8#  GNU General Public License version 2 or (at your option) any later version.
9#
10#  This parser is one of testbed of optscript.
11#
12# References:
13#
14# - https://mesonbuild.com/Build-options.html
15#
16# TODO:
17#
18# - capture choice items
19#
20--langdef=MesonOptions
21--map-MesonOptions=+(meson_options.txt)
22
23--kinddef-MesonOptions=s,string,strings
24--kinddef-MesonOptions=b,boolean,booleans
25--kinddef-MesonOptions=c,combo,combos
26--kinddef-MesonOptions=i,integer,integers
27--kinddef-MesonOptions=a,array,arrays
28--kinddef-MesonOptions=f,feature,features
29
30--mline-regex-MesonOptions=/^option[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*,[ \t\n]*type[ \t\n]*:[ \t\n]*'([a-z]+)'//{{
31    % \1 points a tag name.
32    \1
33    % \2 may point a kind. This must be converted to a name from a string.
34    \2 cvn
35    % Push the start position of the group 1.
36    1 /start _matchloc
37    % To skip an unexpected kind name, _tag is wrapped with stopped.
38    { _tag } stopped {
39        % Unexpected kind. Clear the stack.
40        pop pop pop
41    } {
42        _commit pop
43    } ifelse
44}}
45