Skip to content

Commit 373135a

Browse files
committed
Man: fill end: fields
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent f998e51 commit 373135a

File tree

7 files changed

+79
-20
lines changed

7 files changed

+79
-20
lines changed

Tmain/json-output-format.d/stdout-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{"_type": "tag", "name": "main", "path": "input.go", "pattern": "/^package main$/", "kind": "package"}
99
# json --languages=+man --fields=*-T
1010
{"_type": "tag", "name": "Foo", "path": "input.py", "pattern": "/^class Foo:$/", "language": "Python", "line": 1, "kind": "class", "inherits": false, "access": "public", "roles": "def", "end": 3}
11-
{"_type": "tag", "name": "N\tA\tM\tE", "path": "input.1", "pattern": "/^.SH \"\tN\tA\tM\tE\t\"$/", "language": "Man", "line": 1, "kind": "section", "roles": "def"}
11+
{"_type": "tag", "name": "N\tA\tM\tE", "path": "input.1", "pattern": "/^.SH \"\tN\tA\tM\tE\t\"$/", "language": "Man", "line": 1, "kind": "section", "roles": "def", "end": 1}
1212
{"_type": "tag", "name": "doIt", "path": "input.py", "pattern": "/^ def doIt():$/", "language": "Python", "line": 2, "kind": "member", "access": "public", "signature": "()", "scope": "Foo", "scopeKind": "class", "roles": "def", "end": 3}
1313
{"_type": "tag", "name": "foo", "path": "input.c", "pattern": "/^static int foo (void)$/", "file": true, "language": "C", "line": 3, "typeref": "typename:int", "kind": "function", "signature": "(void)", "roles": "def", "extras": "fileScope", "end": 6}
1414
{"_type": "tag", "name": "main", "path": "input.c", "pattern": "/^main(void)$/", "language": "C", "line": 9, "typeref": "typename:int", "kind": "function", "signature": "(void)", "roles": "def", "end": 12}
@@ -24,7 +24,7 @@
2424
{"_type": "ptag", "name": "TAG_PROGRAM_URL", "path": "https://ctags.io/", "pattern": "official site"}
2525
{"_type": "tag", "name": "Foo", "path": "input.py", "pattern": "/^class Foo:$/", "language": "Python", "line": 1, "kind": "class", "inherits": false, "access": "public", "roles": "def", "end": 3}
2626
{"_type": "tag", "name": "Foo.doIt", "path": "input.py", "pattern": "/^ def doIt():$/", "language": "Python", "line": 2, "kind": "member", "access": "public", "signature": "()", "scope": "Foo", "scopeKind": "class", "roles": "def", "extras": "qualified", "end": 3}
27-
{"_type": "tag", "name": "N\tA\tM\tE", "path": "input.1", "pattern": "/^.SH \"\tN\tA\tM\tE\t\"$/", "language": "Man", "line": 1, "kind": "section", "roles": "def"}
27+
{"_type": "tag", "name": "N\tA\tM\tE", "path": "input.1", "pattern": "/^.SH \"\tN\tA\tM\tE\t\"$/", "language": "Man", "line": 1, "kind": "section", "roles": "def", "end": 1}
2828
{"_type": "tag", "name": "doIt", "path": "input.py", "pattern": "/^ def doIt():$/", "language": "Python", "line": 2, "kind": "member", "access": "public", "signature": "()", "scope": "Foo", "scopeKind": "class", "roles": "def", "end": 3}
2929
{"_type": "tag", "name": "foo", "path": "input.c", "pattern": "/^static int foo (void)$/", "file": true, "language": "C", "line": 3, "typeref": "typename:int", "kind": "function", "signature": "(void)", "roles": "def", "extras": "fileScope", "end": 6}
3030
{"_type": "tag", "name": "input.1", "path": "input.1", "pattern": false, "language": "Man", "line": 1, "kind": "file", "roles": "def", "extras": "inputFile", "end": 1}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--sort=no
2+
--fields=+e
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
CTAGS input.1 /^.TH "CTAGS" 1 "Version 0.0.0" "Darren Hiebert" "Universal Ctags"$/;" t
2-
NAME input.1 /^.SH "NAME"$/;" s title:CTAGS
1+
CTAGS input.1 /^.TH "CTAGS" 1 "Version 0.0.0" "Darren Hiebert" "Universal Ctags"$/;" t end:7
2+
NAME input.1 /^.SH "NAME"$/;" s title:CTAGS end:7
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
--sort=no
2+
--fields=+e
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CTAGS input.1 /^.TH CTAGS 1 "Version 0.0.0" "Darren Hiebert" "Universal Ctags"$/;" t
2-
NAME input.1 /^.SH "NAME"$/;" s title:CTAGS
3-
SYNOPSIS input.1 /^.SH SYNOPSIS$/;" s title:CTAGS
4-
DESCRIPTION input.1 /^.SH "DESCRIPTION"$/;" s title:CTAGS
5-
AUTHOR input.1 /^.SH AUTHOR$/;" s title:CTAGS
6-
SEE ALSO input.1 /^.SH SEE ALSO$/;" s title:CTAGS
1+
CTAGS input.1 /^.TH CTAGS 1 "Version 0.0.0" "Darren Hiebert" "Universal Ctags"$/;" t end:30
2+
NAME input.1 /^.SH "NAME"$/;" s title:CTAGS end:7
3+
SYNOPSIS input.1 /^.SH SYNOPSIS$/;" s title:CTAGS end:14
4+
DESCRIPTION input.1 /^.SH "DESCRIPTION"$/;" s title:CTAGS end:23
5+
AUTHOR input.1 /^.SH AUTHOR$/;" s title:CTAGS end:27
6+
SEE ALSO input.1 /^.SH SEE ALSO$/;" s title:CTAGS end:30

optlib/man.c

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,63 @@ static void initializeManParser (const langType language)
1212
{
1313

1414
addLanguageRegexTable (language, "main");
15+
addLanguageRegexTable (language, "section");
16+
addLanguageRegexTable (language, "EOF");
17+
addLanguageRegexTable (language, "SKIP");
18+
addLanguageRegexTable (language, "REST");
19+
addLanguageRegexTable (language, "GUARD");
1520

1621
addLanguageTagMultiTableRegex (language, "main",
1722
"^([^\n.]|\\.[^\nst])[^\n]*\n",
1823
"", "", "{icase}", NULL);
1924
addLanguageTagMultiTableRegex (language, "main",
2025
"^\\.TH[\t ]+\"([^\"]+)\"[^\n]*\n",
21-
"\\1", "t", "{icase}{scope=push}", NULL);
26+
"\\1", "t", "{icase}{scope=set}", NULL);
2227
addLanguageTagMultiTableRegex (language, "main",
2328
"^\\.TH[\t ]+([^\t \n]+)[^\n]*\n",
24-
"\\1", "t", "{icase}{scope=push}", NULL);
29+
"\\1", "t", "{icase}{scope=set}", NULL);
2530
addLanguageTagMultiTableRegex (language, "main",
2631
"^\\.SH[\t ]+\"([^\"\n]+)\"[^\n]*\n",
27-
"\\1", "s", "{icase}{scope=ref}", NULL);
32+
"\\1", "s", "{icase}{scope=push}{tenter=section}", NULL);
2833
addLanguageTagMultiTableRegex (language, "main",
2934
"^\\.SH[\t ]+([^\n]+)\n",
30-
"\\1", "s", "{icase}{scope=ref}", NULL);
35+
"\\1", "s", "{icase}{scope=push}{tenter=section}", NULL);
3136
addLanguageTagMultiTableRegex (language, "main",
3237
"^[^\n]*\n|[^\n]+",
3338
"", "", "", NULL);
39+
addLanguageTagMultiTableRegex (language, "main",
40+
"^",
41+
"", "", "{scope=clear}{tquit}", NULL);
42+
addLanguageTagMultiTableRegex (language, "section",
43+
"^([^\n.]|\\.[^\nst])[^\n]*\n",
44+
"", "", "{icase}", NULL);
45+
addLanguageTagMultiTableRegex (language, "section",
46+
"^\\.SH[\t ]+\"([^\"\n]+)\"[^\n]*\n",
47+
"\\1", "s", "{icase}{scope=replace}", NULL);
48+
addLanguageTagMultiTableRegex (language, "section",
49+
"^\\.SH[\t ]+([^\n]+)\n",
50+
"\\1", "s", "{icase}{scope=replace}", NULL);
51+
addLanguageTagMultiTableRegex (language, "section",
52+
"^[^\n]*\n|[^\n]+",
53+
"", "", "", NULL);
54+
addLanguageTagMultiTableRegex (language, "section",
55+
"^",
56+
"", "", "{scope=clear}{tquit}", NULL);
57+
addLanguageTagMultiTableRegex (language, "EOF",
58+
"^",
59+
"", "", "{scope=clear}{tquit}", NULL);
60+
addLanguageTagMultiTableRegex (language, "SKIP",
61+
"^[^\n]*\n|[^\n]+",
62+
"", "", "", NULL);
63+
addLanguageTagMultiTableRegex (language, "REST",
64+
"^[^\n]*\n|[^\n]+",
65+
"", "", "", NULL);
66+
addLanguageTagMultiTableRegex (language, "REST",
67+
"^",
68+
"", "", "{scope=clear}{tquit}", NULL);
69+
addLanguageTagMultiTableRegex (language, "GUARD",
70+
"^([^\n.]|\\.[^\nst])[^\n]*\n",
71+
"", "", "{icase}", NULL);
3472
}
3573

