Skip to content

Commit f144bc8

Browse files
authored
Merge pull request #3678 from masatake/lregex--intervaltab
main: use the interval tree for filling scope field
2 parents 4cd897e + 45457aa commit f144bc8

File tree

113 files changed

+2038
-749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2038
-749
lines changed

Tmain/kind-abnormal-spec.d/stdout-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ L kind with no long name
55
N emit a normal tag
66
B beginning of an area for a guest
77
E end of an area for a guest
8+
Q stop the parsing
89
d a kind disabled by default [off]
910
e a kind enabled by default
1011
r emit a tag with multi roles
@@ -19,6 +20,7 @@ B ThisShouldNotBePrintedKindNameMustBeGiven yes no 0 NONE
1920
E ThisShouldNotBePrintedKindNameMustBeGiven yes no 0 NONE end of an area for a guest
2021
L ThisShouldNotBePrintedKindNameMustBeGiven yes no 0 NONE kind with no long name
2122
N nothingSpecial yes no 0 NONE emit a normal tag
23+
Q quit yes no 0 NONE stop the parsing
2224
R rolesDisabled no yes 2 NONE emit a tag with multi roles(disabled by default)
2325
b broken tag yes no 1 NONE name with unwanted characters
2426
d disabled no no 2 NONE a kind disabled by default

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ i icase applied in a case-insensit
55
p pcre2 use pcre2 regex engine
66
- fatal="MESSAGE" print the given MESSAGE and exit
77
- mgroup=N a group in pattern determining the line number of tag
8+
- scope=intervaltab set scope for the tag with the interval table
89
- warning="MESSAGE" print the given MESSAGE at WARNING level
910
- _advanceTo=N[start|end] a group in pattern from where the next scan starts [0end]
1011
- _anonymous=PREFIX make an anonymous tag with PREFIX

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ p pcre2 use pcre2 regex engine
66
- fatal="MESSAGE" print the given MESSAGE and exit
77
- mgroup=N a group in pattern determining the line number of tag
88
- placeholder don't put this tag to tags file.
9-
- scope=ACTION use scope stack: ACTION = ref|push|pop|clear|set|replace
9+
- scope=ACTION use scope stack: ACTION = ref|push|pop|clear|set|replace|intervaltab
1010
- tenter=TABLE[,CONT] enter to given regext table (with specifying continuation)
1111
- tjump=TABLE jump to another regext table(don't push the current table to state stack)
1212
- tleave leave from the current regext table

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ p pcre2 use pcre2 regex engine
66
x exclusive skip testing the other patterns if a line is matched to this pattern
77
- fatal="MESSAGE" print the given MESSAGE and exit
88
- placeholder don't put this tag to tags file.
9-
- scope=ACTION use scope stack: ACTION = ref|push|pop|clear|set|replace
9+
- postrun run after parsing with built-in code, multline regex patterns, and multitable regex patterns
10+
- scope=ACTION use scope stack: ACTION = ref|push|pop|clear|set|replace|intervaltab
1011
- warning="MESSAGE" print the given MESSAGE at WARNING level
1112
- _anonymous=PREFIX make an anonymous tag with PREFIX
1213
- _extra=EXTRA record the tag only when the extra is enabled
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Q
2+
a
3+
b
4+
c
5+
d
6+
e
7+
f
8+
g
9+
restdef:x
10+
restdef:y
11+
restdef:z
12+
13+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
# Copyright: 2023 Masatake YAMATO
4+
# License: GPL-2
5+
6+
CTAGS=$1
7+
8+
${CTAGS} --quiet --options=NONE -o - \
9+
--kinddef-CTagsSelfTest=a,name,names \
10+
--regex-CTagsSelfTest='/restdef:([a-z])/\1/a/' \
11+
--language-force=CTagsSelfTest input.cst
12+
13+
exit $?

Tmain/lregex-scan-the-rest-of-input.d/stderr-expected.txt

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
x input.cst /^restdef:x$/;" a
2+
y input.cst /^restdef:y$/;" a
3+
z input.cst /^restdef:z$/;" a
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
--sort=no
2+
3+
--langdef=Foo{base=C}{shared}
4+
--fields=+lr
5+
--extras=+r
6+
7+
--kinddef-Foo=r,readhandler,read handlers
8+
--kinddef-Foo=m,method,methods
9+
--_roledef-Foo.m=set,set a handler
10+
--kinddef-Foo=w,writehandler,write handlers
11+
--kinddef-Foo=s,seekhandler,seek handlers
12+
--kinddef-Foo=o,openhandler,open handlers
13+
--kinddef-Foo=R,releasehandler,release handlers
14+
15+
# tag:int
16+
--regex-Foo=/= ([a-z_]*_read),//{postrun}{{
17+
\1 /readhandler _tag _commit dup
18+
_intervaltab {
19+
scope:
20+
} {
21+
pop
22+
} ifelse
23+
}}
24+
25+
# tag:tag
26+
--regex-Foo=/\.([a-z_]+)[ \t]*=//{postrun}{{
27+
\1 /method /set _reftag dup
28+
_intervaltab {
29+
exch _commit exch scope:
30+
} {
31+
_commit
32+
} ifelse
33+
}}
34+
35+
# matchloc
36+
--regex-Foo=/= ([a-z_]*_write),//{postrun}{{
37+
\1 /writehandler _tag _commit
38+
@1 _intervaltab {
39+
scope:
40+
} {
41+
pop
42+
} ifelse
43+
}}
44+
45+
--regex-Foo=/= ([a-z_]*_l?lseek),//{postrun}{{
46+
\1 /seekhandler _tag _commit
47+
1@ _intervaltab {
48+
scope:
49+
} {
50+
pop
51+
} ifelse
52+
}}
53+
54+
# [line:int]
55+
--regex-Foo=/= ([a-z_]*_release),//{postrun}{{
56+
\1 /releasehandler _tag _commit
57+
[ 1@ _matchloc2line ] _intervaltab {
58+
scope:
59+
} {
60+
pop
61+
} ifelse
62+
}}
63+
64+
# [startline:int endline:int]
65+
--regex-Foo=/= ([a-z_]*_open)(,)//{postrun}{{
66+
\1 /openhandler _tag _commit
67+
[ 1@ _matchloc2line @2 _matchloc2line ] _intervaltab {
68+
scope:
69+
} {
70+
pop
71+
} ifelse
72+
}}

0 commit comments

Comments
 (0)