Files
swift-mirror/test/Syntax/Inputs/serialize_multiple_decls.json
Argyrios Kyrtzidis cbad3492e4 [Parse/Syntax] Simplify how the final SourceFileSyntax root is formed
Instead of creating multiple CodeBlockItemList nodes, that need to get merged and discarded later on, do this:

* Ensure for libSyntax parsing that we parse the whole file
* Create top-level CodeBlockItem nodes that we just directly wrap with a single CodeBlockItemList node at the end

The importance of this change will become more obvious later on when we'll decouple syntax parsing from the formation of libSyntax tree nodes.
2018-12-10 13:37:15 -08:00

224 lines
6.1 KiB
JSON

{
"id": 17,
"kind": "SourceFile",
"layout": [
{
"id": 16,
"kind": "CodeBlockItemList",
"layout": [
{
"id": 8,
"kind": "CodeBlockItem",
"layout": [
{
"id": 7,
"kind": "StructDecl",
"layout": [
null,
null,
{
"id": 1,
"tokenKind": {
"kind": "kw_struct"
},
"leadingTrivia": [
{
"kind": "LineComment",
"value": "\/\/ RUN: %swift-syntax-test -input-source-filename %s -serialize-raw-tree > %t"
},
{
"kind": "Newline",
"value": 1
},
{
"kind": "LineComment",
"value": "\/\/ RUN: diff %t %S\/Inputs\/serialize_multiple_decls.json -u"
},
{
"kind": "Newline",
"value": 2
}
],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
{
"id": 2,
"tokenKind": {
"kind": "identifier",
"text": "A"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
null,
null,
null,
{
"id": 6,
"kind": "MemberDeclBlock",
"layout": [
{
"id": 3,
"tokenKind": {
"kind": "l_brace"
},
"leadingTrivia": [],
"trailingTrivia": [],
"presence": "Present"
},
{
"id": 4,
"kind": "MemberDeclList",
"layout": [],
"presence": "Present"
},
{
"id": 5,
"tokenKind": {
"kind": "r_brace"
},
"leadingTrivia": [
{
"kind": "Newline",
"value": 1
}
],
"trailingTrivia": [],
"presence": "Present"
}
],
"presence": "Present"
}
],
"presence": "Present"
},
null,
null
],
"presence": "Present"
},
{
"id": 14,
"kind": "CodeBlockItem",
"layout": [
{
"id": 13,
"kind": "StructDecl",
"layout": [
null,
null,
{
"id": 9,
"tokenKind": {
"kind": "kw_struct"
},
"leadingTrivia": [
{
"kind": "Newline",
"value": 2
}
],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
{
"id": 10,
"tokenKind": {
"kind": "identifier",
"text": "B"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
null,
null,
null,
{
"id": 12,
"kind": "MemberDeclBlock",
"layout": [
{
"id": 3,
"tokenKind": {
"kind": "l_brace"
},
"leadingTrivia": [],
"trailingTrivia": [],
"presence": "Present"
},
{
"id": 11,
"kind": "MemberDeclList",
"layout": [],
"presence": "Present"
},
{
"id": 5,
"tokenKind": {
"kind": "r_brace"
},
"leadingTrivia": [
{
"kind": "Newline",
"value": 1
}
],
"trailingTrivia": [],
"presence": "Present"
}
],
"presence": "Present"
}
],
"presence": "Present"
},
null,
null
],
"presence": "Present"
}
],
"presence": "Present"
},
{
"id": 15,
"tokenKind": {
"kind": "eof",
"text": ""
},
"leadingTrivia": [
{
"kind": "Newline",
"value": 1
}
],
"trailingTrivia": [],
"presence": "Present"
}
],
"presence": "Present"
}