Commit Graph

7 Commits

Author SHA1 Message Date
Rintaro Ishizaki
4a247efc0a [Parse] Parse label in tuple type as tok::identifier
Made an utility method 'consumeArgumentLabel', and use it for:
* Labels in tuple type
* Labels in tuple expression
* Argument and parameter names in parameter clause
2018-05-22 13:46:42 +09:00
Rintaro Ishizaki
4c11cf964a [SourceKit] Add SyntaxMap test case for keyword in argument label position 2018-05-22 13:46:32 +09:00
David Farler
f450f0ccdf Revert "Preserve whitespace and comments during lexing as Trivia"
This reverts commit d6e2b58382.
2016-11-18 13:23:31 -08:00
David Farler
d6e2b58382 Preserve whitespace and comments during lexing as Trivia
Store leading a trailing "trivia" around a token, such as whitespace,
comments, doc comments, and escaping backticks. These are syntactically
important for preserving formatting when printing ASTs but don't
semantically affect the program.

Tokens take all trailing trivia up to, but not including, the next
newline. This is important to maintain checks that statements without
semicolon separators start on a new line, among other things.

Trivia are now data attached to the ends of tokens, not tokens
themselves.

Create a new Syntax sublibrary for upcoming immutable, persistent,
thread-safe ASTs, which will contain only the syntactic information
about source structure, as well as for generating new source code, and
structural editing. Proactively move swift::Token into there.

Since this patch is getting a bit large, a token fuzzer which checks
for round-trip equivlence with the workflow:

fuzzer => token stream => file1
  => Lexer => token stream => file 2 => diff(file1, file2)

Will arrive in a subsequent commit.

This patch does not change the grammar.
2016-11-15 16:11:57 -08:00
Xi Ge
3e03b78b77 [SyntaxColoring] Tolerating empty spaces between doc-comment openning… (#3373)
* [SyntaxColoring] Tolerating empty spaces between doc-comment opennings and field keywords. rdar://26310081

* [test] Update test for SourceKit.
2016-07-06 22:41:58 -07:00
Ben Langmuir
8030d44826 [SyntaxMap] Fold unary minus into numeric literals
Unlike other prefix operators, unary minus is folded into the
NumberLiteralExpr in the parser. This commit recreates this effect in
the lexer-based syntax map so that token ranges will include the leading
minus.

rdar://problem/20205885
2016-03-15 10:40:52 -07:00
Argyrios Kyrtzidis
8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00