-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main: consider foreign languages when solving the field type specifyi…
…ng _field regex flag The original code assumed the parser specified in a regex pattern was the owner of the field specified with the _field regex flag in the pattern. For an example, in the option --regex-Foo=/.../{_field=afield:\1}... , ctags assumed "afield" was a specific field of "Foo" parser. The original code didn't consider an option like --regex-Foo=/.../{_language=Bar}{_field=afield:\1}... In this case, ctags should consider "afield" as a specific field of "Bar" parser. NOTE: the language specified with _language flag must be declared with _foreignLanguage= in --langdef-Foo. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
- Loading branch information
Showing
11 changed files
with
60 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
public func foo(n, m); | ||
protected func bar(n); | ||
private func baz(n,...); | ||
X:tagme@iamowner | ||
Y:iamowner2=tagme2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--langdef=knownz | ||
--kinddef-knownz=m,mark,makers | ||
|
||
--_fielddef-knownz=owner,the owner of the markers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright: 2024 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
. ../utils.sh | ||
|
||
CTAGS=$1 | ||
|
||
V= | ||
# V=valgrind | ||
|
||
${V} ${CTAGS} --options=NONE --options=./knownz.ctags --options=./unknownx.ctags \ | ||
--fields=+l \ | ||
--fields-unknownx=+'{protection}{signature}' \ | ||
--fields-knownz=+'{owner}' \ | ||
-o - input.unknownx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ctags: Notice: No options will be read from files or environment |
5 changes: 5 additions & 0 deletions
5
Tmain/parser-own-fields-for-foreign-lang.d/stdout-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bar input.unknownx /^protected func bar(n);$/;" f language:unknownx protection:protected signature:(n) | ||
baz input.unknownx /^private func baz(n,...);$/;" f language:unknownx protection:private signature:(n,...) | ||
foo input.unknownx /^public func foo(n, m);$/;" f language:unknownx protection:public signature:(n, m) | ||
tagme input.unknownx /^X:tagme@iamowner$/;" m language:knownz owner:iamowner | ||
tagme2 input.unknownx /^Y:iamowner2=tagme2$/;" m language:knownz owner:iamowner2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--langdef=unknownx{_foreignLanguage=knownz} | ||
--kinddef-unknownx=f,func,functions | ||
--map-unknownx=+.unknownx | ||
|
||
--_fielddef-unknownx=protection,protections | ||
--_fielddef-unknownx=signature,signatures | ||
|
||
--regex-unknownx=/^((public|protected|private) +)?func ([^\(]+)\((.*)\)/\3/f/{_field=protection:\1}{_field=signature:(\4)} | ||
--regex-unknownx=/^X:([a-z]+)@([a-z]+)/\1/m/{_language=knownz}{_field=owner:\2} | ||
--regex-unknownx=/^Y:([a-z0-9]+)=([a-z0-9]+)/\2/m/{_field=owner:\1}{_language=knownz} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters