Commit Graph

121 Commits

Author SHA1 Message Date
Dmitri Hrybenko
2e51d23875 Un-ifdef object literals
Swift SVN r32880
2015-10-25 07:50:53 +00:00
Dmitri Hrybenko
0b4a54f64c CMake: detect and refuse broken std::regex
Swift SVN r32256
2015-09-26 05:06:43 +00:00
Argyrios Kyrtzidis
012f6cb083 [IDE] Make sure to process the body of a defer statement properly.
Fixes IDE features (except code-completion) not working inside 'defer'.
rdar://22849414.

Swift SVN r32254
2015-09-26 00:50:39 +00:00
Xi Ge
7f6a8b1315 Remove the constructor of CharSourceRange that takes SourceRange;
And add a utility function at lexer that converts SourceRange to CharSourceRange.

Swift SVN r32023
2015-09-17 01:15:34 +00:00
Xi Ge
682e4320d8 [SyntaxModel] Adjust the end loc when converting from SourceRange to CharSourceRange. rdar://22676599
Swift SVN r32013
2015-09-16 21:58:53 +00:00
Xi Ge
3088128501 Refactor DenseMapInfo<ASTNode> to ASTNode.h
Swift SVN r31438
2015-08-24 22:25:24 +00:00
Xi Ge
a21010e8f7 [SyntaxColor] Teach syntax model walker not to walk into active regions inside #if config stmt twice. rdar://22224993
Swift SVN r31433
2015-08-24 18:28:08 +00:00
Xi Ge
f9a621e6f5 [SyntaxHighlight] Highlight #line as keyword. rdar://22163375
Swift SVN r31040
2015-08-06 01:34:25 +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
Xi Ge
da69adbb09 [SyntaxHighlighting] Fix a issue when detecting multiple urls exist in one line of commit.
Swift SVN r30682
2015-07-27 01:12:30 +00:00
Xi Ge
f51335ac65 [SyntaxHighlighting] Highlight platform keywords inside available attributes. rdar://21905215
Swift SVN r30681
2015-07-27 01:12:28 +00:00
Xi Ge
61ccc5f48e Move radar number out of source file.
Swift SVN r30546
2015-07-23 20:23:04 +00:00
Xi Ge
72df884348 [SyntaxColoring] Correct the node kind of attributes and comment on the special case.
Swift SVN r30544
2015-07-23 19:49:17 +00:00
Xi Ge
95dc5b5607 [SyntaxColoring] Address Jordan's comments.
Highlight all decl modifiers for enum element decls, not just "indirect", as keywords.

Swift SVN r30524
2015-07-23 02:24:43 +00:00
Xi Ge
d980700f17 [SyntaxColoring] Add syntax coloring to indirect keyword of enum element decl. rdar://21927124
Swift SVN r30521
2015-07-23 01:37:22 +00:00
Chris Lattner
0001dc27bb remove support for the experiemental "character literals" feature.
Swift SVN r30509
2015-07-22 22:35:19 +00:00
Xi Ge
2f3a77ab40 Address Ben's comments on r30290
Swift SVN r30325
2015-07-17 20:27:17 +00:00
Xi Ge
42ecad7903 [SyntaxModel] Improve the efficiency of url regex search.
We improve the efficiency through two ways: 1. read the protocol keywords, such as
http, radar, or im, to select the right regex pattern to search for instead of
trying every known patterns; and 2. reduce the regex search space by truncating
text before protocol keywords. rdar://21009781

Swift SVN r30290
2015-07-17 00:03:22 +00:00
Xi Ge
57489ceb0f [SyntaxHighlighting] Give ASTWalker the option to walk into generic params of function decls.
Therefore, generic params can also benefit from syntax highlighting and semantic annotation
in SourceKit. rdar://20529255

Swift SVN r30220
2015-07-15 18:28:09 +00:00
Xi Ge
29cebb8ac5 [SyntaxModel] Ensure syntax-coloring does not crash when the last token is a DeclAttribute.
This may happen to rethrows, rdar://21324493

Swift SVN r29472
2015-06-17 23:35:58 +00:00
David Farler
794d9ed84d Check both ends of doc comments before trimming
Doc comments assume a prefix of /** and a suffix of */
but if a user accidentally types /**/, SourceKit can crash and
bring down Xcode with certain timings. Check both ends of doc
comments before dropping characters.

rdar://problem/21105409

