xref: /Universal-ctags/optlib/rpmMacros.ctags (revision 29197a38632d1338f634b72a1c8f368d57352778)
1#
2#  rpmMacros.ctags --- multitable regex parser for /usr/lib/rpm/macros 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# References:
11#
12# - https://rpm.org/user_doc/macros.html
13#
14# TODO:
15#
16# - Run Lua parser as a subparser
17#
18--langdef=RpmMacros
19
20# This map is too generic.
21# e.g. "macros.h" of C language input matches this pattern.
22# --map-RpmMacros=+(macros.*)
23
24# This one is too general.
25# --map-RpmMacros=+(macros)
26
27--kinddef-RpmMacros=m,macro,macros
28
29--_tabledef-RpmMacros=main
30--_tabledef-RpmMacros=contline
31
32--_mtable-regex-RpmMacros=main/^#[^\n]*\n?//
33--_mtable-regex-RpmMacros=main/^%([_a-zA-Z0-9]+)(\([^)]*\))*[^\n]*([^\n])\n?/\1/m/{{
34    \2 false ne {
35       . \2 signature:
36    } if
37    \3 (\\) eq {
38       % push the current tag for attaching end: later
39       .
40       % Skip next line if \ is at the enf of the current line.
41       /contline _tenter
42    } if
43}}
44--_mtable-regex-RpmMacros=main/.//
45
46--_mtable-regex-RpmMacros=contline/(\n)//{{
47   1 /start _matchloc end:
48   _tleave
49}}
50--_mtable-regex-RpmMacros=contline/^[^\n]*([^\n])\n?///{{
51    \1 (\\) eq not {
52       1 /end _matchloc end:
53       _tleave
54    } if
55}}
56