Files
swift-mirror/test/Syntax/Inputs/serialize_struct_decl.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

446 lines
20 KiB
JSON

{
"id": 39,
"kind": "SourceFile",
"layout": [
{
"id": 38,
"kind": "CodeBlockItemList",
"layout": [
{
"id": 36,
"kind": "CodeBlockItem",
"layout": [
{
"id": 35,
"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_struct_decl.json -u"
},
{
"kind": "Newline",
"value": 2
}
],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
{
"id": 2,
"tokenKind": {
"kind": "identifier",
"text": "Foo"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
null,
null,
null,
{
"id": 34,
"kind": "MemberDeclBlock",
"layout": [
{
"id": 3,
"tokenKind": {
"kind": "l_brace"
},
"leadingTrivia": [],
"trailingTrivia": [],
"presence": "Present"
},
{
"id": 32,
"kind": "MemberDeclList",
"layout": [
{
"id": 14,
"kind": "MemberDeclListItem",
"layout": [
{
"id": 13,
"kind": "VariableDecl",
"layout": [
null,
null,
{
"id": 4,
"tokenKind": {
"kind": "kw_let"
},
"leadingTrivia": [
{
"kind": "Newline",
"value": 1
},
{
"kind": "Space",
"value": 2
}
],
"trailingTrivia": [
{
"kind": "Space",
"value": 3
}
],
"presence": "Present"
},
{
"id": 12,
"kind": "PatternBindingList",
"layout": [
{
"id": 11,
"kind": "PatternBinding",
"layout": [
{
"id": 6,
"kind": "IdentifierPattern",
"layout": [
{
"id": 5,
"tokenKind": {
"kind": "identifier",
"text": "bar"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
}
],
"presence": "Present"
},
{
"id": 10,
"kind": "TypeAnnotation",
"layout": [
{
"id": 7,
"tokenKind": {
"kind": "colon"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
{
"id": 9,
"kind": "SimpleTypeIdentifier",
"layout": [
{
"id": 8,
"tokenKind": {
"kind": "identifier",
"text": "Int"
},
"leadingTrivia": [],
"trailingTrivia": [],
"presence": "Present"
},
null
],
"presence": "Present"
}
],
"presence": "Present"
},
null,
null,
null
],
"presence": "Present"
}
],
"presence": "Present"
}
],
"presence": "Present"
},
null
],
"presence": "Present"
},
{
"id": 31,
"kind": "MemberDeclListItem",
"layout": [
{
"id": 30,
"kind": "VariableDecl",
"layout": [
null,
null,
{
"id": 15,
"tokenKind": {
"kind": "kw_let"
},
"leadingTrivia": [
{
"kind": "Newline",
"value": 2
},
{
"kind": "Space",
"value": 2
}
],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
{
"id": 29,
"kind": "PatternBindingList",
"layout": [
{
"id": 28,
"kind": "PatternBinding",
"layout": [
{
"id": 17,
"kind": "IdentifierPattern",
"layout": [
{
"id": 16,
"tokenKind": {
"kind": "identifier",
"text": "baz"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
}
],
"presence": "Present"
},
{
"id": 27,
"kind": "TypeAnnotation",
"layout": [
{
"id": 7,
"tokenKind": {
"kind": "colon"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
{
"id": 26,
"kind": "SimpleTypeIdentifier",
"layout": [
{
"id": 18,
"tokenKind": {
"kind": "identifier",
"text": "Array"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
{
"id": 25,
"kind": "GenericArgumentClause",
"layout": [
{
"id": 19,
"tokenKind": {
"kind": "l_angle"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
{
"id": 23,
"kind": "GenericArgumentList",
"layout": [
{
"id": 22,
"kind": "GenericArgument",
"layout": [
{
"id": 21,
"kind": "SimpleTypeIdentifier",
"layout": [
{
"id": 20,
"tokenKind": {
"kind": "identifier",
"text": "Int"
},
"leadingTrivia": [],
"trailingTrivia": [
{
"kind": "Space",
"value": 1
}
],
"presence": "Present"
},
null
],
"presence": "Present"
},
null
],
"presence": "Present"
}
],
"presence": "Present"
},
{
"id": 24,
"tokenKind": {
"kind": "r_angle"
},
"leadingTrivia": [],
"trailingTrivia": [],
"presence": "Present"
}
],
"presence": "Present"
}
],
"presence": "Present"
}
],
"presence": "Present"
},
null,
null,
null
],
"presence": "Present"
}
],
"presence": "Present"
}
],
"presence": "Present"
},
null
],
"presence": "Present"
}
],
"presence": "Present"
},
{
"id": 33,
"tokenKind": {
"kind": "r_brace"
},
"leadingTrivia": [
{
"kind": "Newline",
"value": 1
},
{
"kind": "Space",
"value": 6
}
],
"trailingTrivia": [],
"presence": "Present"
}
],
"presence": "Present"
}
],
"presence": "Present"
},
null,
null
],
"presence": "Present"
}
],
"presence": "Present"
},
{
"id": 37,
"tokenKind": {
"kind": "eof",
"text": ""
},
"leadingTrivia": [
{
"kind": "Newline",
"value": 1
}
],
"trailingTrivia": [],
"presence": "Present"
}
],
"presence": "Present"
}