Skip to content

Commit 8c886c8

Browse files
committed
Generate gyb
1 parent 8c05489 commit 8c886c8

File tree

22 files changed

+13063
-12751
lines changed

22 files changed

+13063
-12751
lines changed

CodeGeneration/Sources/SyntaxSupport/gyb_generated/ExprNodes.swift

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,167 @@ public let EXPR_NODES: [Node] = [
514514
])
515515
]),
516516

517+
Node(name: "IfExpr",
518+
nameForDiagnostics: "'if' statement",
519+
kind: "Expr",
520+
traits: [
521+
"WithCodeBlock"
522+
],
523+
children: [
524+
Child(name: "IfKeyword",
525+
kind: "KeywordToken",
526+
tokenChoices: [
527+
"Keyword"
528+
],
529+
textChoices: [
530+
"if"
531+
]),
532+
Child(name: "Conditions",
533+
kind: "ConditionElementList",
534+
collectionElementName: "Condition"),
535+
Child(name: "Body",
536+
kind: "CodeBlock"),
537+
Child(name: "ElseKeyword",
538+
kind: "ElseToken",
539+
isOptional: true),
540+
Child(name: "ElseBody",
541+
kind: "Syntax",
542+
isOptional: true,
543+
nodeChoices: [
544+
Child(name: "IfExpr",
545+
kind: "IfExpr"),
546+
Child(name: "CodeBlock",
547+
kind: "CodeBlock")
548+
])
549+
]),
550+
551+
Node(name: "SwitchExpr",
552+
nameForDiagnostics: "'switch' statement",
553+
kind: "Expr",
554+
traits: [
555+
"Braced"
556+
],
557+
children: [
558+
Child(name: "SwitchKeyword",
559+
kind: "KeywordToken",
560+
tokenChoices: [
561+
"Keyword"
562+
],
563+
textChoices: [
564+
"switch"
565+
]),
566+
Child(name: "Expression",
567+
kind: "Expr"),
568+
Child(name: "LeftBrace",
569+
kind: "LeftBraceToken",
570+
tokenChoices: [
571+
"LeftBrace"
572+
]),
573+
Child(name: "Cases",
574+
kind: "SwitchCaseList",
575+
collectionElementName: "Case"),
576+
Child(name: "RightBrace",
577+
kind: "RightBraceToken",
578+
tokenChoices: [
579+
"RightBrace"
580+
],
581+
requiresLeadingNewline: true)
582+
]),
583+
584+
Node(name: "SwitchCaseList",
585+
nameForDiagnostics: nil,
586+
kind: "SyntaxCollection",
587+
element: "Syntax",
588+
elementName: "SwitchCase",
589+
elementChoices: ["SwitchCase", "IfConfigDecl"],
590+
elementsSeparatedByNewline: true),
591+
592+
Node(name: "SwitchCase",
593+
nameForDiagnostics: "switch case",
594+
kind: "Syntax",
595+
traits: [
596+
"WithStatements"
597+
],
598+
parserFunction: "parseSwitchCase",
599+
children: [
600+
Child(name: "UnknownAttr",
601+
kind: "Attribute",
602+
isOptional: true),
603+
Child(name: "Label",
604+
kind: "Syntax",
605+
nodeChoices: [
606+
Child(name: "Default",
607+
kind: "SwitchDefaultLabel"),
608+
Child(name: "Case",
609+
kind: "SwitchCaseLabel")
610+
]),
611+
Child(name: "Statements",
612+
kind: "CodeBlockItemList",
613+
collectionElementName: "Statement",
614+
isIndented: true)
615+
]),
616+
617+
Node(name: "SwitchCaseLabel",
618+
nameForDiagnostics: nil,
619+
kind: "Syntax",
620+
children: [
621+
Child(name: "CaseKeyword",
622+
kind: "KeywordToken",
623+
tokenChoices: [
624+
"Keyword"
625+
],
626+
textChoices: [
627+
"case"
628+
]),
629+
Child(name: "CaseItems",
630+
kind: "CaseItemList",
631+
collectionElementName: "CaseItem"),
632+
Child(name: "Colon",
633+
kind: "ColonToken",
634+
tokenChoices: [
635+
"Colon"
636+
])
637+
]),
638+
639+
Node(name: "SwitchDefaultLabel",
640+
nameForDiagnostics: nil,
641+
kind: "Syntax",
642+
children: [
643+
Child(name: "DefaultKeyword",
644+
kind: "KeywordToken",
645+
tokenChoices: [
646+
"Keyword"
647+
],
648+
textChoices: [
649+
"default"
650+
]),
651+
Child(name: "Colon",
652+
kind: "ColonToken",
653+
tokenChoices: [
654+
"Colon"
655+
])
656+
]),
657+
658+
Node(name: "CaseItem",
659+
nameForDiagnostics: nil,
660+
kind: "Syntax",
661+
traits: [
662+
"WithTrailingComma"
663+
],
664+
children: [
665+
Child(name: "Pattern",
666+
kind: "Pattern"),
667+
Child(name: "WhereClause",
668+
kind: "WhereClause",
669+
isOptional: true),
670+
Child(name: "TrailingComma",
671+
kind: "CommaToken",
672+
isOptional: true,
673+
tokenChoices: [
674+
"Comma"
675+
])
676+
]),
677+
517678
Node(name: "UnresolvedTernaryExpr",
518679
nameForDiagnostics: nil,
519680
kind: "Expr",

CodeGeneration/Sources/SyntaxSupport/gyb_generated/StmtNodes.swift

Lines changed: 8 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ public let STMT_NODES: [Node] = [
3131
kind: "Stmt")
3232
]),
3333

