TypeScript/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json
Nathan Shively-Sanders d8c8e4ff06
Loosen author tag parsing (#41820)
* Loosen author tag parsing

Also make the code more efficient and easier to read.

1. Arbitrary text, except for newline and @, is allowed for the author name.
2. Arbirtrary text, except for newline, is allowed for the email
address.
3. Newline is treated as a match for an open <

I tried to allow newlines in the author and email, but it was ambiguous
with the end of the tag.

I also got rid of the two lookaheads and unified the trailing comment
handling.

Fixes #41804

* remove hardmode test since it did not reveal anything new
2020-12-08 13:25:03 -08:00

316 lines
No EOL
9.2 KiB
JSON

{
"kind": "JSDocComment",
"pos": 0,
"end": 738,
"flags": "JSDoc",
"modifierFlagsCache": 0,
"transformFlags": 0,
"tags": {
"0": {
"kind": "JSDocAuthorTag",
"pos": 7,
"end": 50,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 8,
"end": 14,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "John Doe <john.doe@example.com>"
},
"1": {
"kind": "JSDocAuthorTag",
"pos": 50,
"end": 112,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 51,
"end": 57,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "John Doe <john.doe@example.com> unexpected comment"
},
"2": {
"kind": "JSDocAuthorTag",
"pos": 112,
"end": 170,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 113,
"end": 119,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "108 <108@actionbutton.net> Video Games Forever"
},
"3": {
"kind": "JSDocAuthorTag",
"pos": 170,
"end": 227,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 171,
"end": 177,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Multiple Ats <email@quoting@how@does@it@work>"
},
"4": {
"kind": "JSDocAuthorTag",
"pos": 227,
"end": 272,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 228,
"end": 234,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Multiple Open Carets <hi<there@<>"
},
"5": {
"kind": "JSDocAuthorTag",
"pos": 272,
"end": 338,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 273,
"end": 279,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Multiple Close Carets <probably>invalid>but>who>cares>"
},
"6": {
"kind": "JSDocAuthorTag",
"pos": 338,
"end": 381,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 339,
"end": 345,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Unclosed Carets <joe@sloppy.gov"
},
"7": {
"kind": "JSDocAuthorTag",
"pos": 381,
"end": 398,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 382,
"end": 388,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Multiple "
},
"8": {
"kind": "JSDocAuthorTag",
"pos": 398,
"end": 429,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 399,
"end": 405,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "On One <one@two.three>"
},
"9": {
"kind": "JSDocAuthorTag",
"pos": 429,
"end": 445,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 430,
"end": 436,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Line"
},
"10": {
"kind": "JSDocAuthorTag",
"pos": 445,
"end": 453,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 446,
"end": 452,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
}
},
"11": {
"kind": "JSDocAuthorTag",
"pos": 453,
"end": 461,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 454,
"end": 460,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
}
},
"12": {
"kind": "JSDocAuthorTag",
"pos": 461,
"end": 486,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 462,
"end": 468,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Empty authors"
},
"13": {
"kind": "JSDocAuthorTag",
"pos": 486,
"end": 497,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 487,
"end": 493,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
}
},
"14": {
"kind": "JSDocAuthorTag",
"pos": 497,
"end": 522,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 498,
"end": 504,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Comments"
},
"15": {
"kind": "JSDocAuthorTag",
"pos": 522,
"end": 559,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 523,
"end": 529,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Early Close Caret > <a@b>"
},
"16": {
"kind": "JSDocAuthorTag",
"pos": 559,
"end": 598,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 560,
"end": 566,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "No Line Breaks:<the.email"
},
"17": {
"kind": "JSDocTag",
"pos": 598,
"end": 606,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 599,
"end": 606,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "address"
},
"comment": "> must be on the same line to parse"
},
"18": {
"kind": "JSDocAuthorTag",
"pos": 645,
"end": 736,
"modifierFlagsCache": 0,
"transformFlags": 0,
"tagName": {
"kind": "Identifier",
"pos": 646,
"end": 652,
"modifierFlagsCache": 0,
"transformFlags": 0,
"escapedText": "author"
},
"comment": "Long Comment <long@comment.org> I\nwant to keep commenting down here, I dunno."
},
"length": 19,
"pos": 7,
"end": 736,
"hasTrailingComma": false,
"transformFlags": 0
}
}