Skip to content

Commit

Permalink
Merge pull request #3028 from masatake/makeTagEntryReflection-prepara…
Browse files Browse the repository at this point in the history
…tion

optscript: bug fix, new operators, refactoring
  • Loading branch information
masatake authored May 20, 2021
2 parents 1801e5e + b6124a6 commit 2b88b80
Show file tree
Hide file tree
Showing 45 changed files with 594 additions and 161 deletions.
12 changes: 12 additions & 0 deletions Tmain/common-prelude.d/amember.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[/a /b /c]
true
true
true
false
[1 true (abc)]
true
false
true
false
true
false
Binary file added Tmain/common-prelude.d/amember.ps
Binary file not shown.
1 change: 1 addition & 0 deletions Tmain/common-prelude.d/stdout-expected.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
amember.ps...0
buildstring.ps...0
dedup.ps...0
dedup_spaces.ps...0
Expand Down
24 changes: 12 additions & 12 deletions Tmain/fixed-field-handling.d/stdout-expected.txt
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
# writer=default
N name yes NONE s-- yes rw tag name
F input yes NONE s-- yes -- input file
F input yes NONE s-- yes r- input file
P pattern yes NONE s-b yes -- pattern
# writer=u-ctags
N name yes NONE s-- yes rw tag name
F input yes NONE s-- yes -- input file
F input yes NONE s-- yes r- input file
P pattern yes NONE s-b yes -- pattern
# writer=e-ctags
N name yes NONE s-- yes rw tag name
F input yes NONE s-- yes -- input file
F input yes NONE s-- yes r- input file
P pattern yes NONE s-b yes -- pattern
# writer=etags
F input yes NONE s-- no -- input file
F input yes NONE s-- no r- input file
N name yes NONE s-- no rw tag name
P pattern yes NONE s-b no -- pattern
# writer=xref
F input yes NONE s-- no -- input file
F input yes NONE s-- no r- input file
N name yes NONE s-- no rw tag name
P pattern yes NONE s-b no -- pattern
# writer=json
F input yes NONE s-- no -- input file
F input yes NONE s-- no r- input file
N name yes NONE s-- no rw tag name
P pattern yes NONE s-b no -- pattern
# writer=xref N
F input yes NONE s-- no -- input file
F input yes NONE s-- no r- input file
N name no NONE s-- no rw tag name
P pattern yes NONE s-b no -- pattern
# writer=xref F
F input no NONE s-- no -- input file
F input no NONE s-- no r- input file
N name yes NONE s-- no rw tag name
P pattern yes NONE s-b no -- pattern
# writer=xref P
F input yes NONE s-- no -- input file
F input yes NONE s-- no r- input file
N name yes NONE s-- no rw tag name
P pattern no NONE s-b no -- pattern
# writer=json N
F input yes NONE s-- no -- input file
F input yes NONE s-- no r- input file
N name no NONE s-- no rw tag name
P pattern yes NONE s-b no -- pattern
# writer=json F
F input no NONE s-- no -- input file
F input no NONE s-- no r- input file
N name yes NONE s-- no rw tag name
P pattern yes NONE s-b no -- pattern
# writer=json P
F input yes NONE s-- no -- input file
F input yes NONE s-- no r- input file
N name yes NONE s-- no rw tag name
P pattern no NONE s-b no -- pattern
# writer=json --fields=-N
Expand Down
3 changes: 2 additions & 1 deletion Tmain/getter-extras-field.d/stderr-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ true
[/reference]
true
[/qualified /reference]
false
true
[/X.foo]
true
[/reference /X.foo]
8 changes: 4 additions & 4 deletions Tmain/list-fields-fixed-field-handling.d/stdout-expected.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# --output-format=u-ctags --fields=n --list-fields
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
N name yes NONE s-- yes rw tag name
F input yes NONE s-- yes -- input file
F input yes NONE s-- yes r- input file
P pattern yes NONE s-b yes -- pattern
C compact no NONE s-- no -- compact input line (used only in xref output)
E extras no NONE s-- no r- Extra tag type information
Expand All @@ -27,7 +27,7 @@ z kind no NONE s-- no r- [tags output] pr
# --fields=n --output-format=u-ctags --list-fields
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
N name yes NONE s-- yes rw tag name
F input yes NONE s-- yes -- input file
F input yes NONE s-- yes r- input file
P pattern yes NONE s-b yes -- pattern
C compact no NONE s-- no -- compact input line (used only in xref output)
E extras no NONE s-- no r- Extra tag type information
Expand All @@ -54,7 +54,7 @@ z kind no NONE s-- no r- [tags output] pr
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
C compact no NONE s-- no -- compact input line (used only in xref output)
E extras no NONE s-- no r- Extra tag type information
F input no NONE s-- no -- input file
F input no NONE s-- no r- input file
K NONE no NONE s-- no -- Kind of tag in long-name form
N name no NONE s-- no rw tag name
P pattern no NONE s-b no -- pattern
Expand All @@ -80,7 +80,7 @@ z kind no NONE s-- no r- [tags output] pr
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
C compact no NONE s-- no -- compact input line (used only in xref output)
E extras no NONE s-- no r- Extra tag type information
F input no NONE s-- no -- input file
F input no NONE s-- no r- input file
K NONE no NONE s-- no -- Kind of tag in long-name form
N name no NONE s-- no rw tag name
P pattern no NONE s-b no -- pattern
Expand Down
2 changes: 1 addition & 1 deletion Tmain/list-fields.d/stdout-expected.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
N name yes NONE s-- yes rw tag name
F input yes NONE s-- yes -- input file
F input yes NONE s-- yes r- input file
P pattern yes NONE s-b yes -- pattern
C compact no NONE s-- no -- compact input line (used only in xref output)
E extras no NONE s-- no r- Extra tag type information
Expand Down
33 changes: 33 additions & 0 deletions Tmain/optscript-preludes-stack.d/args-c.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--langdef=C10{base=C}
--_prelude-C10={{
(prelude C10) ==
}}
--_sequel-C10={{
(sequel C10) ==
}}


--langdef=C11{base=C}
--_prelude-C11={{
(prelude C11) ==
}}
--_sequel-C11={{
(sequel C11) ==
}}

--langdef=C20{base=C10}
--_prelude-C20={{
(prelude C20) ==
}}
--_sequel-C20={{
(sequel C20) ==
}}


--langdef=C30{base=C20}
--_prelude-C30={{
(prelude C30) ==
}}
--_sequel-C30={{
(sequel C30) ==
}}
33 changes: 33 additions & 0 deletions Tmain/optscript-preludes-stack.d/args-cpreprocessor.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--langdef=CPreProcessor10{base=CPreProcessor}
--_prelude-CPreProcessor10={{
(prelude CPreProcessor10) ==
}}
--_sequel-CPreProcessor10={{
(sequel CPreProcessor10) ==
}}


--langdef=CPreProcessor11{base=CPreProcessor}
--_prelude-CPreProcessor11={{
(prelude CPreProcessor11) ==
}}
--_sequel-CPreProcessor11={{
(sequel CPreProcessor11) ==
}}

--langdef=CPreProcessor20{base=CPreProcessor10}
--_prelude-CPreProcessor20={{
(prelude CPreProcessor20) ==
}}
--_sequel-CPreProcessor20={{
(sequel CPreProcessor20) ==
}}


--langdef=CPreProcessor30{base=CPreProcessor20}
--_prelude-CPreProcessor30={{
(prelude CPreProcessor30) ==
}}
--_sequel-CPreProcessor30={{
(sequel CPreProcessor30) ==
}}
33 changes: 33 additions & 0 deletions Tmain/optscript-preludes-stack.d/args-dts.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--langdef=DTS10{base=DTS}
--_prelude-DTS10={{
(prelude DTS10) ==
}}
--_sequel-DTS10={{
(sequel DTS10) ==
}}


--langdef=DTS11{base=DTS}
--_prelude-DTS11={{
(prelude DTS11) ==
}}
--_sequel-DTS11={{
(sequel DTS11) ==
}}

--langdef=DTS20{base=DTS10}
--_prelude-DTS20={{
(prelude DTS20) ==
}}
--_sequel-DTS20={{
(sequel DTS20) ==
}}


--langdef=DTS30{base=DTS20}
--_prelude-DTS30={{
(prelude DTS30) ==
}}
--_sequel-DTS30={{
(sequel DTS30) ==
}}
1 change: 1 addition & 0 deletions Tmain/optscript-preludes-stack.d/exit-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions Tmain/optscript-preludes-stack.d/input.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* EMPTY */
Empty file.
Empty file.
29 changes: 29 additions & 0 deletions Tmain/optscript-preludes-stack.d/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright: 2021 Masatake YAMATO
# License: GPL-2

CTAGS=$1

. ../utils.sh
: &&
${CTAGS} --quiet --options=NONE\
--_prelude-C='{{ (enter C) == }}' \
--_sequel-C='{{ (leave C) == }}' \
--options=./args-c.ctags -o - input.c &&
${CTAGS} --quiet --options=NONE \
--_prelude-DTS='{{ (enter DTS) == }}' \
--_sequel-DTS='{{ (leave DTS) == }}' \
--options=./args-dts.ctags -o - input.dts &&
${CTAGS} --quiet --options=NONE --map-CPreProcessor=+.i \
--_prelude-CPreProcessor='{{ (enter CPreProcessor) == }}' \
--_sequel-CPreProcessor='{{ (leave CPreProcessor) == }}' \
--options=./args-cpreprocessor.ctags -o - input.i

