Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions CodeGeneration/Sources/SyntaxSupport/gyb_generated/ExprNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,167 @@ public let EXPR_NODES: [Node] = [
])
]),

Node(name: "IfExpr",
nameForDiagnostics: "'if' statement",
kind: "Expr",
traits: [
"WithCodeBlock"
],
children: [
Child(name: "IfKeyword",
kind: "KeywordToken",
tokenChoices: [
"Keyword"
],
textChoices: [
"if"
]),
Child(name: "Conditions",
kind: "ConditionElementList",
collectionElementName: "Condition"),
Child(name: "Body",
kind: "CodeBlock"),
Child(name: "ElseKeyword",
kind: "ElseToken",
isOptional: true),
Child(name: "ElseBody",
kind: "Syntax",
isOptional: true,
nodeChoices: [
Child(name: "IfExpr",
kind: "IfExpr"),
Child(name: "CodeBlock",
kind: "CodeBlock")
])
]),

Node(name: "SwitchExpr",
nameForDiagnostics: "'switch' statement",
kind: "Expr",
traits: [
"Braced"
],
children: [
Child(name: "SwitchKeyword",
kind: "KeywordToken",
tokenChoices: [
"Keyword"
],
textChoices: [
"switch"
]),
Child(name: "Expression",
kind: "Expr"),
Child(name: "LeftBrace",
kind: "LeftBraceToken",
tokenChoices: [
"LeftBrace"
]),
Child(name: "Cases",
kind: "SwitchCaseList",
collectionElementName: "Case"),
Child(name: "RightBrace",
kind: "RightBraceToken",
tokenChoices: [
"RightBrace"
],
requiresLeadingNewline: true)
]),

Node(name: "SwitchCaseList",
nameForDiagnostics: nil,
kind: "SyntaxCollection",
element: "Syntax",
elementName: "SwitchCase",
elementChoices: ["SwitchCase", "IfConfigDecl"],
elementsSeparatedByNewline: true),

Node(name: "SwitchCase",
nameForDiagnostics: "switch case",
kind: "Syntax",
traits: [
"WithStatements"
],
parserFunction: "parseSwitchCase",
children: [
Child(name: "UnknownAttr",
kind: "Attribute",
isOptional: true),
Child(name: "Label",
kind: "Syntax",
nodeChoices: [
Child(name: "Default",
kind: "SwitchDefaultLabel"),
Child(name: "Case",
kind: "SwitchCaseLabel")
]),
Child(name: "Statements",
kind: "CodeBlockItemList",
collectionElementName: "Statement",
isIndented: true)
]),

Node(name: "SwitchCaseLabel",
nameForDiagnostics: nil,
kind: "Syntax",
children: [
Child(name: "CaseKeyword",
kind: "KeywordToken",
tokenChoices: [
"Keyword"
],
textChoices: [
"case"
]),
Child(name: "CaseItems",
kind: "CaseItemList",
collectionElementName: "CaseItem"),
Child(name: "Colon",
kind: "ColonToken",
tokenChoices: [
"Colon"
])
]),

Node(name: "SwitchDefaultLabel",
nameForDiagnostics: nil,
kind: "Syntax",
children: [
Child(name: "DefaultKeyword",
kind: "KeywordToken",
tokenChoices: [
"Keyword"
],
textChoices: [
"default"
]),
Child(name: "Colon",
kind: "ColonToken",
tokenChoices: [
"Colon"
])
]),

Node(name: "CaseItem",
nameForDiagnostics: nil,
kind: "Syntax",
traits: [
"WithTrailingComma"
],
children: [
Child(name: "Pattern",
kind: "Pattern"),
Child(name: "WhereClause",
kind: "WhereClause",
isOptional: true),
Child(name: "TrailingComma",
kind: "CommaToken",
isOptional: true,
tokenChoices: [
"Comma"
])
]),

Node(name: "UnresolvedTernaryExpr",
nameForDiagnostics: nil,
kind: "Expr",
Expand Down
169 changes: 8 additions & 161 deletions CodeGeneration/Sources/SyntaxSupport/gyb_generated/StmtNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public let STMT_NODES: [Node] = [
kind: "Stmt")
]),

Node(name: "ExpressionStmt",
nameForDiagnostics: "expression",
kind: "Stmt",
children: [
Child(name: "Expression",
kind: "Expr")
]),

Node(name: "ContinueStmt",
nameForDiagnostics: "'continue' statement",
kind: "Stmt",
Expand Down Expand Up @@ -92,14 +100,6 @@ public let STMT_NODES: [Node] = [
kind: "CodeBlock")
]),

