Skip to content

Commit 2b88b80

Browse files
authored
Merge pull request #3028 from masatake/makeTagEntryReflection-preparation
optscript: bug fix, new operators, refactoring
2 parents 1801e5e + b6124a6 commit 2b88b80

Some content is hidden

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

45 files changed

+594
-161
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[/a /b /c]
2+
true
3+
true
4+
true
5+
false
6+
[1 true (abc)]
7+
true
8+
false
9+
true
10+
false
11+
true
12+
false

Tmain/common-prelude.d/amember.ps

325 Bytes
Binary file not shown.

Tmain/common-prelude.d/stdout-expected.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
amember.ps...0
12
buildstring.ps...0
23
dedup.ps...0
34
dedup_spaces.ps...0

Tmain/fixed-field-handling.d/stdout-expected.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
# writer=default
22
N name yes NONE s-- yes rw tag name
3-
F input yes NONE s-- yes -- input file
3+
F input yes NONE s-- yes r- input file
44
P pattern yes NONE s-b yes -- pattern
55
# writer=u-ctags
66
N name yes NONE s-- yes rw tag name
7-
F input yes NONE s-- yes -- input file
7+
F input yes NONE s-- yes r- input file
88
P pattern yes NONE s-b yes -- pattern
99
# writer=e-ctags
1010
N name yes NONE s-- yes rw tag name
11-
F input yes NONE s-- yes -- input file
11+
F input yes NONE s-- yes r- input file
1212
P pattern yes NONE s-b yes -- pattern
1313
# writer=etags
14-
F input yes NONE s-- no -- input file
14+
F input yes NONE s-- no r- input file
1515
N name yes NONE s-- no rw tag name
1616
P pattern yes NONE s-b no -- pattern
1717
# writer=xref
18-
F input yes NONE s-- no -- input file
18+
F input yes NONE s-- no r- input file
1919
N name yes NONE s-- no rw tag name
2020
P pattern yes NONE s-b no -- pattern
2121
# writer=json
22-
F input yes NONE s-- no -- input file
22+
F input yes NONE s-- no r- input file
2323
N name yes NONE s-- no rw tag name
2424
P pattern yes NONE s-b no -- pattern
2525
# writer=xref N
26-
F input yes NONE s-- no -- input file
26+
F input yes NONE s-- no r- input file
2727
N name no NONE s-- no rw tag name
2828
P pattern yes NONE s-b no -- pattern
2929
# writer=xref F
30-
F input no NONE s-- no -- input file
30+
F input no NONE s-- no r- input file
3131
N name yes NONE s-- no rw tag name
3232
P pattern yes NONE s-b no -- pattern
3333
# writer=xref P
34-
F input yes NONE s-- no -- input file
34+
F input yes NONE s-- no r- input file
3535
N name yes NONE s-- no rw tag name
3636
P pattern no NONE s-b no -- pattern
3737
# writer=json N
38-
F input yes NONE s-- no -- input file
38+
F input yes NONE s-- no r- input file
3939
N name no NONE s-- no rw tag name
4040
P pattern yes NONE s-b no -- pattern
4141
# writer=json F
42-
F input no NONE s-- no -- input file
42+
F input no NONE s-- no r- input file
4343
N name yes NONE s-- no rw tag name
4444
P pattern yes NONE s-b no -- pattern
4545
# writer=json P
46-
F input yes NONE s-- no -- input file
46+
F input yes NONE s-- no r- input file
4747
N name yes NONE s-- no rw tag name
4848
P pattern no NONE s-b no -- pattern
4949
# writer=json --fields=-N

Tmain/getter-extras-field.d/stderr-expected.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ true
22
[/reference]
33
true
44
[/qualified /reference]
5-
false
5+
true
6+
[/X.foo]
67
true
78
[/reference /X.foo]

