Commit Graph

75 Commits

Author SHA1 Message Date
Brent Royal-Gordon
63ec1cf5af Introduce a separate #filePath, remove -pound-file
This makes the path behavior more first-class. The feature is now hidden behind an experimental flag, -enable-experimental-concise-pound-file.
2019-12-04 16:35:13 -08:00
Alex Hoppen
a2ed680457 [gyb_syntax_support] Add description for ExprListSyntax 2019-11-08 14:15:49 -08:00
Rintaro Ishizaki
66d19e6ea6 [Syntax] Accept '_' token as a label for tuple expression 2019-10-14 15:57:19 -07:00
Rintaro Ishizaki
e53ad15b10 Revert "Merge pull request #27508 from rintaro/syntaxparse-expridentifier"
This reverts commit dfe962f19a, reversing
changes made to 04ce7bf779.
2019-10-14 12:18:26 -07:00
Rintaro Ishizaki
0e8010d8b9 Revert "Merge pull request #27592 from rintaro/syntaxparse-exprtuple"
This reverts commit cdfd1ab2cf, reversing
changes made to eb02f20f99.
2019-10-14 12:15:48 -07:00
Rintaro Ishizaki
b56c543f0d Revert "Merge pull request #27607 from rintaro/syntaxparse-exprunresolvedmember"
This reverts commit 5e1f790b3b, reversing
changes made to 1846a5957e.
2019-10-14 12:15:12 -07:00
Rintaro Ishizaki
572cfe26a9 Revert "[SyntaxParse] Parse ObjC keypath expression syntax"
This reverts commit 1036d2a2bf.
2019-10-14 12:11:40 -07:00
Rintaro Ishizaki
1036d2a2bf [SyntaxParse] Parse ObjC keypath expression syntax 2019-10-11 11:55:22 -07:00
Rintaro Ishizaki
f50966fcc1 [SyntaxParse] Parse ObjectLiteralExpr syntax 2019-10-10 13:22:57 -07:00
Rintaro Ishizaki
bb08667bf5 [SyntaxParse] Parse tuple/paren expression syntax 2019-10-09 14:48:47 -07:00
Rintaro Ishizaki
dfe962f19a Merge pull request #27508 from rintaro/syntaxparse-expridentifier
[SyntaxParse] Parse IdentifierExpr syntax
2019-10-08 19:17:46 +02:00
Rintaro Ishizaki
f42f60f233 [Syntax] Consolidate 'TupleElement' and 'FunctionCallArgument' kinds
into 'TupleExprElement'. They had exact the same layout.
2019-10-07 20:52:11 -07:00
Rintaro Ishizaki
597538ca18 [SyntaxParse] Parse IdentifierExpr syntax
Along with UnqualifiedDeclName (e.g. 'foo(x:y:)').
2019-10-02 17:06:51 -07:00
Jan Svoboda
b0f6168660 [libSyntax] Represent raw string delimiters 2019-05-15 09:15:03 +02:00
kitasuke
b583fef8e2 Consolidate StringInterpolationExpr to StringLiteralExpr 2019-05-12 11:23:00 +09:00
kitasuke
5debb929da Rename StringInterpolationSegments to StringLiteralSegments 2019-05-06 09:37:37 +08:00
kitasuke
94815fae26 Revert "Revert "SR-10469 Unknown syntax for interpolated string literal""
This reverts commit 18dd11ab21.
2019-04-30 22:35:29 +01:00
Mishal Shah
18dd11ab21 Revert "SR-10469 Unknown syntax for interpolated string literal" 2019-04-29 23:09:58 -07:00
kitasuke
790d359257 Set collection element name for ExpressionSegment's Expressions 2019-04-26 07:26:07 +02:00
kitasuke
81ed9cc2f9 Merge branch 'master' into SR-10469-func-call-args_list 2019-04-26 06:29:02 +02:00
Argyrios Kyrtzidis
3612cd3d72 [utils/gyb_syntax_support] Add collection_element_name for when specifying a Child
This is useful to provide `add<ELEMENT_NAME>` APIs for SwiftSyntax that are better named
and without having name conflicts.
2019-04-23 18:14:39 -07:00
kitasuke
abd6dcfece Change expression kind from Expr to FunctionCallArgumentList 2019-04-23 17:54:26 +09:00
Xi Ge
758e4a28c2 SyntaxNodes: subsume DotSelfExpr and ImplicitMemberExpr by MemberAccessExpr.
Per our discussion in another PR, having these three similar nodes at
the same time  may unnecessarily complicate client side.
2019-01-17 14:15:53 -08:00
Xi Ge
9c42e9737b SyntaxNodes: DotSelfExpr should have optional base expression. rdar://46935325 2019-01-16 12:02:52 -08:00
Pavol Vaskovic
53cd115b0e [Gardening] Fix W291 trailing whitespace 2018-11-28 16:57:23 +01:00
Alex Hoppen
8430eff670 [libSyntax] Add syntax coloring based on the syntax tree 2018-07-13 17:48:47 -07:00
Alex Hoppen
7bbb5fa87a [libSyntax] Fix parsing of key paths on specialised generics 2018-04-27 08:10:20 -07:00
Alex Hoppen
94b8a3545b [libSyntax] Fix parsing for KeyPath 2018-04-25 13:30:31 -07:00
Alex Hoppen
c52f4a8131 [libSyntax] Fix parsing of operators passed to higher order functions 2018-04-23 12:23:27 -07:00
Rintaro Ishizaki
338cedd6d5 [Syntax] Parse '#selector' expression syntax 2018-04-12 13:56:04 +09:00
Rintaro Ishizaki
93cd5bce15 [Syntax] Fix typo 2018-03-27 22:58:21 +09:00
Xi Ge
7c905d38af SwiftSyntax: add WithStatementsSyntax trait and make all names consistent. NFC (#14782) 2018-02-22 14:38:29 -08:00
Xi Ge
bdebd8a210 SwiftSyntax: add WithTrailingCommanSyntax trait and fix inconsistent naming. NFC 2018-02-20 12:02:30 -08:00
Xi Ge
f814309f2e SwiftSyntax: Add ParenthesizedSyntax trait and mark various syntax nodes for conformances. NFC 2018-02-19 19:21:59 -08:00
Xi Ge
1b81fcb2b6 SwiftSyntax: Add a trait for those statement nodes with code block as body. (#14726)
This patch also refactors SyntaxNodes code so that protocol conformances
are declared as extensions.
2018-02-19 18:49:07 -08:00
Xi Ge
2b61d4edbb SwiftSyntax: add a mechanism to define traits of syntax nodes to allow abstract access to popular child kinds. NFC (#14668)
Swift syntax APIs lack an abstract way of accessing children. The client has to
down-cast a syntax node to the leaf type to access any of its children. However,
some children are common among different syntax kinds, e.g.
DeclAttributeSyntax and DeclMembers. We should allow an abstract way to
access and modify them, so that clients can avoid logic duplication.

This patch adds a mechanism to define new traits and specify satisfied
traits in specific syntax nodes. A trait is a set of common children
and implemented in Swift as a protocol for syntax nodes to conform to.
As a proof-of-concept, we added two traits for now including DeclGroupSyntax
and BracedSyntax.

Resolves: SR-6931 and SR-6916
2018-02-15 16:41:20 -08:00
Rintaro Ishizaki
6c0af2a24f [Syntax] Introduce CodeBlockItem (#14458)
CodeBlockItem represents Decl, Stmt or Expr that optionally followed by
semi-colon.
SourceFile syntax holds a list of CodeBlockItem.
2018-02-08 10:31:01 +09:00
Rintaro Ishizaki
1eedcb7682 [Syntax] Parse '->' in sequence expression 2018-02-06 15:06:00 +09:00
Rintaro Ishizaki
5dc6b78457 [Syntax] Parse generic specialize expression 2018-02-06 15:05:59 +09:00
Rintaro Ishizaki
9bf4c8af05 [Syntax] Allow tok::dollarident (e.g. $0) for IdentifierExpr 2018-01-23 19:15:06 +09:00
Rintaro Ishizaki
46d681c614 [Syntax] Allow 'self' and 'Self' keyword for IdentifierExpr 2018-01-23 19:15:06 +09:00
Rintaro Ishizaki
7f9578e5f3 [Syntax] Parse "dot self" expression nodes 2018-01-23 19:15:06 +09:00
Xi Ge
6cd5d0bf5e libSyntax: parse several magic identifier expressions.
They include #column, #file, #function and #dsohandle.
2018-01-10 18:02:02 -08:00
Xi Ge
7e4e7ff0bc libSyntax: parser object literal expressions.
This includes color, image and file literals.
2018-01-10 15:38:11 -08:00
Xi Ge
95f09d057e libSyntax: parse editor placeholder expression. (#13840) 2018-01-09 17:23:42 -08:00
Xi Ge
21f4564877 libSyntax: parse key path expressions. (#13813) 2018-01-08 20:54:53 -08:00
Xi Ge
1170a4ff01 libSyntax: parse InOut expression. (#13815) 2018-01-08 18:00:33 -08:00
Xi Ge
cb4bc9eb69 libSyntax: allow SyntaxCollection to specify acceptable element kinds. NFC
Segments list in interpolated string literal accepts two syntax kinds as
elements: StringSegment and ExpressionSegment. This patch generates
factory methods to reject other kinds.
2018-01-04 13:35:39 -08:00
Xi Ge
7476677bb2 libSyntax: create separate node kinds for quote (") and multiline quote (""").
This allows us to serialize the quote tokens without serializing their
underlying text.
2018-01-04 09:08:21 -08:00
Xi Ge
22ce6934bd libSyntax: parse string interpolation expression. (#13708)
A string interpolation expression is composed of { OpenQuote, Segments,
CloseQuote }. To represent OpenQuote, CloseQuote and StringSegment, we have to
introduce new token kinds correspondingly.
2018-01-03 20:41:34 -08:00