|
| 1 | +//===----------------------------------------------------------------------===// |
| 2 | +// |
| 3 | +// This source file is part of the Swift.org open source project |
| 4 | +// |
| 5 | +// Copyright (c) 2025 Apple Inc. and the Swift project authors |
| 6 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +// |
| 8 | +// See https://swift.org/LICENSE.txt for license information |
| 9 | +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
| 13 | +public let COMPILER_NODES: [Node] = [ |
| 14 | + Node( |
| 15 | + kind: .availabilityMacroDefinitionFile, |
| 16 | + base: .syntax, |
| 17 | + spi: "Compiler", |
| 18 | + nameForDiagnostics: "availability macro definition", |
| 19 | + documentation: """ |
| 20 | + Syntax for '-define-availability' compiler arguments, never appear in Swift source code. |
| 21 | + """, |
| 22 | + parserFunction: "parseAvailabilityMacroDefinitionFile", |
| 23 | + children: [ |
| 24 | + Child( |
| 25 | + name: "platformVersion", |
| 26 | + kind: .node(kind: .platformVersion) |
| 27 | + ), |
| 28 | + Child( |
| 29 | + name: "colon", |
| 30 | + kind: .token(choices: [.token(.colon)]) |
| 31 | + ), |
| 32 | + Child( |
| 33 | + name: "specs", |
| 34 | + kind: .collection(kind: .availabilityArgumentList) |
| 35 | + ), |
| 36 | + Child( |
| 37 | + name: "endOfFileToken", |
| 38 | + kind: .token(choices: [.token(.endOfFile)]) |
| 39 | + ), |
| 40 | + ] |
| 41 | + ), |
| 42 | + |
| 43 | + Node( |
| 44 | + kind: .accessorBlockFile, |
| 45 | + base: .syntax, |
| 46 | + spi: "Compiler", |
| 47 | + nameForDiagnostics: "accessors", |
| 48 | + documentation: """ |
| 49 | + Syntax for 'accessor' macro expansion, never appear in Swift source code. |
| 50 | + """, |
| 51 | + parserFunction: "parseAccessorBlockFile", |
| 52 | + children: [ |
| 53 | + Child( |
| 54 | + name: "leftBrace", |
| 55 | + kind: .token(choices: [.token(.leftBrace)]), |
| 56 | + isOptional: true |
| 57 | + ), |
| 58 | + Child( |
| 59 | + name: "accessors", |
| 60 | + kind: .collection(kind: .accessorDeclList) |
| 61 | + ), |
| 62 | + Child( |
| 63 | + name: "rightBrace", |
| 64 | + kind: .token(choices: [.token(.rightBrace)]), |
| 65 | + isOptional: true |
| 66 | + ), |
| 67 | + Child( |
| 68 | + name: "endOfFileToken", |
| 69 | + kind: .token(choices: [.token(.endOfFile)]) |
| 70 | + ), |
| 71 | + ] |
| 72 | + ), |
| 73 | + |
| 74 | + Node( |
| 75 | + kind: .attributeClauseFile, |
| 76 | + base: .syntax, |
| 77 | + spi: "Compiler", |
| 78 | + nameForDiagnostics: "attribute list", |
| 79 | + documentation: """ |
| 80 | + Syntax for 'memberAttribute' macro expansion or 'swift_attr' attribute in Clang, never appear in Swift source code. |
| 81 | + """, |
| 82 | + parserFunction: "parseAttributeClauseFile", |
| 83 | + traits: [ |
| 84 | + "WithAttributes", |
| 85 | + "WithModifiers", |
| 86 | + ], |
| 87 | + children: [ |
| 88 | + Child( |
| 89 | + name: "attributes", |
| 90 | + kind: .collection( |
| 91 | + kind: .attributeList, |
| 92 | + collectionElementName: "Attribute" |
| 93 | + ) |
| 94 | + ), |
| 95 | + Child( |
| 96 | + name: "modifiers", |
| 97 | + kind: .collection(kind: .declModifierList) |
| 98 | + ), |
| 99 | + Child( |
| 100 | + name: "endOfFileToken", |
| 101 | + kind: .token(choices: [.token(.endOfFile)]) |
| 102 | + ), |
| 103 | + ] |
| 104 | + ), |
| 105 | + |
| 106 | + Node( |
| 107 | + kind: .codeBlockFile, |
| 108 | + base: .syntax, |
| 109 | + spi: "Compiler", |
| 110 | + nameForDiagnostics: "code block", |
| 111 | + documentation: """ |
| 112 | + Syntax for 'body' macro expansions, never appear in Swift source code. |
| 113 | + """, |
| 114 | + parserFunction: "parseCodeBlockFile", |
| 115 | + children: [ |
| 116 | + Child( |
| 117 | + name: "body", |
| 118 | + kind: .node(kind: .codeBlock) |
| 119 | + ), |
| 120 | + Child( |
| 121 | + name: "endOfFileToken", |
| 122 | + kind: .token(choices: [.token(.endOfFile)]) |
| 123 | + ), |
| 124 | + ] |
| 125 | + ), |
| 126 | + |
| 127 | + Node( |
| 128 | + kind: .memberBlockItemListFile, |
| 129 | + base: .syntax, |
| 130 | + spi: "Compiler", |
| 131 | + nameForDiagnostics: "member list", |
| 132 | + documentation: """ |
| 133 | + Syntax for declaration macro expansions in type contexts, never appear in Swift source code. |
| 134 | + """, |
| 135 | + parserFunction: "parseMemberBlockItemListFile", |
| 136 | + children: [ |
| 137 | + Child( |
| 138 | + name: "members", |
| 139 | + kind: .collection(kind: .memberBlockItemList) |
| 140 | + ), |
| 141 | + Child( |
| 142 | + name: "endOfFileToken", |
| 143 | + kind: .token(choices: [.token(.endOfFile)]) |
| 144 | + ), |
| 145 | + ] |
| 146 | + ), |
| 147 | +] |
0 commit comments