Node(name: "SwitchCaseList",
nameForDiagnostics: nil,
kind: "SyntaxCollection",
element: "Syntax",
elementName: "SwitchCase",
elementChoices: ["SwitchCase", "IfConfigDecl"],
elementsSeparatedByNewline: true),

Node(name: "RepeatWhileStmt",
nameForDiagnostics: "'repeat' statement",
kind: "Stmt",
Expand Down Expand Up @@ -228,39 +228,6 @@ public let STMT_NODES: [Node] = [
kind: "CodeBlock")
]),

Node(name: "SwitchStmt",
nameForDiagnostics: "'switch' statement",
kind: "Stmt",
traits: [
"Braced"
],
children: [
Child(name: "SwitchKeyword",
kind: "KeywordToken",
tokenChoices: [
"Keyword"
],
textChoices: [
"switch"
]),
Child(name: "Expression",
kind: "Expr"),
Child(name: "LeftBrace",
kind: "LeftBraceToken",
tokenChoices: [
"LeftBrace"
]),
Child(name: "Cases",
kind: "SwitchCaseList",
collectionElementName: "Case"),
Child(name: "RightBrace",
kind: "RightBraceToken",
tokenChoices: [
"RightBrace"
],
requiresLeadingNewline: true)
]),

Node(name: "CatchClauseList",
nameForDiagnostics: "'catch' clause",
kind: "SyntaxCollection",
Expand Down Expand Up @@ -530,104 +497,6 @@ public let STMT_NODES: [Node] = [
kind: "Expr")
]),

Node(name: "IfStmt",
nameForDiagnostics: "'if' statement",
kind: "Stmt",
traits: [
"WithCodeBlock"
],
children: [
Child(name: "IfKeyword",
kind: "KeywordToken",
tokenChoices: [
"Keyword"
],
textChoices: [
"if"
]),
Child(name: "Conditions",
kind: "ConditionElementList",
collectionElementName: "Condition"),
Child(name: "Body",
kind: "CodeBlock"),
Child(name: "ElseKeyword",
kind: "ElseToken",
isOptional: true),
Child(name: "ElseBody",
kind: "Syntax",
isOptional: true,
nodeChoices: [
Child(name: "IfStmt",
kind: "IfStmt"),
Child(name: "CodeBlock",
kind: "CodeBlock")
])
]),

Node(name: "SwitchCase",
nameForDiagnostics: "switch case",
kind: "Syntax",
traits: [
"WithStatements"
],
parserFunction: "parseSwitchCase",
children: [
Child(name: "UnknownAttr",
kind: "Attribute",
isOptional: true),
Child(name: "Label",
kind: "Syntax",
nodeChoices: [
Child(name: "Default",
kind: "SwitchDefaultLabel"),
Child(name: "Case",
kind: "SwitchCaseLabel")
]),
Child(name: "Statements",
kind: "CodeBlockItemList",
collectionElementName: "Statement",
isIndented: true)
]),

Node(name: "SwitchDefaultLabel",
nameForDiagnostics: nil,
kind: "Syntax",
children: [
Child(name: "DefaultKeyword",
kind: "KeywordToken",
tokenChoices: [
"Keyword"
],
textChoices: [
"default"
]),
Child(name: "Colon",
kind: "ColonToken",
tokenChoices: [
"Colon"
])
]),

Node(name: "CaseItem",
nameForDiagnostics: nil,
kind: "Syntax",
traits: [
"WithTrailingComma"
],
children: [
Child(name: "Pattern",
kind: "Pattern"),
Child(name: "WhereClause",
kind: "WhereClause",
isOptional: true),
Child(name: "TrailingComma",
kind: "CommaToken",
isOptional: true,
tokenChoices: [
"Comma"
])
]),

Node(name: "CatchItem",
nameForDiagnostics: nil,
kind: "Syntax",
Expand All @@ -649,28 +518,6 @@ public let STMT_NODES: [Node] = [
])
]),

Node(name: "SwitchCaseLabel",
nameForDiagnostics: nil,
kind: "Syntax",
children: [
Child(name: "CaseKeyword",
kind: "KeywordToken",
tokenChoices: [
"Keyword"
],
textChoices: [
"case"
]),
Child(name: "CaseItems",
kind: "CaseItemList",
collectionElementName: "CaseItem"),
Child(name: "Colon",
kind: "ColonToken",
tokenChoices: [
"Colon"
])
]),

Node(name: "CatchClause",
nameForDiagnostics: "'catch' clause",
kind: "Syntax",
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftBasicFormat/generated/BasicFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ open class BasicFormat: SyntaxRewriter {
return true
case \MemberDeclBlockSyntax.rightBrace:
return true
case \SwitchStmtSyntax.rightBrace:
case \SwitchExprSyntax.rightBrace:
return true
default:
return putNextTokenOnNewLine
Expand Down
Loading