34+
Node(name: "ExpressionStmt",
35+
nameForDiagnostics: "expression",
36+
kind: "Stmt",
37+
children: [
38+
Child(name: "Expression",
39+
kind: "Expr")
40+
]),
41+
3442
Node(name: "ContinueStmt",
3543
nameForDiagnostics: "'continue' statement",
3644
kind: "Stmt",
@@ -92,14 +100,6 @@ public let STMT_NODES: [Node] = [
92100
kind: "CodeBlock")
93101
]),
94102

95-
Node(name: "SwitchCaseList",
96-
nameForDiagnostics: nil,
97-
kind: "SyntaxCollection",
98-
element: "Syntax",
99-
elementName: "SwitchCase",
100-
elementChoices: ["SwitchCase", "IfConfigDecl"],
101-
elementsSeparatedByNewline: true),
102-
103103
Node(name: "RepeatWhileStmt",
104104
nameForDiagnostics: "'repeat' statement",
105105
kind: "Stmt",
@@ -228,39 +228,6 @@ public let STMT_NODES: [Node] = [
228228
kind: "CodeBlock")
229229
]),
230230

231-
Node(name: "SwitchStmt",
232-
nameForDiagnostics: "'switch' statement",
233-
kind: "Stmt",
234-
traits: [
235-
"Braced"
236-
],
237-
children: [
238-
Child(name: "SwitchKeyword",
239-
kind: "KeywordToken",
240-
tokenChoices: [
241-
"Keyword"
242-
],
243-
textChoices: [
244-
"switch"
245-
]),
246-
Child(name: "Expression",
247-
kind: "Expr"),
248-
Child(name: "LeftBrace",
249-
kind: "LeftBraceToken",
250-
tokenChoices: [
251-
"LeftBrace"
252-
]),
253-
Child(name: "Cases",
254-
kind: "SwitchCaseList",
255-
collectionElementName: "Case"),
256-
Child(name: "RightBrace",
257-
kind: "RightBraceToken",
258-
tokenChoices: [
259-
"RightBrace"
260-
],
261-
requiresLeadingNewline: true)
262-
]),
263-
264231
Node(name: "CatchClauseList",
265232
nameForDiagnostics: "'catch' clause",
266233
kind: "SyntaxCollection",
@@ -530,104 +497,6 @@ public let STMT_NODES: [Node] = [
530497
kind: "Expr")
531498
]),
532499

