Commit Graph

32 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis
791309155d [Parse] Fix issue with incremental re-parsing for SwiftSyntax emitting bogus parsing error
rdar://60232712
2020-03-18 16:00:04 -07:00
Sergej Jaskiewicz
f25e50d946 [incrParse] Fix funcs.swift test case 2019-07-04 20:09:11 +03:00
Jan Svoboda
b0f6168660 [libSyntax] Represent raw string delimiters 2019-05-15 09:15:03 +02:00
kitasuke
9155ed88e0 Use StringLiteralExpr for invalid InterpolatedStringLiteralExpr 2019-05-12 11:23:16 +09:00
Argyrios Kyrtzidis
cbad3492e4 [Parse/Syntax] Simplify how the final SourceFileSyntax root is formed
Instead of creating multiple CodeBlockItemList nodes, that need to get merged and discarded later on, do this:

* Ensure for libSyntax parsing that we parse the whole file
* Create top-level CodeBlockItem nodes that we just directly wrap with a single CodeBlockItemList node at the end

The importance of this change will become more obvious later on when we'll decouple syntax parsing from the formation of libSyntax tree nodes.
2018-12-10 13:37:15 -08:00
Rintaro Ishizaki
1f563b3716 [incrParse] Fix SyntaxParsingCache::translateToPreEditPosition()
If the position is in the region that is inserted by the edits,
'pre-edit' position shouldn't exist. So we cannot reuse the node at the
position.

rdar://problem/45259469
https://bugs.swift.org/browse/SR-8995
2018-11-06 00:27:19 +09:00
Rintaro Ishizaki
891cca14b4 [incrParse] Skip missing node in getNextNode()
Taking Missing node into account confuses reusability checking in
incremental parsing.

rdar://problem/45215049 https://bugs.swift.org/browse/SR-8976
rdar://problem/45287031 https://bugs.swift.org/browse/SR-9006
2018-10-24 23:58:46 +09:00
Nathan Hawes
efa2c5475d [incrParse] Update text-util.py to handle multiple edits and reparse ranges on the same line
It wasn't accounting for the prefix length before a reparse tag previously when
keeping track of pre_column_offset and post_column_offset.
2018-10-11 14:31:32 -07:00
Nathan Hawes
0152e23f4b [incrParse] Fix expected syntax tree json to account for added comment 2018-10-11 14:17:47 -07:00
Alex Hoppen
8baba2980e [incrParse] Add warning not to add anything to the identifier-at-eof test 2018-10-11 18:02:26 +02:00
Alex Hoppen
d6fc0807c1 [incrParse] Adjust expected reparse region for simple test case 2018-10-11 18:00:56 +02:00
Nathan Hawes
5c568af436 [incrParse] Fix bug mapping a node's location back to its location in the cached syntax tree
Also fix Edit::intersectsOrTouchesRange check only returning true when the
ranges overlapped, rather than when they overlapped or 'touched'.

Resolves rdar://problem/45108439
2018-10-08 15:44:38 -07:00
Alex Hoppen
3801bb0e42 [SwiftSyntax] Remove SwiftSyntax from the main swift repository
It has moved to its own repository at https://github.com/apple/swift-syntax
2018-08-30 11:46:22 -07:00
Alex Hoppen
da7cdbb122 [libSyntax] Add test cases for ByteTree serialization and deserialization 2018-08-21 10:55:15 -07:00
Alex Hoppen
32a3a31684 [libSyntax] Reenable caching of token nodes 2018-08-13 15:14:37 -07:00
Alex Hoppen
52acc04fa7 [libSyntax] Add test case to match the incrementally transferred syntax tree 2018-07-25 09:58:53 -07:00
Alex Hoppen
d926b74836 [incrParse] Add test cases to test the incremental syntax tree transfer 2018-07-24 16:32:23 -07:00
Alex Hoppen
d9d5afd15a [incrParse] Refactor the test utility to be more modular
This way we can use the same core of the test utility to verify
round-tripness of incrementally transferring the syntax tree to
swiftSyntax.
2018-07-19 14:47:58 -07:00
Alex Hoppen
21dc447e89 [incrParse] Add test case for nested initializers 2018-07-18 13:35:11 -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
Alex Hoppen
b2ebc96510 [incrParse] Reparse a node if the next leaf node has been modified 2018-05-22 09:07:55 -07:00
Alex Hoppen
b26dd1118c [incrParse] Fix swift-syntax-test not complaining about unexpected reparsed functions 2018-05-22 08:52:40 -07:00
Alex Hoppen
17c14a0c48 [incrParse] Add some more tests 2018-05-22 08:52:39 -07:00
Alex Hoppen
e1a99efd57 [incrParse] Fix parsing of nodes covering no source text 2018-05-22 08:52:39 -07:00
Alex Hoppen
9d3233c556 [incrParse] Allow reuse of MemberDeclListItems 2018-05-22 08:52:38 -07:00
Alex Hoppen
c31a880a47 [incrParse] Allow whitespaces to be reparsed in test
This greatly improves the ergonomics of writing tests and outweighs the
ability to test which whitespaces get parsed since their parsing
overhead should be minimal.
2018-05-22 08:52:38 -07:00
Alex Hoppen
9bdc54a29c [incrParse] Add support for test cases that verify the reused regions 2018-05-22 08:52:38 -07:00
Alex Hoppen
6b3ac23d65 [incrParse] Allow testing of multiple edits per line 2018-05-22 08:52:37 -07:00
Alex Hoppen
ef69e416d3 [incrParse] Add some more passing tests 2018-05-22 08:52:36 -07:00
Alex Hoppen
ec4a527c44 [incrParse] Reparse nodes if the next node's trailing trivia has changed 2018-05-22 08:52:36 -07:00
Alex Hoppen
bc5e4d709a [incrParse] Compute byte offsets of pre-edit file based on that file 2018-05-22 08:52:35 -07:00
Alex Hoppen
a1ff223497 [incrParse] Add utility to test incremental parsing 2018-05-22 08:52:35 -07:00