Skip to content

Commit 50ab7a7

Browse files
authored
Merge pull request #3578 from masatake/readtags--escaping-input-fields
readtags: print the input fields literally even if -E option is given
2 parents 6a1ee4b + 35a4c10 commit 50ab7a7

File tree

9 files changed

+58
-8
lines changed

9 files changed

+58
-8
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
x a\tb\nc/f.c /^int x;$/;" kind:v typeref:typename:int
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
# Copyright: 2022 Masatake YAMATO
4+
# License: GPL-2
5+
6+
READTAGS=$3
7+
8+
. ../utils.sh
9+
10+
if ! [ -x "${READTAGS}" ]; then
11+
skip "no readtags"
12+
fi
13+
14+
${READTAGS} -eE -t output.tags -l
15+
${READTAGS} -e -t output.tags -l

Tmain/readtags-escaping-input-no-roundtrip.d/stderr-expected.txt

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
x a\tb\nc/f.c /^int x;$/;" kind:v typeref:typename:int
2+
x a\tb\nc/f.c /^int x;$/;" kind:v typeref:typename:int
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
# Copyright: 2022 Masatake YAMATO
4+
# License: GPL-2
5+
6+
CTAGS=$1
7+
READTAGS=$3
8+
INPUT=$(printf "a\tb\nc")
9+
10+
. ../utils.sh
11+
12+
exit_if_win32
13+
14+
if ! [ -x "${READTAGS}" ]; then
15+
skip "no readtags"
16+
fi
17+
18+
mkdir -p "${INPUT}"
19+
echo "int x;" > "${INPUT}/f.c"
20+
21+
O="--quiet --options=NONE -o - -R --fields=+z"
22+
echo "# ctags:"
23+
${CTAGS} $O "${INPUT}"
24+
25+
echo "# ctags | readtags:"
26+
${CTAGS} $O "${INPUT}" | ${READTAGS} -eE -t - -l
27+
28+
rm -f "${INPUT}/f.c"
29+
rmdir "${INPUT}"

Tmain/readtags-escaping-input.d/stderr-expected.txt

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# ctags:
2+
x a\tb\nc/f.c /^int x;$/;" kind:v typeref:typename:int
3+
# ctags | readtags:
4+
x a\tb\nc/f.c /^int x;$/;" kind:v typeref:typename:int

Tmain/readtags-ptags-escaping.d/stdout-expected.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ regular_tag\\ /path/to/file /^pattern$/
88
regular_tag\t /path/to/file /^pattern$/
99

1010
# regular-input-b_.tags
11-
regular_tag /path/to/file\\ /^pattern$/
11+
regular_tag /path/to/file\ /^pattern$/
1212

1313
# regular-input-bb.tags
14-
regular_tag /path/to/file\\\\ /^pattern$/
14+
regular_tag /path/to/file\\ /^pattern$/
1515

1616
# regular-input-bt.tags
17-
regular_tag /path/to/file\\t /^pattern$/
17+
regular_tag /path/to/file\t /^pattern$/
1818

1919
# regular-kind-b_.tags
2020
regular_tag /path/to/file /^pattern$/;" kind:\\
@@ -32,11 +32,11 @@ regular_tag /path/to/file /^pattern$/;" kind:\\
3232
!_PTAG\t value /comment/
3333

3434
# pseudo-input-b_.tags
35-
!_PTAG value\\ /comment/
35+
!_PTAG value\ /comment/
3636

3737
# pseudo-input-bb.tags
38-
!_PTAG value\\\\ /comment/
38+
!_PTAG value\\ /comment/
3939

4040
# pseudo-input-bt.tags
41-
!_PTAG value\\t /comment/
41+
!_PTAG value\t /comment/
4242

extra-cmds/printtags.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ static void tagsPrintTag (const tagEntry *entry,
142142
print_str, print_char, outfp);
143143

144144
print_char ('\t', outfp);
145-
printValue (entry->file, printingWithEscaping,
146-
print_str, print_char, outfp);
145+
print_str (entry->file, outfp);
147146
print_char ('\t', outfp);
148147
print_str (entry->address.pattern, outfp);
149148

0 commit comments

Comments
 (0)