Commit Graph

20 Commits

Author SHA1 Message Date
Alex Hoppen
57ccdd89b6 [incrParse] Add validation of incremental parsing
If enabled using the environment variable
SOURCEKIT_INCREMENTAL_PARSE_VALIDATION, the incrementally parsed syntax
tree will be compared to the from-scratch parsing syntax tree. If they
differ a warning is emitted and log files showing the difference written
to a temporary directory.
2018-07-18 13:35:11 -07:00
Alex Hoppen
9d59cd286b [incrParse] Add a stable id to the syntax nodes
The id is meant to be stable across incremental parses
2018-07-13 16:56:03 -07:00
Dexin Li
e0f8b27117 [Syntax]Add a deserializer that convert json to libSyntax tree (#15203) 2018-03-16 15:22:04 -07:00
Xi Ge
a121ce65ca Syntax: add APIs to help syntax tree serialization. NFC (#15241) 2018-03-14 13:12:31 -07:00
Xi Ge
94c3f55117 libSyntax: extract meta-information of trivia kinds to syntax_gyb_support. NFC
The existing libSyntax infrastructure uses external python
dictionaries to share logic between C++ and Swift implementations.
This patch teaches trivia kinds to adapt to this infrastructure
 as well.
2018-03-06 17:45:43 -08:00
Rintaro Ishizaki
fced748790 [Syntax] Represent missing optioanl nodes as nullptr (#14300)
Allocating RawSyntax/SyntaxData for missing optional node is a waste of
resource.
2018-01-31 19:24:00 +09:00
Rintaro Ishizaki
0780c529c4 [Syntax] Unify RawSyntax and RawTokenSyntax using union and TrailingObjects
It better matches with SwiftSyntax model.

Using TrailingObjects reduces the number of heap allocation which
gains 18% performance improvement.
2018-01-18 14:49:46 +09:00
Rintaro Ishizaki
192434003d [Syntax] Introduce TOKEN macro in TokenKinds.def 2018-01-17 02:38:14 +09: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
Marcel Jackwerth
a1a285d740 [Syntax] Serialize contextual_keyword text. (#13647) 2018-01-02 10:53:06 -08:00
omochimetaru
3a3e89ba0c [Syntax] add TriviaKind::CarriageReturnLineFeed 2017-12-20 20:50:40 +09:00
Rintaro Ishizaki
2c06060165 [Syntax] Add CarriageReturn trivia kind
To distinguish '\r' from '\n'.
2017-12-19 09:24:34 +09:00
Rintaro Ishizaki
2b1e316cf6 [Syntax] Add parsing hashbang (shebang) as a trivia.
Added GarbageText trivia kind for any skipped text.
2017-12-08 12:07:00 +09: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
Harlan
70089a7bcc [Syntax] Represent TokenSyntax as a Syntax node (#10606)
Previously, users of TokenSyntax would always deal with RC<TokenSyntax>
which is a subclass of RawSyntax. Instead, provide TokenSyntax as a
fully-realized Syntax node, that will always exist as a leaf in the
Syntax tree.

This hides the implementation detail of RawSyntax and SyntaxData
completely from clients of libSyntax, and paves the way for future
generation of Syntax nodes.
2017-06-27 11:08:10 -07:00
Harlan Haskins
a273ca405d [Syntax] Don't serialize text for simple tokens
The text for tok::kw_struct, and similar, are always known.
Save space by not serializing them.
2017-06-20 15:43:34 -07:00
Harlan Haskins
841df8d8b5 Correct comment 2017-06-15 16:11:13 -07:00
Harlan Haskins
d0d4967f3f Fix unfinished comment 2017-06-15 16:10:03 -07:00
Harlan Haskins
bc6e56c17c Add simple diff test for serialized syntax 2017-06-15 16:08:11 -07:00