Commit Graph

173 Commits

Author SHA1 Message Date
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
Ben Langmuir
a7fe27ae28 Appease python linter 2019-05-02 12:56:18 -07:00
Rintaro Ishizaki
68555dbf7e [Syntax] Add 'element_name' and 'collection_element_name' where needed 2019-05-02 11:24:25 -07:00
Xi Ge
24f5ba741a Syntax: add Syntax support for property delegate attributes
rdar://50056605
2019-05-02 09:50:40 -07: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
6743b6103b IDE: treat some as keyword for opaque result type 2019-04-19 17:11:03 -07:00
Xi Ge
644b5ecd53 libSyntax: add support for some type. rdar://49398494 2019-04-19 17:10:53 -07:00
Xi Ge
746a88aec8 Syntax: synthesize right brace tokens if they are missing from nominal type decls. 2019-04-15 16:45:26 -07:00
Rintaro Ishizaki
6aee036812 Merge pull request #22214 from bannzai/syntax/add/function/make_ellipsis_token
[SwiftSyntax] Add SyntaxFactory.makeEllipsisToken function.
2019-02-11 16:27:37 -08:00
Xi Ge
a9f9f3ddec SwiftSyntax: address some post-commit review comments 2019-02-07 21:45:06 -08:00
Xi Ge
0c28b4c1a3 SyntaxNodes: implement the hash function for syntax nodes.
This hash function will concatenate all interesting pieces of information
of node definitions in a single string and call hash() on this string.
2019-02-07 16:58:26 -08:00
bannzai
814cf829be Change syntax kind to EllipsisKind 2019-02-07 23:16:24 +09:00
Xi Ge
e07a8cf2a6 SyntaxParser: set up a C API to get a hash value indicating the node declaration set
To ensure SwiftSyntax calls a compatible parser library, this patch sets
up a C API that returns a constant string calculated during compilation time to indicate
the version of syntax node declarations. The same hash will be calculated
in the SwiftSyntax (client) side as well by using the same algorithm.

During runtime, SwiftSyntax will verify its hash value is identical to the
result of calling swiftparse_node_declaration_hash before actual
parsing happens.

This patch only sets the API up. The actual implementation of the
hashing algorithm will come later.
2019-02-06 17:33:48 -08:00
bannzai
b1ae4c3bad Fix gyb script about add make ellipsis token type 2019-01-30 02:27:18 +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
Argyrios Kyrtzidis
1f1eab638f [Parse/Syntax] Replace ParsedSyntaxRecorder::record* calls from the parser with ParsedSyntaxRecorder::make*
Doing a "direct ParsedSyntaxRecorder::record[some syntax]" call from the parser is not a good idea due to possibility
of being in a backtracking context when the call is made. Replace them with "ParsedSyntaxRecorder::make[some syntax]"
which will implicitly check for backtracking and create a recorded or deferred node accordingly.
2019-01-07 19:56:36 -08:00
Argyrios Kyrtzidis
eae5fd5ff0 [utils/gyb_syntax_support] Fix python-lint issues 2019-01-07 19:52:59 -08:00
Argyrios Kyrtzidis
ab7427723e [Parse/Syntax] Refactoring to decouple the parser from syntax tree creation
Instead of creating syntax nodes directly, modify the parser to invoke an abstract interface 'SyntaxParseActions' while it is parsing the source code.
This decouples the act of parsing from the act of forming a syntax tree representation.
'SyntaxTreeCreator' is an implementation of SyntaxParseActions that handles the logic of creating a syntax tree.
To enforce the layering separation of parsing and syntax tree creation, a static library swiftSyntaxParse is introduced to compose the two.

This decoupling is important for introducing a syntax parser library for SwiftSyntax to directly access parsing.
2019-01-07 19:52:59 -08: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
Arnold Schwaighofer
cf2eb2115e Fix python indentation for real 2018-11-06 15:26:59 -08:00
Arnold Schwaighofer
c77da027c7 Attemp to fix python lint errors 2018-11-06 12:32:57 -08:00
Arnold Schwaighofer
b102c7f6b4 Parser/Sema/SILGen changes for @_dynamicReplacement(for:)
Dynamic replacements are currently written in extensions as

extension ExtendedType {
  @_dynamicReplacement(for: replacedFun())
  func replacement() { }
}

The runtime implementation allows an implementation in the future where
dynamic replacements are gather in a scope and can be dynamically
enabled and disabled.

For example:

dynamic_extension_scope CollectionOfReplacements {
  extension ExtentedType {
    func replacedFun() {}
  }

  extension ExtentedType2 {
    func replacedFun() {}
  }
}

CollectionOfReplacements.enable()
CollectionOfReplacements.disable()
2018-11-06 09:58:36 -08:00
Mark Lacey
5e0cb1978a Fix libSyntax support for operator decl designated types. 2018-10-11 13:36:14 -07:00
John McCall
32c7e4bbfa Fix libSyntax support for yields with expression lists. 2018-10-09 15:34:54 -04:00
Mark Lacey
cc7f2ba542 Update the comment to match the current node definition. 2018-09-17 23:33:15 -07:00
Mark Lacey
a148b21730 [Syntax] Update DeclNodes.py for designated protocols parsing support. 2018-09-15 00:21:14 -07:00
Rintaro Ishizaki
51b7168d05 [Parse] Refactor get/set accessor parsing
* Use 'parseAbstractFunctionBody()' for accessors as well. This
  simplifies the implementation, and makes 'parseAbstractFunctionBody()'
  the single point of parsing body of every 'AbstructFunctionDecl' types.
2018-08-29 18:01:21 +09:00
Erik Eckstein
c6eb5fe82a minor follow-ups for remove pinning in utilities and docs 2018-08-25 11:14:18 -07:00
Alex Hoppen
c50729badf [swiftSyntax] Remove validate methods
The methods were never executed because DEBUG was never defined in
normal builds and the only way to create nodes is through generated
factory methods which provide the same safety `validate` was supposed to
ensure at the interface level.
2018-08-23 09:12:14 -07:00
Alex Hoppen
e8dc5055d6 Merge pull request #18715 from ahoppen/gen-tokenkinds
[libSyntax] Generate TokenKinds.def from gyb_syntax_support
2018-08-15 13:27:43 -07:00
Alex Hoppen
e9e7d5cf68 [libSyntax] Generate TokenKinds.def from gyb_syntax_support 2018-08-15 11:11:27 -07:00
Alex Hoppen
79e9113a58 Merge pull request #18677 from ahoppen/ref-counted-owned-string
[libSyntax] Add a reference counted version of OwnedString
2018-08-14 11:37:40 -07:00
Alex Hoppen
4369b36f21 Merge pull request #18497 from ahoppen/bytetree-infrastructure
[libSyntax] Add a binary serialization format for syntax trees
2018-08-13 15:41:30 -07:00
Alex Hoppen
ac512d4341 [libSyntax] Add a reference counted version of OwnedString
We cannot use unowned strings for token texts of incrementally parsed
syntax trees since the source buffer to which reused nodes refer will
have been freed for reused nodes. Always copying the token text whenever
OwnedString is passed is too expensive. A reference counted copy of the
string allows us to keep the token's string alive across incremental
parses while eliminating unnecessary copies.
2018-08-13 15:37:53 -07:00
Alex Hoppen
280b186fa0 [libSyntax] Add a binary serialization format for syntax trees 2018-08-10 10:13:00 -07:00
Alex Hoppen
7355492db3 Merge pull request #18503 from ahoppen/comment-classification
[swiftSyntax] Add syntax classification infrastructure for comments
2018-08-09 13:48:20 -07:00
Mark Lacey
5bd94a9fc7 Fix typo. 2018-08-08 08:58:22 -07:00
Alex Hoppen
e4eb76fa0c [swiftSyntax] Add classifications for comments 2018-08-04 09:05:13 -07:00
Alex Hoppen
775beece65 [libSyntax] Add a swift token classifier for syntax highlighting 2018-07-30 14:54:43 -07:00
Alex Hoppen
478518fcf7 [swiftSyntax] Add type annotations to speed up compile time 2018-07-26 20:46:58 -07:00