533-
Node(name: "IfStmt",
534-
nameForDiagnostics: "'if' statement",
535-
kind: "Stmt",
536-
traits: [
537-
"WithCodeBlock"
538-
],
539-
children: [
540-
Child(name: "IfKeyword",
541-
kind: "KeywordToken",
542-
tokenChoices: [
543-
"Keyword"
544-
],
545-
textChoices: [
546-
"if"
547-
]),
548-
Child(name: "Conditions",
549-
kind: "ConditionElementList",
550-
collectionElementName: "Condition"),
551-
Child(name: "Body",
552-
kind: "CodeBlock"),
553-
Child(name: "ElseKeyword",
554-
kind: "ElseToken",
555-
isOptional: true),
556-
Child(name: "ElseBody",
557-
kind: "Syntax",
558-
isOptional: true,
559-
nodeChoices: [
560-
Child(name: "IfStmt",
561-
kind: "IfStmt"),
562-
Child(name: "CodeBlock",
563-
kind: "CodeBlock")
564-
])
565-
]),
566-
567-
Node(name: "SwitchCase",
568-
nameForDiagnostics: "switch case",
569-
kind: "Syntax",
570-
traits: [
571-
"WithStatements"
572-
],
573-
parserFunction: "parseSwitchCase",
574-
children: [
575-
Child(name: "UnknownAttr",
576-
kind: "Attribute",
577-
isOptional: true),
578-
Child(name: "Label",
579-
kind: "Syntax",
580-
nodeChoices: [
581-
Child(name: "Default",
582-
kind: "SwitchDefaultLabel"),
583-
Child(name: "Case",
584-
kind: "SwitchCaseLabel")
585-
]),
586-
Child(name: "Statements",
587-
kind: "CodeBlockItemList",
588-
collectionElementName: "Statement",
589-
isIndented: true)
590-
]),
591-
592-
Node(name: "SwitchDefaultLabel",
593-
nameForDiagnostics: nil,
594-
kind: "Syntax",
595-
children: [
596-
Child(name: "DefaultKeyword",
597-
kind: "KeywordToken",
598-
tokenChoices: [
599-
"Keyword"
600-
],
601-
textChoices: [
602-
"default"
603-
]),
604-
Child(name: "Colon",
605-
kind: "ColonToken",
606-
tokenChoices: [
607-
"Colon"
608-
])
609-
]),
610-
611-
Node(name: "CaseItem",
612-
nameForDiagnostics: nil,
613-
kind: "Syntax",
614-
traits: [
615-
"WithTrailingComma"
616-
],
617-
children: [
618-
Child(name: "Pattern",
619-
kind: "Pattern"),
620-
Child(name: "WhereClause",
621-
kind: "WhereClause",
622-
isOptional: true),
623-
Child(name: "TrailingComma",
624-
kind: "CommaToken",
625-
isOptional: true,
626-
tokenChoices: [
627-
"Comma"
628-
])
629-
]),
630-
631500
Node(name: "CatchItem",
632501
nameForDiagnostics: nil,
633502
kind: "Syntax",
@@ -649,28 +518,6 @@ public let STMT_NODES: [Node] = [
649518
])
650519
]),
651520

652-
Node(name: "SwitchCaseLabel",
653-
nameForDiagnostics: nil,
654-
kind: "Syntax",
655-
children: [
656-
Child(name: "CaseKeyword",
657-
kind: "KeywordToken",
658-
tokenChoices: [
659-
"Keyword"
660-
],
661-
textChoices: [
662-
"case"
663-
]),
664-
Child(name: "CaseItems",
665-
kind: "CaseItemList",
666-
collectionElementName: "CaseItem"),
667-
Child(name: "Colon",
668-
kind: "ColonToken",
669-
tokenChoices: [
670-
"Colon"
671-
])
672-
]),
673-
674521
Node(name: "CatchClause",
675522
nameForDiagnostics: "'catch' clause",
676523
kind: "Syntax",

Sources/SwiftBasicFormat/generated/BasicFormat.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ open class BasicFormat: SyntaxRewriter {
113113
return true
114114
case \MemberDeclBlockSyntax.rightBrace:
115115
return true
116-
case \SwitchStmtSyntax.rightBrace:
116+
case \SwitchExprSyntax.rightBrace:
117117
return true
118118
default:
119119
return putNextTokenOnNewLine

0 commit comments

Comments
 (0)