Commit Graph

11 Commits

Author SHA1 Message Date
Xi Ge
7542f991c1 Re-apply "SourceKit: make SwiftLang build in linux. (#18455)" (#18506) 2018-08-06 11:37:09 -07:00
Xi Ge
960d7642cf Revert "SourceKit: make SwiftLang build in linux. (#18455)"
We revert it for failures in

https://ci.swift.org/job/oss-swift_tools-RA_stdlib-RD_test-simulator/1237/consoleFull#-20795171483122a513-f36a-4c87-8ed7-cbc36a1ec144
2018-08-03 11:24:51 -07:00
Xi Ge
084286eb5a SourceKit: make SwiftLang build in linux. (#18455) 2018-08-02 18:49:01 -07:00
Alex Hoppen
8bab276d64 [libSyntax] Add incremental syntax tree deserialization to SwiftSyntax 2018-07-24 16:32:23 -07:00
Alex Hoppen
1b3baf908f [incrParse] Add error nodes to the end of a CodeBlockItem
Creating a new CodeBlockItem meant that when doing an edit in the error
nodes, the prefix gets reused and thus the code is parsed as invalid
although it is not.
2018-05-22 09:07:55 -07:00
Xi Ge
cbf840fad4 SwiftSyntax: Allow absolute position access for dangling nodes.
Since absolute position is defined by accumulating proceeding nodes,
we should allow its access for nodes without SourceFileSyntax as root.
2018-05-03 12:13:36 -07:00
Harlan Haskins
572a144d2d Rename byteOffset to utf8Offset and remove utf16 2018-04-24 16:14:37 -04:00
Xi Ge
123ccc7602 SwiftSyntax: add an API to check whether a syntax node has underlying source. (#15389) 2018-03-20 18:16:54 -07:00
Xi Ge
1c9f1c48ed SwiftSyntax: allow any Syntax nodes to access their leading/trailing trivia. (#15278)
Although libSyntax is designed in a way that trivia is attached to
tokens, we shouldn't restrict clients to access trivia only from a token.
An example can be doc-comment, which conceptually attaches to a declaration rather
than the start token of a declaration, like at-attributes.
2018-03-15 15:31:08 -07:00
Xi Ge
af868778b6 SwiftSyntax: add an API to teach Trivia to calculate byte size. (#15251)
This missing piece will allow clients to customize the size of
SyntaxNode better.
2018-03-14 17:14:52 -07:00
Xi Ge
ee36dbeda3 [WIP] SwiftSyntax: Implement APIs for Syntax nodes to calculate absolute positions. (#15097)
Syntax nodes are designed as reusable blocks to construct Swift source
code. For this reason, we don't track absolute position in each node;
instead, the absolute position should be calculated on the fly when
needed. We recently found absolute positions are useful to bridge with
sourcekitd, which typically speaks in the language of line, column and
offset. Therefore, this patch tries to add a computed
property on SyntaxNode to get its absolute position.

To compute the absolute position of a SyntaxNode from scratch requires tree traversal.
However, getting the absolute position from these added APIs doesn't necessarily
mean we'll traverse since SyntaxData will actively cache the computed position.
Also, since we recursively compute the absolute position, all the position caches
for a SyntaxNode's previous siblings and ancestors will be populated as well during
the calculation of this SyntaxNode.
2018-03-12 15:42:46 -07:00