3674
extern parserDefinition* ManParser (void)

optlib/man.ctags

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,28 @@
4343
--kinddef-Man=s,section,sections
4444

4545
--_tabledef-Man=main
46+
--_tabledef-Man=section
4647

47-
--_mtable-regex-Man=main/([^\n.]|\.[^\nst])[^\n]*\n//{icase}
48-
--_mtable-regex-Man=main/\.TH[\t ]+"([^"]+)"[^\n]*\n/\1/t/{icase}{scope=push}
49-
--_mtable-regex-Man=main/\.TH[\t ]+([^\t \n]+)[^\n]*\n/\1/t/{icase}{scope=push}
50-
--_mtable-regex-Man=main/\.SH[\t ]+"([^"\n]+)"[^\n]*\n/\1/s/{icase}{scope=ref}
51-
--_mtable-regex-Man=main/\.SH[\t ]+([^\n]+)\n/\1/s/{icase}{scope=ref}
52-
--_mtable-regex-Man=main/[^\n]*\n|[^\n]+//
48+
--_tabledef-Man=EOF
49+
--_tabledef-Man=SKIP
50+
--_tabledef-Man=REST
51+
--_tabledef-Man=GUARD
52+
53+
54+
--_mtable-regex-Man=GUARD/([^\n.]|\.[^\nst])[^\n]*\n//{icase}
55+
--_mtable-regex-Man=SKIP/[^\n]*\n|[^\n]+//
56+
--_mtable-regex-Man=EOF///{scope=clear}{tquit}
57+
--_mtable-extend-Man=REST+SKIP
58+
--_mtable-extend-Man=REST+EOF
59+
60+
--_mtable-extend-Man=main+GUARD
61+
--_mtable-regex-Man=main/\.TH[\t ]+"([^"]+)"[^\n]*\n/\1/t/{icase}{scope=set}
62+
--_mtable-regex-Man=main/\.TH[\t ]+([^\t \n]+)[^\n]*\n/\1/t/{icase}{scope=set}
63+
--_mtable-regex-Man=main/\.SH[\t ]+"([^"\n]+)"[^\n]*\n/\1/s/{icase}{scope=push}{tenter=section}
64+
--_mtable-regex-Man=main/\.SH[\t ]+([^\n]+)\n/\1/s/{icase}{scope=push}{tenter=section}
65+
--_mtable-extend-Man=main+REST
66+
67+
--_mtable-extend-Man=section+GUARD
68+
--_mtable-regex-Man=section/\.SH[\t ]+"([^"\n]+)"[^\n]*\n/\1/s/{icase}{scope=replace}
69+
--_mtable-regex-Man=section/\.SH[\t ]+([^\n]+)\n/\1/s/{icase}{scope=replace}
70+
--_mtable-extend-Man=section+REST

0 commit comments

Comments
 (0)