Skip to content

Commit ff4d890

Browse files
committed
Generate gyb
1 parent a35765d commit ff4d890

File tree

20 files changed

+5641
-5365
lines changed

20 files changed

+5641
-5365
lines changed

CodeGeneration/Sources/SyntaxSupport/gyb_generated/ExprNodes.swift

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,167 @@ public let EXPR_NODES: [Node] = [
505505
])
506506
]),
507507

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

511-
Node(name: "IfStmt",
512-
nameForDiagnostics: "'if' statement",
513-
kind: "Stmt",
514-
traits: [
515-
"WithCodeBlock"
516-
],
517-
children: [
518-
Child(name: "IfKeyword",
519-
kind: "KeywordToken",
520-
tokenChoices: [
521-
"Keyword"
522-
],
523-
textChoices: [
524-
"if"
525-
]),
526-
Child(name: "Conditions",
527-
kind: "ConditionElementList",
528-
collectionElementName: "Condition"),
529-
Child(name: "Body",
530-
kind: "CodeBlock"),
531-
Child(name: "ElseKeyword",
532-
kind: "ElseToken",
533-
isOptional: true),
534-
Child(name: "ElseBody",
535-
kind: "Syntax",
536-
isOptional: true,
537-
nodeChoices: [
538-
Child(name: "IfStmt",
539-
kind: "IfStmt"),
540-
Child(name: "CodeBlock",
541-
kind: "CodeBlock")
542-
])
543-
]),
544-
545-
Node(name: "SwitchCase",
546-
nameForDiagnostics: "switch case",
547-
kind: "Syntax",
548-
traits: [
549-
"WithStatements"
550-
],
551-
parserFunction: "parseSwitchCase",
552-
children: [
553-
Child(name: "UnknownAttr",
554-
kind: "Attribute",
555-
isOptional: true),
556-
Child(name: "Label",
557-
kind: "Syntax",
558-
nodeChoices: [
559-
Child(name: "Default",
560-
kind: "SwitchDefaultLabel"),
561-
Child(name: "Case",
562-
kind: "SwitchCaseLabel")
563-
]),
564-
Child(name: "Statements",
565-
kind: "CodeBlockItemList",
566-
collectionElementName: "Statement",
567-
isIndented: true)
568-
]),
569-
570-
Node(name: "SwitchDefaultLabel",
571-
nameForDiagnostics: nil,
572-
kind: "Syntax",
573-
children: [
574-
Child(name: "DefaultKeyword",
575-
kind: "KeywordToken",
576-
tokenChoices: [
577-
"Keyword"
578-
],
579-
textChoices: [
580-
"default"
581-
]),
582-
Child(name: "Colon",
583-
kind: "ColonToken",
584-
tokenChoices: [
585-
"Colon"
586-
])
587-
]),
588-
589-
Node(name: "CaseItem",
590-
nameForDiagnostics: nil,
591-
kind: "Syntax",
592-
traits: [
593-
"WithTrailingComma"
594-
],
595-
children: [
596-
Child(name: "Pattern",
597-
kind: "Pattern"),
598-
Child(name: "WhereClause",
599-
kind: "WhereClause",
600-
isOptional: true),
601-
Child(name: "TrailingComma",
602-
kind: "CommaToken",
603-
isOptional: true,
604-
tokenChoices: [
605-
"Comma"
606-
])
607-
]),
608-
609478
Node(name: "CatchItem",
610479
nameForDiagnostics: nil,
611480
kind: "Syntax",
@@ -627,28 +496,6 @@ public let STMT_NODES: [Node] = [
627496
])
628497
]),
629498

630-
Node(name: "SwitchCaseLabel",
631-
nameForDiagnostics: nil,
632-
kind: "Syntax",
633-
children: [
634-
Child(name: "CaseKeyword",
635-
kind: "KeywordToken",
636-
tokenChoices: [
637-
"Keyword"
638-
],
639-
textChoices: [
640-
"case"
641-
]),
642-
Child(name: "CaseItems",
643-
kind: "CaseItemList",
644-
collectionElementName: "CaseItem"),
645-
Child(name: "Colon",
646-
kind: "ColonToken",
647-
tokenChoices: [
648-
"Colon"
649-
])
650-
]),
651-
652499
Node(name: "CatchClause",
653500
nameForDiagnostics: "'catch' clause",
654501
kind: "Syntax",

Sources/SwiftBasicFormat/generated/BasicFormat.swift

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

0 commit comments

Comments
 (0)