Skip to content

Commit cce8265

Browse files
committed
rpmMacros: parse macros.d/macros.*
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 78a38dc commit cce8265

File tree

6 files changed

+33
-6
lines changed

6 files changed

+33
-6
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
%vimfiles_root %{_datadir}/vim/vimfiles

Tmain/map-rexpr.d/run.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright: 2025 Masatake YAMATO
2+
# License: GPL-2
3+
4+
CTAGS=$1
5+
6+
. ../utils.sh
7+
8+
echo "# < macros.d/macros.vm"
9+
${CTAGS} --quiet --options=NONE --print-language macros.d/macros.vim
10+
${CTAGS} --quiet --options=NONE -o - macros.d/macros.vim
11+
12+
echo "# cd macros.d; < macros.vim"
13+
(
14+
cd macros.d;
15+
${CTAGS} --quiet --options=NONE --print-language macros.vim;
16+
${CTAGS} --quiet --options=NONE -o - macros.vim
17+
)

Tmain/map-rexpr.d/stderr-expected.txt

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# < macros.d/macros.vm
2+
macros.d/macros.vim: RpmMacros
3+
vimfiles_root macros.d/macros.vim /^%vimfiles_root %{_datadir}\/vim\/vimfiles$/;" m
4+
# cd macros.d; < macros.vim
5+
macros.vim: Vim

optlib/rpmMacros.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ extern parserDefinition* RpmMacrosParser (void)
113113
NULL
114114
};
115115

116+
static const struct rExprSrc rexprs [] = {
117+
{
118+
.expr = "(.*/)?macros\\.d/macros\\.([^/]+)$",
119+
.iCase = false,
120+
},
121+
REXPR_LAST_ENTRY
122+
};
123+
116124
static kindDefinition RpmMacrosKindTable [] = {
117125
{
118126
true, 'm', "macro", "macros",
@@ -126,6 +134,7 @@ extern parserDefinition* RpmMacrosParser (void)
126134
def->enabled = true;
127135
def->extensions = extensions;
128136
def->patterns = patterns;
137+
def->rexprs = rexprs;
129138
def->aliases = aliases;
130139
def->method = METHOD_NOT_CRAFTED|METHOD_REGEX;
131140
def->useCork = CORK_QUEUE;

optlib/rpmMacros.ctags

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@
1717
#
1818
--langdef=RpmMacros
1919

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)
20+
--map-RpmMacros=+%(.*/)?macros\.d/macros\.([^/]+)$%
2621

2722
--kinddef-RpmMacros=m,macro,macros
2823

0 commit comments

Comments
 (0)