65 Commits

Author SHA1 Message Date
Allan Shortlidge
e879c07542 AST: Rename getOrigAttrs() to getParsedAttrs().
To match terminology used elsewhere in the compiler (e.g. "parsed accessor")
rename "original attributes" to "parsed atributes". Additionally, make sure the
attributes returned by `getParsedAttrs()` really are just the parsed ones by
skipping implicit attributes in addition to the ones expanded from macros.
2023-11-01 22:50:09 -07:00
Ben Barham
0c3f538822 [AST] Allow ignoring macro expansions
Various requests expect to be walking over the current source file.
While we could add checks to all these to skip decls outside of the
current buffer, it's a little nicer to handle this during the walk
instead.

Allow ignoring nodes that are from macro expansions and add that flag to
the various walks that expect it.

Also add a new `getOriginalAttrs` that filters out attributes in
generated source.
2023-02-16 18:04:56 -08:00
Alex Hoppen
a7dcd4604e [SourceKit] Add an operator syntax kind
This will allow us to do semantic highlighting for operators in SourceKit-LSP.
2022-07-25 07:19:49 +02:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
John Fairhurst
677491fc9b [SourceKit] Add syntaxtype for #error/#warning (#14742) 2018-02-21 14:48:18 -08:00
Marcelo Fabri
94465a38c0 [SourceKit] Add GenericTypeParam to structure (SR-5474) (#13616) 2018-01-09 17:28:52 -08:00
Marcelo Fabri
b6ecf9c6d4 [SourceKit] Introduce "source.lang.swift.expr.closure" in structure (SR-6116) (#13617) 2018-01-04 10:45:29 -08:00
Marcelo Fabri
95383df793 [SourceKit] Introduce "source.lang.swift.expr.tuple" (SR-5977) (#12089) 2017-09-27 10:08:27 -07:00
Marcelo Fabri
8b9b49fdf3 [SourceKit] Add associatedtype to doc structure (SR-5700) 2017-08-16 23:40:36 +02:00
Marcelo Fabri
40b054b642 [SourceKit] Add local variables to structure (SR-5057) (#11431) 2017-08-11 13:43:05 -07:00
Rintaro Ishizaki
eb6914ccfc Merge pull request #11346 from rintaro/rip-cfor
Eliminate C-style ForStmt
2017-08-08 07:49:42 -07:00
Rintaro Ishizaki
b754b9e9b6 [IDE] Remove support for C-style ForStmt 2017-08-04 23:27:22 +09:00
Marcelo Fabri
d16cce3a94 [SourceKit] Add documentation range in structure (SR-2487) (#11264) 2017-08-02 13:39:49 -07:00
Marcelo Fabri
c4dad0c321 [SourceKit] Add subscript to doc structure (SR-5035) 2017-08-01 00:00:20 +02:00
John Fairhurst
1f94eca80c [SourceKit] Add typealias to doc structure (#11143)
From https://bugs.swift.org/browse/SR-4828
2017-07-26 09:59:06 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01: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
195c737b54 [libIDE] Add syntax kind of argument to fix a crash. rdar://27377118
Argument used to have the same syntax kind with that of parameter. This patch
starts to differentiate them.
2016-07-19 15:10:46 -07:00
practicalswift
a3f857ca7b [gardening] Add "-*- C++ -*-" to header files currently missing it 2016-01-23 11:53:05 +01:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Jordan Kay
008a42fd65 Fix misspellings 2015-12-03 14:28:54 -05:00
Dmitri Hrybenko
2e51d23875 Un-ifdef object literals
Swift SVN r32880
2015-10-25 07:50:53 +00:00
Jordan Rose
f5b1efb354 Move client-affecting configuration options into a generated Config.h.
This way they can be used from other projects, like LLDB. The downside
is we now have to make sure the header is included consistently in all
the places we care about, but I think in practice that won't be a problem,
especially not with tests.

rdar://problem/22240127

Swift SVN r31173
2015-08-12 17:50:13 +00:00
Jordan Rose
953424072e Guard "object literals" feature with SWIFT_ENABLE_OBJECT_LITERALS.
This is not a feature we're releasing at the moment, so provide a way
to turn it off.

rdar://problem/21935551

Swift SVN r30966
2015-08-04 00:16:52 +00:00
Chris Lattner
0001dc27bb remove support for the experiemental "character literals" feature.
Swift SVN r30509
2015-07-22 22:35:19 +00:00
David Farler
b0f87a059b Highlight documentation comments and some syntax
- Start highlighting doc comments as Xcode "Documentation Comments".
- Start highlighting custom top-level fields as Xcode "Documentation
Comment Keywords".

This requires SourceKit r28827 to build and Xcode
rdar://problem/21034381 for proper highlighting.

Swift SVN r28828
2015-05-20 09:08:13 +00:00
Maxwell Swadling
73700aab02 Added ObjectLiterals to the SyntaxMap
rdar://problem/20821831

Swift SVN r28787
2015-05-19 21:14:10 +00:00
Argyrios Kyrtzidis
7c69b077c7 [IDE] Add enum elements in the document structure.
rdar://18845613

Swift SVN r28618
2015-05-15 06:56:22 +00:00
Maxwell Swadling
d239d4434f Added IDE support for Object Literals Expressions
Fixes rdar://problem/20839100
Object Literal Expressions now show up in the Document structure.

Swift SVN r28332
2015-05-08 23:22:09 +00:00
Doug Gregor
b8995b0aa3 Transform the Module class into ModuleDecl.
Modules occupy a weird space in the AST now: they can be treated like
types (Swift.Int), which is captured by ModuleType. They can be
treated like values for disambiguation (Swift.print), which is
captured by ModuleExpr. And we jump through hoops in various places to
store "either a module or a decl".

Start cleaning this up by transforming Module into ModuleDecl, a
TypeDecl that's implicitly created to describe a module. Subsequent
changes will start folding away the special cases (ModuleExpr ->
DeclRefExpr, name lookup results stop having a separate Module case,
etc.).

Note that the Module -> ModuleDecl typedef is there to limit the
changes needed. Much of this patch is actually dealing with the fact
that Module used to have Ctx and Name public members that now need to
be accessed via getASTContext() and getName(), respectively.

Swift SVN r28284
2015-05-07 21:10:50 +00:00
Chris Lattner
37f5452d15 require -> guard.
Swift SVN r28223
2015-05-06 22:53:38 +00:00
Chris Lattner
0011b3ae21 rename "unless" to "require" and give it an 'else' keyword.
Swift SVN r28059
2015-05-02 00:16:44 +00:00
Chris Lattner
c6aa041fb9 Add parser/ast/sema/sourcekit/etc support for 'unless' statement.
SILGen support still missing.



Swift SVN r27961
2015-04-30 05:55:11 +00:00
Chris Willmore
c7c7388cf2 Change do-while to repeat-while.
Change all uses of "do { ... } while <cond>" to use "repeat" instead.
Rename DoWhileStmt to RepeatWhileStmt. Add diagnostic suggesting change
of 'do' to 'repeat' if a condition is found afterwards.

<rdar://problem/20336424> rename do/while loops to repeat/while & introduce "repeat <count> {}" loops

Swift SVN r27650
2015-04-23 22:48:31 +00:00
Argyrios Kyrtzidis
df04a93814 [IDE] Report the editor placeholders in the syntax model.
rdar://20572261

Swift SVN r27392
2015-04-17 01:01:25 +00:00
Argyrios Kyrtzidis
da2e6ad04a [IDE] Add array/dictionary literals in the document structure.
rdar:/19999295

Swift SVN r25874
2015-03-09 01:30:39 +00:00
Argyrios Kyrtzidis
8d4b0ed470 [IDE] Include control-flow statements in the syntax structure model.
rdar://19988592

Swift SVN r25868
2015-03-09 00:42:42 +00:00
Argyrios Kyrtzidis
865719c2b8 [IDE] Introduce SyntaxStructureElements which will provide more info about a syntactic structure.
Swift SVN r25866
2015-03-09 00:42:39 +00:00
Argyrios Kyrtzidis
f15d56b8aa [IDE] Mark the parens for string interpolation with a special syntax annotation.
Part of rdar://19655729

Swift SVN r24983
2015-02-05 00:53:57 +00:00
Argyrios Kyrtzidis
c41569c7a7 [IDE] Enhance SyntaxStructureKind with global/static/class variable nodes.
Swift SVN r24497
2015-01-18 03:47:26 +00:00
Sonny Falk
6b053e6252 [IDE] Add support for Swift extension declarations to the document substructure.
Add tests for struct, protocol and extension.
This addresses the first part of <rdar://problem/15818966>.

Swift SVN r19766
2014-07-10 00:23:00 +00:00
Argyrios Kyrtzidis
cff07de44e [IDE] Search for URLs in comments and report them in the syntax model.
Swift SVN r19424
2014-07-01 19:21:17 +00:00
Argyrios Kyrtzidis
e64821d268 [IDE] Search all comments for 'FIXME:', 'TODO:', 'MARK:' and report them in the syntax model.
Swift SVN r19423
2014-07-01 19:21:16 +00:00
Sonny Falk
7949d17021 [IDE] Provide call structure data and keyword arguments in document structure.
This will be used to highlight function calls and declarations for
QuickHelp and Jump-to-definition.
Add test for the above.
<rdar://problem/16862981>.

Swift SVN r17824
2014-05-10 02:54:55 +00:00
Argyrios Kyrtzidis
84ae58d7d7 [IDE] For the syntax structure walker report ParamDecls as well.
Swift SVN r17442
2014-05-05 15:14:32 +00:00
Argyrios Kyrtzidis
a0b97196f1 [IDE] Provide the declaration along with the SyntaxStructureNode.
Swift SVN r16504
2014-04-18 07:07:15 +00:00
Argyrios Kyrtzidis
b7a85f2af9 [IDE] Do syntax annotation for '#if' constructs.
Swift SVN r15447
2014-03-25 03:55:32 +00:00