diff --git a/Tmain/json-output-typed-fields.d/stdout-expected.txt b/Tmain/json-output-typed-fields.d/stdout-expected.txt index 2a6729e654..4d27befc89 100644 --- a/Tmain/json-output-typed-fields.d/stdout-expected.txt +++ b/Tmain/json-output-typed-fields.d/stdout-expected.txt @@ -3,6 +3,8 @@ {"_type": "tag", "name": "ctag", "path": "input.ctst", "pattern": "/^f$/", "kind": "fieldMaker", "bField": true} {"_type": "tag", "name": "dtag", "path": "input.ctst", "pattern": "/^f$/", "kind": "fieldMaker", "sbField": "val"} {"_type": "tag", "name": "etag", "path": "input.ctst", "pattern": "/^f$/", "kind": "fieldMaker", "sbField": false} +{"_type": "tag", "name": "ftag", "path": "input.ctst", "pattern": "/^f$/", "kind": "fieldMaker", "sField": "val"} +{"_type": "tag", "name": "gtag", "path": "input.ctst", "pattern": "/^f$/", "kind": "fieldMaker", "sField": ""} {"_type": "tag", "name": "TITLE", "path": "input.rst", "pattern": "/^TITLE$/", "kind": "title", "overline": true} {"_type": "tag", "name": "section", "path": "input.rst", "pattern": "/^section$/", "kind": "subtitle", "scope": "TITLE", "scopeKind": "title"} {"_type": "tag", "name": "global", "path": "input.c", "pattern": "/^int global;$/", "typeref": "typename:int", "kind": "variable"} diff --git a/Tmain/xref-output-typed-fields.d/run.sh b/Tmain/xref-output-typed-fields.d/run.sh index 7a1d32aebf..a10553347f 100644 --- a/Tmain/xref-output-typed-fields.d/run.sh +++ b/Tmain/xref-output-typed-fields.d/run.sh @@ -5,7 +5,7 @@ CTAGS=$1 echo '# input.ctst' ${CTAGS} --quiet --options=NONE -o - \ - --output-format=xref --_xformat='%{name} -> b=%{CTagsSelfTest.bField},sb=%{CTagsSelfTest.sbField}' \ + --output-format=xref --_xformat='%{name} -> b=%{CTagsSelfTest.bField},sb=%{CTagsSelfTest.sbField},s=%{CTagsSelfTest.sField}' \ --language-force=CTagsSelfTest input.ctst echo '# input.rst' diff --git a/Tmain/xref-output-typed-fields.d/stdout-expected.txt b/Tmain/xref-output-typed-fields.d/stdout-expected.txt index 51061a8a43..e059c8bd5b 100644 --- a/Tmain/xref-output-typed-fields.d/stdout-expected.txt +++ b/Tmain/xref-output-typed-fields.d/stdout-expected.txt @@ -1,9 +1,11 @@ # input.ctst -atag -> b=-,sb= -btag -> b=bField,sb= -ctag -> b=bField,sb= -dtag -> b=-,sb=val -etag -> b=-,sb=- +atag -> b=-,sb=,s= +btag -> b=bField,sb=,s= +ctag -> b=bField,sb=,s= +dtag -> b=-,sb=val,s= +etag -> b=-,sb=-,s= +ftag -> b=-,sb=,s=val +gtag -> b=-,sb=,s= # input.rst TITLE -> overline section -> - diff --git a/main/parse.c b/main/parse.c index 80a918b209..2bc4cec7e6 100644 --- a/main/parse.c +++ b/main/parse.c @@ -5640,6 +5640,7 @@ static kindDefinition CTST_Kinds[KIND_COUNT] = { typedef enum { F_BOOLEAN_FIELD, F_BOOLEAN_AND_STRING_FIELD, + F_STRING_FIELD, COUNT_FIELD } CTSTField; @@ -5654,6 +5655,11 @@ static fieldDefinition CTSTFields[COUNT_FIELD] = { .dataType = FIELDTYPE_STRING|FIELDTYPE_BOOL, .enabled = true, }, + { .name = "sField", + .description = "field for testing string type", + .dataType = FIELDTYPE_STRING, + .enabled = true, + }, }; static void createCTSTTags (void) @@ -5825,6 +5831,18 @@ static void createCTSTTags (void) CTSTFields[F_BOOLEAN_AND_STRING_FIELD].ftype, ""); makeTagEntry (&e); + name [0] = c++; + initTagEntry (&e, name, i); + attachParserField (&e, + CTSTFields[F_STRING_FIELD].ftype, "val"); + makeTagEntry (&e); + + name [0] = c++; + initTagEntry (&e, name, i); + attachParserField (&e, + CTSTFields[F_STRING_FIELD].ftype, ""); + makeTagEntry (&e); + break; } case K_TRIGGER_NOTICE: