Rintaro Ishizaki
18b28b9184
[Parse] Factor out declaration modifier list parsing ( #15702 )
2018-04-03 19:58:57 +09:00
David Zarzycki
42890e97ef
Merge pull request #15597 from davezarzycki/more_TVO_CanBindToInOut_removal
...
[Sema] NFC: More TVO_CanBindToInOut removal
2018-03-31 16:39:07 -04:00
David Zarzycki
67710606e6
[Parse] Move tok::amp_prefix closer to parameter list logic
...
The amp_prefix token is currently tolerated in any unary expression
context and then diagnosed later by Sema. This patch changes parsing to
only accept tok::amp_prefix in its allowed position: parameter lists.
This also fixes two "compiler crasher" tests.
2018-03-30 17:56:36 -04:00
Sho Ikeda
46aae67a1e
[gardening][Parse] Replace typedef with using
2018-03-30 12:59:41 +09:00
Robert Widmann
03580d2fe5
Add a parameter list to EnumElementDecl
...
This models, but does not plumb through, default arguments.
2018-03-28 00:05:56 -04:00
Rintaro Ishizaki
ea83df4c9d
Merge pull request #15267 from rintaro/parse-exprprimary
...
[Parse] Rename 'parseExprPostfixWithoutSuffix' to 'parseExprPrimary' and cleanups
2018-03-17 13:16:35 +09:00
Slava Pestov
34fd4ae512
AST: Use DeclBaseName::Kind::Constructor
...
Fixes <rdar://problem/35852727>, <https://bugs.swift.org/browse/SR-1660 >,
<https://bugs.swift.org/browse/SR-6557 >.
2018-03-16 00:25:56 -07:00
Rintaro Ishizaki
3347d56465
[gardening] Rename parseExprPostfixWithoutSuffix to parseExprPrimary
2018-03-15 17:45:32 +09:00
Rintaro Ishizaki
444451eb6c
[gardening] Remove unused LSquareLoc parameter from parseExprCollection
2018-03-15 15:45:37 +09:00
Rintaro Ishizaki
0a26e287ba
[Parse] Diagnose unknown pound expressions
...
Implemented diagnostics for `'#' identifier arguments?` at expression
position.
Also, added back diagnostics (and fix-it) for legacy object literals.
2018-03-15 15:36:51 +09:00
Rintaro Ishizaki
bdcd87754d
[Parse] Eliminate POUND_OLD_OBJECT_LITERAL tokens
...
We don't want to handle them in libSyntax
2018-03-14 21:50:53 +09:00
Rintaro Ishizaki
54b28b6cb6
Merge pull request #15152 from omochi/lex-remove-fields
...
[Parse] Remove unnecessary Lexer fields
2018-03-13 12:19:36 +09:00
Doug Gregor
d138575da2
Merge pull request #15170 from ikesyo/enum-class-uint8_t
...
[gardening][enum class] Replace `unsigned char` with `uint8_t` for consistency
2018-03-12 09:05:13 -07:00
omochimetaru
3c8057e13f
[Parse] Remove unnecessary Lexer fields
2018-03-12 23:35:13 +09:00
Rintaro Ishizaki
c612da2805
[Lexer] Remove dead code ( #15179 )
...
Remove Lexer::getSubstring()
The last usage was deleted in d522cd4270 .
2018-03-12 22:44:24 +09:00
Sho Ikeda
422136e1a2
[gardening][enum class] Replace unsigned char with uint8_t for consistency
...
Before the changes:
- `git grep -E "enum class .+ : uint8_t \{" | wc -l`: 90
- `git grep -E "enum class .+ : unsigned char \{" | wc -l`: 26
2018-03-12 13:57:36 +09:00
omochimetaru
5e555868fe
[Parse] Reduce branch by running lexTrivia always ( #15137 )
2018-03-10 21:26:54 +09:00
Rintaro Ishizaki
71d31907e8
Merge pull request #15043 from omochi/lex-init
...
[Parse] Refactor Lexer initialization
2018-03-08 14:04:02 +09:00
omochimetaru
967a48cb77
[Parse] refactor Lexer initialization
2018-03-08 11:17:51 +09:00
Huon Wilson
e307e54098
[AST] Explicitly track things marked __owned.
2018-03-08 12:36:24 +11:00
omochimetaru
b4192d80e9
[Parse] EmitDiagnosticsIfToken in lexUnknown
...
It is needed from lexTrivia update future.
2018-03-06 08:25:09 -08:00
omochimetaru
e6f42fc63d
[Parse] split lexUnknown function from lexImpl
2018-03-06 08:25:09 -08:00
omochimetaru
58857fa1cb
[Parse] refactor Lexer by made NulCharacterKind type
2018-03-05 16:53:18 +09:00
omochimetaru
d12542503f
[Syntax] test diagnostics in Lexer with libSyntax ( #14954 )
2018-03-04 08:53:54 +09:00
Joe Groff
d365c153d4
SIL: Introduce sil_property declarations for property descriptors.
...
This provides SILGen a place to generate the key path component information for an exported property so that it can be linked to from other modules.
2018-02-23 14:57:45 -08:00
Xi Ge
37f352fe41
sourcekitd: build Swift syntax tree more lazily than collecting parsed tokens. ( #14578 )
...
Before this patch, we have one flag (KeepSyntaxInfo) to turn on two syntax
functionalities of parser: (1) collecting parsed tokens for coloring and
(2) building syntax trees. Since sourcekitd is the only consumer of either of these
functionalities, sourcekitd by default always enables such flag.
However, empirical results show (2) is both heavier and less-frequently
needed than (1). Therefore, separating the flag to two flags makes more
sense, where CollectParsedToken controls (1) and BuildSyntaxTree
controls (2).
CollectingParsedToken is always enabled by sourcekitd because
formatting and syntax-coloring need it; however BuildSyntaxTree should
be explicitly switched on by sourcekitd clients.
resolves: rdar://problem/37483076
2018-02-13 16:27:12 -08:00
Harlan
5e02d2a877
Implement #warning and #error ( #14048 )
...
* Implement #warning and #error
* Fix #warning/#error in switch statements
* Fix AST printing for #warning/#error
* Add to test case
* Add extra handling to ParseDeclPoundDiagnostic
* fix dumping
* Consume the right paren even in the failure case
* Diagnose extra tokens on the same line after a diagnostic directive
2018-02-03 18:07:05 -05:00
Rintaro Ishizaki
2134f9f768
[Parse] Move SyntaxParsingContext to Parse ( #14360 )
...
This is only for the Parser.
Also, this resolves layering violation where libAST and libSyntax
depends on each other.
2018-02-03 10:43:52 +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
Xi Ge
4c172037e8
[libSyntax][SourceKit] Integrating libSyntax representation of a source file with several SourceKitd syntax requests ( #14000 )
...
The enhanced SourceKitd requests are EditorOpen and EdtiorReplaceText. In these two requests, the clients can specify a flag "key. enablesyntaxtree = 1" to get a serialize libSyntax tree with the response.
To help this integration, we added a function in SyntaxParsingContext to explicitly finalize the creation of a SourceFileSyntax to incorporate the fact that SourceKit needs the tree before its destroying the parser instance.
To test this integration, we diff the syntax tree serialized from the frontend action and the tree serialized from a SourceKitd response. They should be identical.
2018-01-17 21:13:22 -08:00
John McCall
7f0f8830cd
Split AccessorDecl out from FuncDecl. NFC.
...
This has three principal advantages:
- It gives some additional type-safety when working
with known accessors.
- It makes it significantly easier to test whether a declaration
is an accessor and encourages the use of a common idiom.
- It saves a small amount of memory in both FuncDecl and its
serialized form.
2018-01-12 14:20:27 -05: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
Rintaro Ishizaki
01f42c89d3
Merge pull request #13631 from omochi/lex-escape-backtick
...
[Parse] Lexer build backtick trivia around espaced identifier token
2017-12-29 12:36:00 +09:00
omochimetaru
bc88330740
[Parse] Lexer build backtick trivia around espaced identifier token
2017-12-29 00:22:49 +09:00
Rintaro Ishizaki
48eb60702e
[Syntax] Stop using SyntaxBuilders for TypeIdentifier
...
Since we haven't handled error cases yet, Error type identifier (e.g.
'Array.+') used to case round trip problem.
2017-12-27 13:18:17 +09:00
Rintaro Ishizaki
39746a9e58
[Parse] Inline skipExtraTopLevelRBraces()
...
Removed from 'parseTopLevel()'. There's no particular reason to diagnose
it in 'parseTopLevel()'.
2017-12-25 23:32:55 +09:00
Rintaro Ishizaki
7aea64ded7
Merge pull request #13598 from rintaro/syntax-stmt-part2
...
[Syntax] Parse "if", "guard" and "for-in" statement nodes
2017-12-23 15:51:46 +09:00
Rintaro Ishizaki
02769d77c2
[Parse] Factor out StmtConditionElement parsing
2017-12-22 18:28:04 +09:00
omochimetaru
24509a0bde
[Parse] Change LeadingTrivia type to Trivia
2017-12-20 14:09:47 +09:00
Rintaro Ishizaki
181333ce0f
[Lexer] Lex conflict marker as a trivia
2017-12-19 09:24:33 +09:00
Rintaro Ishizaki
023379cde5
Merge pull request #13495 from omochi/lexer-refactor-skip-to-eol
...
[Parse] Refactor Lexer's skipToEndOfline
2017-12-19 09:12:07 +09:00
Xi Ge
fe1a4ca0d2
libSyntax: create libSyntax node for var decl accessors.
2017-12-18 15:16:14 -08:00
omochimetaru
5de598f34a
[Parse] use skipHashbang in lexTrivia
2017-12-18 18:22:04 +09:00
omochimetaru
aeb9ba6f96
[Parse] use skipSlashSlashComment in lexTrivia
2017-12-18 18:22:04 +09:00
omochimetaru
f7136ae635
[Parse] delete skipUpToEndOfLine
2017-12-18 18:22:04 +09:00
omochimetaru
ed58c152bf
[Parse] Improve Lexer's UTF-8 BOM handling ( #13483 )
...
* Add BOM handling testcases
* Add ContentStart to Lexer for BOM handling
2017-12-18 17:22:11 +09:00
Rintaro Ishizaki
7b4fc5b196
[Syntax] Restore Lexer state by restoring LeadingTrivia
...
Instead of re-lexing Trivias. Trivia might contain skipped garbage which
might be re-lexed as tokens.
2017-12-09 14:48:21 +09:00
Rintaro Ishizaki
60bfa893b9
[Parse] Make PersistentParserState to hold ParserPosition
...
instead of PersistentParserState::ParserPos.
2017-12-09 13:58:50 +09:00
Rintaro Ishizaki
574d39bcb6
[Parse] Split ParserPosition declaration to dedicated header file
2017-12-09 13:58:50 +09:00
Rintaro Ishizaki
724052d266
[Parse] Rename Lexer::State to LexerState
2017-12-09 13:58:50 +09:00