Tmain/list-fields-fixed-field-handling.d/stdout-expected.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# --output-format=u-ctags --fields=n --list-fields
22
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
33
N name yes NONE s-- yes rw tag name
4-
F input yes NONE s-- yes -- input file
4+
F input yes NONE s-- yes r- input file
55
P pattern yes NONE s-b yes -- pattern
66
C compact no NONE s-- no -- compact input line (used only in xref output)
77
E extras no NONE s-- no r- Extra tag type information
@@ -27,7 +27,7 @@ z kind no NONE s-- no r- [tags output] pr
2727
# --fields=n --output-format=u-ctags --list-fields
2828
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
2929
N name yes NONE s-- yes rw tag name
30-
F input yes NONE s-- yes -- input file
30+
F input yes NONE s-- yes r- input file
3131
P pattern yes NONE s-b yes -- pattern
3232
C compact no NONE s-- no -- compact input line (used only in xref output)
3333
E extras no NONE s-- no r- Extra tag type information
@@ -54,7 +54,7 @@ z kind no NONE s-- no r- [tags output] pr
5454
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
5555
C compact no NONE s-- no -- compact input line (used only in xref output)
5656
E extras no NONE s-- no r- Extra tag type information
57-
F input no NONE s-- no -- input file
57+
F input no NONE s-- no r- input file
5858
K NONE no NONE s-- no -- Kind of tag in long-name form
5959
N name no NONE s-- no rw tag name
6060
P pattern no NONE s-b no -- pattern
@@ -80,7 +80,7 @@ z kind no NONE s-- no r- [tags output] pr
8080
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
8181
C compact no NONE s-- no -- compact input line (used only in xref output)
8282
E extras no NONE s-- no r- Extra tag type information
83-
F input no NONE s-- no -- input file
83+
F input no NONE s-- no r- input file
8484
K NONE no NONE s-- no -- Kind of tag in long-name form
8585
N name no NONE s-- no rw tag name
8686
P pattern no NONE s-b no -- pattern

Tmain/list-fields.d/stdout-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
22
N name yes NONE s-- yes rw tag name
3-
F input yes NONE s-- yes -- input file
3+
F input yes NONE s-- yes r- input file
44
P pattern yes NONE s-b yes -- pattern
55
C compact no NONE s-- no -- compact input line (used only in xref output)
66
E extras no NONE s-- no r- Extra tag type information
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--langdef=C10{base=C}
2+
--_prelude-C10={{
3+
(prelude C10) ==
4+
}}
5+
--_sequel-C10={{
6+
(sequel C10) ==
7+
}}
8+
9+
10+
--langdef=C11{base=C}
11+
--_prelude-C11={{
12+
(prelude C11) ==
13+
}}
14+
--_sequel-C11={{
15+
(sequel C11) ==
16+
}}
17+
18+
--langdef=C20{base=C10}
19+
--_prelude-C20={{
20+
(prelude C20) ==
21+
}}
22+
--_sequel-C20={{
23+
(sequel C20) ==
24+
}}
25+
26+
27+
--langdef=C30{base=C20}
28+
--_prelude-C30={{
29+
(prelude C30) ==
30+
}}
31+
--_sequel-C30={{
32+
(sequel C30) ==
33+
}}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--langdef=CPreProcessor10{base=CPreProcessor}
2+
--_prelude-CPreProcessor10={{
3+
(prelude CPreProcessor10) ==
4+
}}
5+
--_sequel-CPreProcessor10={{
6+
(sequel CPreProcessor10) ==
7+
}}
8+
9+
10+
--langdef=CPreProcessor11{base=CPreProcessor}
11+
--_prelude-CPreProcessor11={{
12+
(prelude CPreProcessor11) ==
13+
}}
14+
--_sequel-CPreProcessor11={{
15+
(sequel CPreProcessor11) ==
16+
}}
17+
18+
--langdef=CPreProcessor20{base=CPreProcessor10}
19+
--_prelude-CPreProcessor20={{
20+
(prelude CPreProcessor20) ==
21+
}}
22+
--_sequel-CPreProcessor20={{
23+
(sequel CPreProcessor20) ==
24+
}}
25+
26+
27+
--langdef=CPreProcessor30{base=CPreProcessor20}
28+
--_prelude-CPreProcessor30={{
29+
(prelude CPreProcessor30) ==
30+
}}
31+
--_sequel-CPreProcessor30={{
32+
(sequel CPreProcessor30) ==
33+
}}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--langdef=DTS10{base=DTS}
2+
--_prelude-DTS10={{
3+
(prelude DTS10) ==
4+
}}
5+
--_sequel-DTS10={{
6+
(sequel DTS10) ==
7+
}}
8+
9+
10+
--langdef=DTS11{base=DTS}
11+
--_prelude-DTS11={{
12+
(prelude DTS11) ==
13+
}}
14+
--_sequel-DTS11={{
15+
(sequel DTS11) ==
16+
}}
17+
18+
--langdef=DTS20{base=DTS10}
19+
--_prelude-DTS20={{
20+
(prelude DTS20) ==
21+
}}
22+
--_sequel-DTS20={{
23+
(sequel DTS20) ==
24+
}}
25+
26+
27+
--langdef=DTS30{base=DTS20}
28+
--_prelude-DTS30={{
29+
(prelude DTS30) ==
30+
}}
31+
--_sequel-DTS30={{
32+
(sequel DTS30) ==
33+
}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* EMPTY */

Tmain/optscript-preludes-stack.d/input.dts

Whitespace-only changes.

Tmain/optscript-preludes-stack.d/input.i

Whitespace-only changes.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright: 2021 Masatake YAMATO
2+
# License: GPL-2
3+
4+
CTAGS=$1
5+
6+
. ../utils.sh
7+
: &&
8+
${CTAGS} --quiet --options=NONE\
9+
--_prelude-C='{{ (enter C) == }}' \
10+
--_sequel-C='{{ (leave C) == }}' \
11+
--options=./args-c.ctags -o - input.c &&
12+
${CTAGS} --quiet --options=NONE \
13+
--_prelude-DTS='{{ (enter DTS) == }}' \
14+
--_sequel-DTS='{{ (leave DTS) == }}' \
15+
--options=./args-dts.ctags -o - input.dts &&
16+
${CTAGS} --quiet --options=NONE --map-CPreProcessor=+.i \
17+
--_prelude-CPreProcessor='{{ (enter CPreProcessor) == }}' \
18+
--_sequel-CPreProcessor='{{ (leave CPreProcessor) == }}' \
19+
--options=./args-cpreprocessor.ctags -o - input.i
20+
21+
#
22+
# BUGS: The following two don't work because in-use marker is not set to
23+
# the subparsers of the CPreprocessor parser. The CPreprocessor parser must
24+
# mark in-use on its sub parsers to call the inputStart and inputEnd methods
25+
# in the foreachSubparser loop.
26+
#
27+
# ${CTAGS} --quiet --options=NONE --options=./args-cpreprocessor.ctags -o - input.c
28+
# ${CTAGS} --quiet --options=NONE --options=./args-cpreprocessor.ctags -o - input.dts
29+
#
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(enter C)
2+
(prelude C10)
3+
(prelude C20)
4+
(prelude C30)
5+
(prelude C11)
6+
(sequel C30)
7+
(sequel C20)
8+
(sequel C10)
9+
(sequel C11)
10+
(leave C)
11+
(enter DTS)
12+
(prelude DTS10)
13+
(prelude DTS20)
14+
(prelude DTS30)
15+
(prelude DTS11)
16+
(sequel DTS30)
17+
(sequel DTS20)
18+
(sequel DTS10)
19+
(sequel DTS11)
20+
(leave DTS)
21+
ctags: Warning: Because of an internal limitation, Making a sub parser based on the CPreProcessor parser is not allowed: CPreProcessor
22+
ctags: Warning: Because of an internal limitation, Making a sub parser based on the CPreProcessor parser is not allowed: CPreProcessor
23+
(enter CPreProcessor)
24+
(leave CPreProcessor)

Tmain/optscript-preludes-stack.d/stdout-expected.txt

Whitespace-only changes.

Tmain/optscript.d/control.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
5
2727
7
2828
9
29+
exit in for:
30+
=> passed
31+
exit in forall string:
32+
=> passed
33+
exit in forall array:
34+
=> passed
35+
exit in forall dict:
36+
=> passed
2937
(---------------- countexecstack ----------------)
3038
3
3139
(---------------- execstack ----------------)

Tmain/optscript.d/control.ps

532 Bytes
Binary file not shown.

Tmain/optscript.d/read-and-print.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,6 @@ efg
8383
/B [0 1 2]
8484
>> ]
8585
>> ]
86+
char after metachar
87+
[97]
88+
[10]

