Last active
February 18, 2023 23:46
-
-
Save conartist6/fa679c9dc118bd7723f0f4c1d55b83da to your computer and use it in GitHub Desktop.
https://github.com/js-cst-tokens/cst-tokens comment attachment example
This file contains hidden or 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
function /*1*/ foo /*2*/ (/*3*/) /*4*/ {/*5*/} /*6*/ |
This file contains hidden or 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
{ | |
"type": "CSTFragment", | |
"cstTokens": [ | |
{ "type": "Reference", "value": "fragment" }, | |
{ "type": "Literal", "value": " " }, | |
{ "type": "CommentStart", "value": "/*" }, | |
{ "type": "Literal", "value": "6" }, | |
{ "type": "CommentEnd", "value": "*/" } | |
], | |
"fragment": { | |
"type": "Program", | |
"cstTokens": [ | |
{ "type": "Reference", "value": "body" } | |
], | |
"sourceType": "module", | |
"body": [ | |
{ | |
"type": "FunctionDeclaration", | |
"cstTokens": [ | |
{ "type": "Keyword", "value": "function" }, | |
{ "type": "Literal", "value": " " }, | |
{ "type": "CommentStart", "value": "/*" }, | |
{ "type": "Literal", "value": "1" }, | |
{ "type": "CommentEnd", "value": "*/" }, | |
{ "type": "Literal", "value": " " }, | |
{ "type": "Reference", "value": "id" }, | |
{ "type": "Literal", "value": " " }, | |
{ "type": "CommentStart", "value": "/*" }, | |
{ "type": "Literal", "value": "2" }, | |
{ "type": "CommentEnd", "value": "*/" }, | |
{ "type": "Literal", "value": " " }, | |
{ "type": "LeftPunctuator", "value": "(" }, | |
{ "type": "CommentStart", "value": "/*" }, | |
{ "type": "Literal", "value": "3" }, | |
{ "type": "CommentEnd", "value": "*/" }, | |
{ "type": "RightPunctuator", "value": ")" }, | |
{ "type": "CommentStart", "value": "/*" }, | |
{ "type": "Literal", "value": "4" }, | |
{ "type": "CommentEnd", "value": "*/" }, | |
{ "type": "Literal", "value": " " }, | |
{ "type": "Reference", "value": "body" } | |
], | |
"id": { | |
"type": "Identifier", | |
"cstTokens": [ | |
{ "type": "SymbolDefinition", "value": "foo" } | |
], | |
"name": "foo" | |
}, | |
"params": [], | |
"body": { | |
"type": "BlockStatement", | |
"cstTokens": [ | |
{ "type": "LeftPunctuator", "value": "{" }, | |
{ "type": "CommentStart", "value": "/*" }, | |
{ "type": "Literal", "value": "5" }, | |
{ "type": "CommentEnd", "value": "*/" }, | |
{ "type": "RightPunctuator", "value": "}" } | |
], | |
"body": [] | |
}, | |
"async": false, | |
"generator": false | |
} | |
] | |
} | |
} |
This file contains hidden or 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
function /*1*/ foo /*2*/ (/*3*/) /*4*/ {/*5*/} /*6*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment