-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
main: provide the way to specify data taype in --_fielddef option #4178
Merged
masatake
merged 4 commits into
universal-ctags:master
from
masatake:main--datatype-in-fielddef
Jan 21, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5abf279
optlib2c: fix a typo
masatake a3a4501
main,Tmain,doc: use term 'parser specific' instead of 'parser own'
masatake f8f152f
main: allow to specify data type for a parser specific field from CLI
masatake 1461664
optlib2c: support datatype flag in --_fielddef option
masatake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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 @@ | ||
0 |
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,22 @@ | ||
# Copyright: 2023 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
CTAGS=$1 | ||
|
||
${CTAGS} --quiet --options=NONE --langdef=FIELDTEST \ | ||
--_fielddef-FIELDTEST=strfield,"a field having string value"'{datatype=str}' \ | ||
--_fielddef-FIELDTEST=boolfield,"a field having boolean value"'{datatype=bool}' \ | ||
--_fielddef-FIELDTEST=intfield,"a field having integer value"'{datatype=int}' \ | ||
--_fielddef-FIELDTEST=strboolfield,"a field having string value or false"'{datatype=str+bool}' \ | ||
--_fielddef-FIELDTEST=deffield,"a field that type is not specified" \ | ||
--list-fields=FIELDTEST && \ | ||
! ${CTAGS} --quiet --options=NONE --langdef=FIELDTEST \ | ||
--_fielddef-FIELDTEST=fooA,"unexpected data type"'{datatype=bar}' && | ||
! ${CTAGS} --quiet --options=NONE --langdef=FIELDTEST \ | ||
--_fielddef-FIELDTEST=fooB,"unexpected data type"'{datatype=int+baz}' && | ||
! ${CTAGS} --quiet --options=NONE --langdef=FIELDTEST \ | ||
--_fielddef-FIELDTEST=fooC,"unexpected data type"'{datatype=}' && | ||
! ${CTAGS} --quiet --options=NONE --langdef=FIELDTEST \ | ||
--_fielddef-FIELDTEST=fooD,"unexpected data type"'{datatype=+baz}' && | ||
! ${CTAGS} --quiet --options=NONE --langdef=FIELDTEST \ | ||
--_fielddef-FIELDTEST=fooE,"unexpected data type"'{datatype=bool+str}' |
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 @@ | ||
ctags: unknown datatype for field "fooA": "bar" | ||
ctags: unknown datatype for field "fooB": "int+baz" | ||
ctags: no datatype given for field: "fooC" | ||
ctags: unknown datatype for field "fooD": "+baz" | ||
ctags: unknown datatype for field "fooE": "bool+str" |
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,6 @@ | ||
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION | ||
- boolfield no FIELDTEST --b no -- a field having boolean value | ||
- deffield no FIELDTEST s-- no -- a field that type is not specified | ||
- intfield no FIELDTEST -i- no -- a field having integer value | ||
- strboolfield no FIELDTEST s-b no -- a field having string value or false | ||
- strfield no FIELDTEST s-- no -- a field having string value |
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 @@ | ||
0 |
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,7 @@ | ||
#!/bin/sh | ||
# Copyright: 2023 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
CTAGS=$1 | ||
|
||
${CTAGS} --quiet --options=NONE --_list-fielddef-flags |
File renamed without changes.
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,2 @@ | ||
#LETTER NAME DESCRIPTION | ||
- datatype=TYPE acceaptable datatype of the field ([str]|bool|int|str+bool) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ | ||
0 |
17 changes: 17 additions & 0 deletions
17
Tmain/parser-specific-fields-with-datatype.d/input.testlang
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,17 @@ | ||
str:s0 | ||
str:s1 | ||
str:s2 | ||
|
||
int:i0 | ||
int:i1 | ||
int:i2 | ||
int:i3 | ||
int:i4 | ||
|
||
bool:b0 | ||
bool:b1 | ||
bool:b2 | ||
|
||
strbool:sb0 | ||
strbool:sb1 | ||
strbool:sb2 |
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,8 @@ | ||
# Copyright: 2025 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
CTAGS=$1 | ||
|
||
${CTAGS} --quiet --options=NONE --options=testlang.ctags -o - \ | ||
--output-format=u-ctags \ | ||
input.testlang |
Empty file.
14 changes: 14 additions & 0 deletions
14
Tmain/parser-specific-fields-with-datatype.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,14 @@ | ||
s0 input.testlang /^str:s0$/;" o str:string | ||
s1 input.testlang /^str:s1$/;" o str: | ||
s2 input.testlang /^str:s2$/;" o | ||
i0 input.testlang /^int:i0$/;" o int:10 | ||
i1 input.testlang /^int:i1$/;" o int:-1 | ||
i2 input.testlang /^int:i2$/;" o int:1 | ||
i3 input.testlang /^int:i3$/;" o int:0 | ||
i4 input.testlang /^int:i4$/;" o | ||
b0 input.testlang /^bool:b0$/;" o bool: | ||
b1 input.testlang /^bool:b1$/;" o bool: | ||
b2 input.testlang /^bool:b2$/;" o | ||
sb0 input.testlang /^strbool:sb0$/;" o strbool:abc | ||
sb1 input.testlang /^strbool:sb1$/;" o strbool: | ||
sb2 input.testlang /^strbool:sb2$/;" o |
33 changes: 33 additions & 0 deletions
33
Tmain/parser-specific-fields-with-datatype.d/testlang.ctags
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,33 @@ | ||
--sort=no | ||
|
||
--langdef=Testlang | ||
--map-Testlang=+.testlang | ||
|
||
--kinddef-Testlang=o,object,objects | ||
|
||
--_fielddef-Testlang=str,String{datatype=str} | ||
--fields-Testlang=+{str} | ||
--_fielddef-Testlang=int,Integer{datatype=int} | ||
--fields-Testlang=+{int} | ||
--_fielddef-Testlang=bool,Boolean{datatype=bool} | ||
--fields-Testlang=+{bool} | ||
--_fielddef-Testlang=strbool,String or Boolean{datatype=str+bool} | ||
--fields-Testlang=+{strbool} | ||
|
||
--regex-Testlang=/^str:(s0)/\1/o/{_field=str:string} | ||
--regex-Testlang=/^str:(s1)/\1/o/{_field=str:} | ||
--regex-Testlang=/^str:(s2)/\1/o/ | ||
|
||
--regex-Testlang=/^int:(i0)/\1/o/{_field=int:10} | ||
--regex-Testlang=/^int:(i1)/\1/o/{_field=int:-1} | ||
--regex-Testlang=/^int:(i2)/\1/o/{_field=int:abc} | ||
--regex-Testlang=/^int:(i3)/\1/o/{_field=int:} | ||
--regex-Testlang=/^int:(i4)/\1/o/ | ||
|
||
--regex-Testlang=/^bool:(b0)/\1/o/{_field=bool:abc} | ||
--regex-Testlang=/^bool:(b1)/\1/o/{_field=bool:} | ||
--regex-Testlang=/^bool:(b2)/\1/o/ | ||
|
||
--regex-Testlang=/^strbool:(sb0)/\1/o/{_field=strbool:abc} | ||
--regex-Testlang=/^strbool:(sb1)/\1/o/{_field=strbool:} | ||
--regex-Testlang=/^strbool:(sb2)/\1/o/ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool+str should be rejected.