Tmain/optscript.d/read-and-print.ps

42 Bytes
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--sort=no
2+
--langdef=UnknownX
3+
--map-UnknownX=.unknown
4+
5+
--kinddef-UnknownX=d,def,definitions
6+
7+
--regex-UnknownX=/([ \t]*)def +([a-zA-Z]):/\2/d/{{
8+
\1 length 5 gt {
9+
. _markplaceholder
10+
} if
11+
}}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
a input.unknown /^def a:$/;" d
2+
b input.unknown /^ def b:$/;" d
3+
A input.unknown /^def A:$/;" d
4+
B input.unknown /^ def B:$/;" d
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def a:
2+
def b:
3+
def c:
4+
def A:
5+
def B:
6+
def C:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--langdef=FOO
2+
--map-FOO=.foo
3+
--kinddef-FOO=d,def,definitions
4+
--_extradef-FOO=withprefix,name with prefix
5+
--extras-FOO=+{withprefix}
6+
--fields=+{extras}
7+
--regex-FOO=/def +([a-zA-Z]+)/\1/d/{{
8+
mark (<prefix>) . :name _buildstring
9+
. :kind
10+
. _tagloc _tag _commit
11+
/FOO.withprefix _markextra
12+
}}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<prefix>x input.foo /^def x$/;" d extras:withprefix
2+
<prefix>y input.foo /^def y$/;" d extras:withprefix
3+
x input.foo /^def x$/;" d
4+
y input.foo /^def y$/;" d
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def x
2+
def y
Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
--langdef=X
22
--map-X=.unknown
33
--kinddef-X=d,def,definitions
4+
--kinddef-X=t,type,type definitions
45

6+
--_prelude-X={{
7+
/typedict 5 dict def
8+
}}
9+
10+
--regex-X=/^type[ ]+([A-Z]+)$/\1/t/{{
11+
typedict \1 cvn . put
12+
}}
13+
14+
# [string string]
515
--regex-X=/def[ ]+([a-z]+)[ ]*:[ ]*([a-z]+)/\1/d/{{
6-
. [ (typename) \2 ] typeref:
16+
. [ (postfix) \2 ] typeref:
17+
}}
18+
19+
# string
20+
--regex-X=/def[ ]+<([a-z]+)>[ ]*([a-z]+)/\2/d/{{
21+
. \1 typeref:
22+
}}
23+
24+
# index
25+
--regex-X=/def[ ]+([A-Z]+)\^([a-z]+)/\2/d/{{
26+
typedict \1 cvn known {
27+
. typedict \1 cvn get typeref:
28+
} if
29+
}}
30+
31+
# false
32+
--regex-X=/def[ ]+([a-z]+)\^!([a-z]+)/\2/d/{{
33+
. \1 typeref:
34+
. false typeref:
735
}}

0 commit comments

Comments
 (0)