Commit Graph

19 Commits

Author SHA1 Message Date
Jan Svoboda
b0f6168660 [libSyntax] Represent raw string delimiters 2019-05-15 09:15:03 +02:00
bannzai
b1ae4c3bad Fix gyb script about add make ellipsis token type 2019-01-30 02:27:18 +09:00
Pavol Vaskovic
98522c51d6 [Gardening] Per precedent, suppress I201 warning 2018-11-28 17:12:13 +01:00
Pavol Vaskovic
53cd115b0e [Gardening] Fix W291 trailing whitespace 2018-11-28 16:57:23 +01:00
Marc Rasi
bf18697b4f parsing, typechecking, and SILGen for #assert
`#assert` is a new static assertion statement that will let us write
tests for the new constant evaluation infrastructure that we are working
on. `#assert` works by lowering to a `Builtin.poundAssert` SIL
instruction. The constant evaluation infrastructure will look for these
SIL instructions, const-evaluate their conditions, and emit errors if
the conditions are non-constant or false.

This commit implements parsing, typechecking and SILGen for `#assert`.
2018-11-07 16:34:17 -08:00
Alex Hoppen
e9e7d5cf68 [libSyntax] Generate TokenKinds.def from gyb_syntax_support 2018-08-15 11:11:27 -07:00
Alex Hoppen
280b186fa0 [libSyntax] Add a binary serialization format for syntax trees 2018-08-10 10:13:00 -07:00
Alex Hoppen
775beece65 [libSyntax] Add a swift token classifier for syntax highlighting 2018-07-30 14:54:43 -07:00
John McCall
7a4aeed570 Implement generalized accessors using yield-once coroutines.
For now, the accessors have been underscored as `_read` and `_modify`.
I'll prepare an evolution proposal for this feature which should allow
us to remove the underscores or, y'know, rename them to `purple` and
`lettuce`.

`_read` accessors do not make any effort yet to avoid copying the
value being yielded.  I'll work on it in follow-up patches.

Opaque accesses to properties and subscripts defined with `_modify`
accessors will use an inefficient `materializeForSet` pattern that
materializes the value to a temporary instead of accessing it in-place.
That will be fixed by migrating to `modify` over `materializeForSet`,
which is next up after the `read` optimizations.

SIL ownership verification doesn't pass yet for the test cases here
because of a general fault in SILGen where borrows can outlive their
borrowed value due to being cleaned up on the general cleanup stack
when the borrowed value is cleaned up on the formal-access stack.
Michael, Andy, and I discussed various ways to fix this, but it seems
clear to me that it's not in any way specific to coroutine accesses.

rdar://35399664
2018-07-23 18:59:58 -04:00
Rintaro Ishizaki
ea5f93807f [Syntax] Add 'unknown' token to Token.py 2018-03-14 20:38:48 +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
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
Harlan
9185ef5610 [Syntax] Add #selector and #keyPath tokens (#13615)
* [Syntax] Add #selector and #keyPath tokens

* [Syntax][test] Add #selector and #keyPath to syntax parsing tests

* [Syntax] Don't fatalError on an unknown token kind

* Fix test build error
2017-12-29 12:35:08 -05:00
Rintaro Ishizaki
53b2e0fe14 [Syntax] Parse composition type node 2017-12-15 10:52:10 -08:00
Harlan
d0339c2767 Add contextual_keyword and string_interpolation_anchor to SwiftSyntax (#13321) 2017-12-08 16:13:49 -05:00
Harlan
ade67ca899 [Syntax] Swift libSyntax API (#11320)
* Create Swift libSyntax API

This patch is an initial implementation of the Swift libSyntax API. It
aims to provide all features of the C++ API but exposed to Swift.

It currently resides in SwiftExperimental and will likely exist in a
molten state for a while.

* Only build SwiftSyntax on macOS
2017-08-14 16:47:48 -07:00
Harlan
a5098e6b69 Generate libSyntax API (#10926)
* Generate libSyntax API

This patch removes the hand-rolled libSyntax API and replaces it with an
API that's entirely automatically generated. This means the API is
guaranteed to be internally stylistically and functionally consistent.
2017-07-25 18:19:58 -07:00