Skip to content

Commit e2d3723

Browse files
authored
Merge pull request #4059 from masatake/main--extras-and-fields-in-foreign-language
Main: use extras and fields in the foreign language specified in {_language=...} flag
2 parents a7b07d7 + 1d0be58 commit e2d3723

File tree

22 files changed

+151
-12
lines changed

22 files changed

+151
-12
lines changed

Tmain/list-mline-regex-flags.d/stdout-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ p pcre2 use pcre2 regex engine
99
- warning="MESSAGE" print the given MESSAGE at WARNING level
1010
- _advanceTo=N[start|end] a group in pattern from where the next scan starts [0end]
1111
- _anonymous=PREFIX make an anonymous tag with PREFIX
12-
- _extra=EXTRA record the tag only when the extra is enabled
13-
- _field=FIELD:VALUE record the matched string(VALUE) to parser own FIELD of the tag
12+
- _extra=EXTRA record the tag only when the (foreign) extra is enabled
13+
- _field=FIELD:VALUE record the matched string(VALUE) to the (foreign) language specific FIELD of the tag
1414
- _guest=PARSERSPEC,N0[start|end],N1[start|end] run guest parser on the area
1515
- _language=LANG make a foreign tag for LANG
1616
- _role=ROLE set the given ROLE to the roles field

Tmain/list-mtable-regex-flags.d/stdout-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ p pcre2 use pcre2 regex engine
1515
- warning="MESSAGE" print the given MESSAGE at WARNING level
1616
- _advanceTo=N[start|end] a group in pattern from where the next scan starts [0end]
1717
- _anonymous=PREFIX make an anonymous tag with PREFIX
18-
- _extra=EXTRA record the tag only when the extra is enabled
19-
- _field=FIELD:VALUE record the matched string(VALUE) to parser own FIELD of the tag
18+
- _extra=EXTRA record the tag only when the (foreign) extra is enabled
19+
- _field=FIELD:VALUE record the matched string(VALUE) to the (foreign) language specific FIELD of the tag
2020
- _guest=PARSERSPEC,N0[start|end],N1[start|end] run guest parser on the area
2121
- _language=LANG make a foreign tag for LANG
2222
- _role=ROLE set the given ROLE to the roles field

Tmain/list-regex-flags.d/stdout-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ x exclusive skip testing the other pat
1010
- scope=ACTION use scope stack: ACTION = ref|push|pop|clear|set|replace|intervaltab
1111
- warning="MESSAGE" print the given MESSAGE at WARNING level
1212
- _anonymous=PREFIX make an anonymous tag with PREFIX
13-
- _extra=EXTRA record the tag only when the extra is enabled
14-
- _field=FIELD:VALUE record the matched string(VALUE) to parser own FIELD of the tag
13+
- _extra=EXTRA record the tag only when the (foreign) extra is enabled
14+
- _field=FIELD:VALUE record the matched string(VALUE) to the (foreign) language specific FIELD of the tag
1515
- _guest=PARSERSPEC,N0[start|end],N1[start|end] run guest parser on the area
1616
- _language=LANG make a foreign tag for LANG
1717
- _role=ROLE set the given ROLE to the roles field
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright: 2024 Masatake YAMATO
2+
# License: GPL-2
3+
4+
. ../utils.sh
5+
6+
CTAGS=$1
7+
8+
V=
9+
# V=valgrind
10+
11+
${V} ${CTAGS} --quiet --options=NONE \
12+
\
13+
--langdef=NOSUCHLANG'{_foreignLanguage=Kconfig}' \
14+
--_extradef-NOSUCHLANG='NOSUCHEXTRA,but this is not the part of Kconfig' \
15+
--regex-NOSUCHLANG='/^\# (CONFIG_[^ ]+) is not set/\1/c/{_language=Kconfig}{_extra=NOSUCHEXTRA}{exclusive}' \
16+
\
17+
--_force-quit=0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ctags: Warning: no such extra "NOSUCHEXTRA" in Kconfig
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright: 2024 Masatake YAMATO
2+
# License: GPL-2
3+
4+
. ../utils.sh
5+
6+
CTAGS=$1
7+
8+
V=
9+
# V=valgrind
10+
11+
${V} ${CTAGS} --quiet --options=NONE \
12+
\
13+
--langdef=NOSUCHLANG'{_foreignLanguage=Kconfig}' \
14+
--_fielddef-NOSUCHLANG='NOSUCHFIELD,but this is not the part of Kconfig' \
15+
--regex-NOSUCHLANG='/^\# (CONFIG_[^ ]+) is (not set)/\1/c/{_language=Kconfig}{_field=NOSUCHFIELD:\1}{exclusive}' \
16+
\
17+
--_force-quit=0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ctags: Warning: no such field "NOSUCHFIELD" in Kconfig
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
D:def00
2+
d:def01
3+
v:var0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
D:def10
2+
d:def11
3+
v:var1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright: 2024 Masatake YAMATO
2+
# License: GPL-2
3+
4+
. ../utils.sh
5+
6+
CTAGS=$1
7+
8+
V=
9+
# V=valgrind
10+
11+
printf "# %s\n" --extras-X0=+'{iname}'
12+
${V} ${CTAGS} --quiet --options=NONE --options=./x0.ctags --options=./x1.ctags \
13+
--extras-X0=+'{iname}' --fields=+'{extras}{language}' -o - input-0.x1
14+
15+
printf "# %s\n" --extras-X0=-'{iname}'
16+
${V} ${CTAGS} --quiet --options=NONE --options=./x0.ctags --options=./x1.ctags \
17+
--extras-X0=-'{iname}' --fields=+'{extras}{language}' -o - input-1.x1

0 commit comments

Comments
 (0)