Swift SVN r29035
2015-05-26 18:25: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
Chris Lattner
d5ecef1d67 remove a pointless return type, silencing a warning.
Swift SVN r28539
2015-05-13 23:32:21 +00:00
Chris Lattner
8a7b3f414e Revise the parser and AST representation of #available to be part of StmtCondition
instead of being an expression.

To the user, this has a couple of behavior changes, stemming from its non-expression-likeness.
 - #available cannot be parenthesized anymore
 - #available is in its own clause, not used in a 'where' clause of if/let.

Also, the implementation in the compiler is simpler and fits the model better.  This
fixes:
<rdar://problem/20904820> Following a "let" condition with #available is incorrectly rejected



Swift SVN r28521
2015-05-13 19:00:40 +00:00
Doug Gregor
340e4d8f8a Simplify parsing and representation of extension declarations.
Now that we don't have generic parameter lists at arbitrary positions
within the extended type of an extension declaration, simplify the
representation of the extended type down to a TypeLoc along with a
(compiler-synthesized) generic parameter list.

On the parsing side, just parse a type for the extended type, rather
than having a special grammar. We still reject anything that is not a
nominal type (of course), but it's simpler just to call it a type.

As a drive-by, fix the crasher when extending a type with module
qualification, rdar://problem/20900870.

Swift SVN r28469
2015-05-12 16:26:13 +00:00
Maxwell Swadling
296f0c9075 Added BodyRange to DictionaryExpr and ObjectLiteralExpr
Swift SVN r28444
2015-05-11 22:43:32 +00:00
Maxwell Swadling
e8c57296b9 Fixed missing body length in Array literals
Fixes rdar://problem/20866939

Swift SVN r28345
2015-05-08 23:59:36 +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
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
7c5f1e8c1d [IDE] Make sure we don't leave structure nodes without pop'ing them.
rdar://20457518

Swift SVN r27119
2015-04-08 05:03:08 +00:00
Devin Coughlin
8b5f6fec60 Rename '#os' to '#available'
The API review list found it confusing that if #os() and #if os() looked so similar, so
change the availability checking query to be spelled #available:

if #available(iOS >= 9.0, *) {
  ...
}

Swift SVN r26995
2015-04-04 23:33:13 +00:00
Xi Ge
b0b578dc6b [SyntaxColoring] Address Argyrios' comments on r26188
Swift SVN r26269
2015-03-18 18:53:33 +00:00
Chris Lattner
59c22383fb Rework PatternBindingDecl to maintain a list of pattern/initexpr pairs inside of it.
Previously, a multi-pattern var/let decl like:
  var x = 4, y = 17

would produce two pattern binding decls (one for x=4 one for y=17).  This is convenient
in some ways, but is bad for source reproducibility from the ASTs (see, e.g. the improvements
in test/IDE/structure.swift and test/decl/inherit/initializer.swift).

The hardest part of this change was to get parseDeclVar to set up the AST in a way
compatible with our existing assumptions. I ended up with an approach that forms PBDs in 
more erroneous cases than before.  One downside of this is that we now produce a spurious
  "type annotation missing in pattern"
diagnostic in some cases.  I'll take care of that in a follow-on patch.





Swift SVN r26224
2015-03-17 16:14:18 +00:00
Xi Ge
9cdffd2b28 [SyntaxColoring] Highlight specifier words in infix operator decls.
When used inside infix operator decls, associativity, precedence and
assignment are highlighted as keywords.

rdar://18833967

Swift SVN r26188
2015-03-16 20:02:44 +00:00
Chris Lattner
01f3e81aa5 Work on VarDecl:
- Rename getParentPattern() -> getParentPatternBinding(), since
   it returns the pattern binding, not the pattern.
 - Introduce new getParentPattern()/getParentInitializer() methods,
   covering the most common uses of getParentPatternBinding().

NFC.



Swift SVN r26175
2015-03-16 01:54:20 +00:00
Xi Ge
405936e0fc [SyntaxColoring] Address Argyrios' comments
Swift SVN r26035
2015-03-12 07:17:41 +00:00
Xi Ge
6d92cf022c [SyntaxColoring] Highlight platform names.
When used in an availability checking, platform names, such as iOS and OSX,
 are highlighted as keywords.

Swift SVN r26028
2015-03-12 03:29:47 +00:00
Argyrios Kyrtzidis
f55a15066e [IDE] Avoid adding ErrorExprs to the document structure model.
Swift SVN r25895
2015-03-09 23:02:54 +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
f0cab99961 [IDE] Simplify ModelASTWalker::walkTo*Post() functions.
Swift SVN r25867
2015-03-09 00:42:40 +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