#
# BUGS: The following two don't work because in-use marker is not set to
# the subparsers of the CPreprocessor parser. The CPreprocessor parser must
# mark in-use on its sub parsers to call the inputStart and inputEnd methods
# in the foreachSubparser loop.
#
# ${CTAGS} --quiet --options=NONE --options=./args-cpreprocessor.ctags -o - input.c
# ${CTAGS} --quiet --options=NONE --options=./args-cpreprocessor.ctags -o - input.dts
#
24 changes: 24 additions & 0 deletions Tmain/optscript-preludes-stack.d/stderr-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(enter C)
(prelude C10)
(prelude C20)
(prelude C30)
(prelude C11)
(sequel C30)
(sequel C20)
(sequel C10)
(sequel C11)
(leave C)
(enter DTS)
(prelude DTS10)
(prelude DTS20)
(prelude DTS30)
(prelude DTS11)
(sequel DTS30)
(sequel DTS20)
(sequel DTS10)
(sequel DTS11)
(leave DTS)
ctags: Warning: Because of an internal limitation, Making a sub parser based on the CPreProcessor parser is not allowed: CPreProcessor
ctags: Warning: Because of an internal limitation, Making a sub parser based on the CPreProcessor parser is not allowed: CPreProcessor
(enter CPreProcessor)
(leave CPreProcessor)
Empty file.
8 changes: 8 additions & 0 deletions Tmain/optscript.d/control.expected
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
5
7
9
exit in for:
=> passed
exit in forall string:
=> passed
exit in forall array:
=> passed
exit in forall dict:
=> passed
(---------------- countexecstack ----------------)
3
(---------------- execstack ----------------)
Expand Down
Binary file modified Tmain/optscript.d/control.ps
Binary file not shown.
3 changes: 3 additions & 0 deletions Tmain/optscript.d/read-and-print.expected
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ efg
/B [0 1 2]
>> ]
>> ]
char after metachar
[97]
[10]
Binary file modified Tmain/optscript.d/read-and-print.ps
Binary file not shown.
11 changes: 11 additions & 0 deletions Units/optscript.r/op-markplaceholder.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--sort=no
--langdef=UnknownX
--map-UnknownX=.unknown

--kinddef-UnknownX=d,def,definitions

--regex-UnknownX=/([ \t]*)def +([a-zA-Z]):/\2/d/{{
\1 length 5 gt {
. _markplaceholder
} if
}}
4 changes: 4 additions & 0 deletions Units/optscript.r/op-markplaceholder.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a input.unknown /^def a:$/;" d
b input.unknown /^ def b:$/;" d
A input.unknown /^def A:$/;" d
B input.unknown /^ def B:$/;" d
6 changes: 6 additions & 0 deletions Units/optscript.r/op-markplaceholder.d/input.unknown
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def a:
def b:
def c:
def A:
def B:
def C:
12 changes: 12 additions & 0 deletions Units/optscript.r/op-tagloc.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--langdef=FOO
--map-FOO=.foo
--kinddef-FOO=d,def,definitions
--_extradef-FOO=withprefix,name with prefix
--extras-FOO=+{withprefix}
--fields=+{extras}
--regex-FOO=/def +([a-zA-Z]+)/\1/d/{{
mark (<prefix>) . :name _buildstring
. :kind
. _tagloc _tag _commit
/FOO.withprefix _markextra
}}
4 changes: 4 additions & 0 deletions Units/optscript.r/op-tagloc.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<prefix>x input.foo /^def x$/;" d extras:withprefix
<prefix>y input.foo /^def y$/;" d extras:withprefix
x input.foo /^def x$/;" d
y input.foo /^def y$/;" d
2 changes: 2 additions & 0 deletions Units/optscript.r/op-tagloc.d/input.foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def x
def y
30 changes: 29 additions & 1 deletion Units/optscript.r/op-typeref.d/args.ctags
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
--langdef=X
--map-X=.unknown
--kinddef-X=d,def,definitions
--kinddef-X=t,type,type definitions

--_prelude-X={{
/typedict 5 dict def
}}

--regex-X=/^type[ ]+([A-Z]+)$/\1/t/{{
typedict \1 cvn . put
}}

# [string string]
--regex-X=/def[ ]+([a-z]+)[ ]*:[ ]*([a-z]+)/\1/d/{{
. [ (typename) \2 ] typeref:
. [ (postfix) \2 ] typeref:
}}

# string
--regex-X=/def[ ]+<([a-z]+)>[ ]*([a-z]+)/\2/d/{{
. \1 typeref:
}}

# index
--regex-X=/def[ ]+([A-Z]+)\^([a-z]+)/\2/d/{{
typedict \1 cvn known {
. typedict \1 cvn get typeref:
} if
}}

# false
--regex-X=/def[ ]+([a-z]+)\^!([a-z]+)/\2/d/{{
. \1 typeref:
. false typeref:
}}
Loading

0 comments on commit 2b88b80

Please sign in to comment.