Joe Groff
683ef3548b
Allow ';' in a top-level form.
...
Swift SVN r3338
2012-12-03 23:18:50 +00:00
Doug Gregor
2583f419c9
'protocol<' does not start a declaration. Test case coming in a future patch.
...
Swift SVN r2716
2012-08-23 00:26:17 +00:00
Chris Lattner
b6f6eec106
implement rdar://11935352 - accepting closures with no body expression (the closure
...
just returns "()").
Swift SVN r2503
2012-08-02 20:08:51 +00:00
Eli Friedman
6b4a248f04
Parsing and AST support for destructors on classes.
...
Swift SVN r2348
2012-07-12 01:26:02 +00:00
Chris Lattner
db0cd646fc
lexer/parser/ast/sema support for do/while statements. irgen next.
...
Swift SVN r2186
2012-06-17 02:29:54 +00:00
John McCall
8c46c69efa
Lexically distinguish prefix, postfix, and binary operators
...
and use this information as cues in the language. Right now,
we do not accept things like "-- *i" because the prefix
operator is not correctly right-bound; instead you have to
write "--(*i)". I'm okay with that; I did add a specialized
diagnostic recognizing operator-binary in a place where we're
expecting a potential operator-prefix.
Swift SVN r2161
2012-06-07 01:00:06 +00:00
Eli Friedman
75907029f1
Add parsing and semantic analysis for a basic ConstructorDecl. Still missing: no IRGen, and semantic analysis to actually call them.
...
Swift SVN r2159
2012-06-05 23:51:19 +00:00
Eli Friedman
27f8a5ab62
Teach the parser's handling of scopes to handle local types correctly.
...
Swift SVN r2138
2012-06-04 19:14:58 +00:00
Eli Friedman
c404598fcb
Parsing and semantic analysis for 'break' and 'continue'.
...
Swift SVN r2087
2012-05-31 00:55:33 +00:00
Eli Friedman
a5a39860cd
Basic parsing plus a bit more of the AST for ClassDecls.
...
Swift SVN r1860
2012-05-15 22:07:31 +00:00
Chris Lattner
46c94377f1
Add support for var decls in the initializer of a c-style for loop,
...
implementing rdar://11360347 / 11349750. C-style for loops could be
further enhanced by allowing a comma-separated list of statements in
the increment, but this isn't something I plan to do in the short term.
Swift SVN r1713
2012-05-02 05:44:58 +00:00
Chris Lattner
8c478d1cb7
remove the foreach keyword, switching foreach loops to use 'for' instead.
...
This uses one-token lookahead to distinguish between the two forms.
Swift SVN r1710
2012-05-02 01:06:06 +00:00
Chris Lattner
e205e1d2da
change the subset of for statements we support: instead of *requiring* parens,
...
now we *do not allow* them. This is progress towards unifying for and foreach.
Swift SVN r1709
2012-05-02 00:43:24 +00:00
Chris Lattner
54c7c6ea74
Add some helper functions to help treat "spaced" lparen and lsquares uniformly.
...
Swift SVN r1708
2012-05-02 00:30:45 +00:00
Chris Lattner
ab0c800e62
fix rdar://11344875, where we would reject "return;"
...
Swift SVN r1686
2012-04-30 03:52:04 +00:00
Eli Friedman
e33b1aac24
Don't try to synthesize an expression for a return statement which doesn't have one. <rdar://problem/11315114>.
...
Swift SVN r1639
2012-04-25 22:58:06 +00:00
Doug Gregor
f997a781bf
Parsing and basic AST representation for 'foreach' statement.
...
Swift SVN r1594
2012-04-24 18:12:44 +00:00
Chris Lattner
cbc1eac438
irgen parser and sema support for for statements.
...
Swift SVN r1505
2012-04-19 21:43:46 +00:00
Eli Friedman
d5e7784010
Get rid of isModuleScope bit, since we don't like scattering bits across the AST; as a replacement, introduce TopLevelCodeDecl, which provides a DeclContext for all expressions and statements at the top level. <rdar://problem/11259941>.
...
Swift SVN r1503
2012-04-19 21:22:12 +00:00
Chris Lattner
df74bc03c0
lang ref and parser support for for statements. AST and sema next.
...
Swift SVN r1493
2012-04-19 18:25:48 +00:00
Chris Lattner
44af5d13ef
refactor some code to expose a new expr-or-stmt-assign production.
...
Swift SVN r1492
2012-04-19 17:57:22 +00:00
Doug Gregor
6897b6ab44
Add support for parsing a subscripting declaration, e.g.,
...
subscript (i : Int) -> Double {
get { /* get ith element of something */ }
set { /* set ith element of something to value*/ }
}
Swift SVN r1476
2012-04-18 21:43:54 +00:00
John McCall
e6d56fd718
Require an unspaced [ to start a subscript or array-type suffix.
...
Per discussion, this should probably be "no newline since the last
token", but that decision should be made simultaneously for ( and [.
Swift SVN r1461
2012-04-18 08:08:58 +00:00
Eli Friedman
ecb0f2bba4
Add a little bit of missing error-checking for libraries.
...
Swift SVN r1455
2012-04-18 01:50:24 +00:00
Eli Friedman
cf10f0096e
Make the REPL allow mutually recursive functions spread across multiple lines, like we do in script mode.
...
Swift SVN r1453
2012-04-18 01:20:38 +00:00
Eli Friedman
37de44a35d
Implement changes to parsing/sema/etc so that we can implement a REPL and the main module parses the same way as a REPL.
...
Next step: implement an actual REPL.
Swift SVN r1441
2012-04-16 23:52:01 +00:00
Chris Lattner
fbfb76a515
rename 'plus' methods to 'static' methods, resolving:
...
<rdar://problem/10718220> Need a better name than 'plus' for "static" functions
Swift SVN r1340
2012-04-06 17:50:43 +00:00
Eli Friedman
f477cf588e
Introduce the notion of the "main" module, i.e. the module which defines main(). Disallow top-level statements in modules other than the main module. Fix IRGen to generate a main() function in the main module, and implement top-level statements. Get rid of the main() mangling hack. Part of <rdar://problem/11185451>.
...
I haven't really carefully considered whether existing type-checking etc. is correct for the main module (I think the name-binding rules need to be a bit different?), but it seems to work well enough for the obvious cases.
This is enough to get the one-liner "println(10)" to print "10" in "swift -i" mode, although the path to swift.swift still needs to be explicitly provided with -I.
Swift SVN r1325
2012-04-05 00:35:28 +00:00
Eli Friedman
862646c1dd
Perform conversion to bool in conditionals by repeatedly calling ".getLogicValue()" on the value until we reach Builtin.Int1, instead of using convertToLogicValue(). <rdar://problem/10100856>.
...
Swift SVN r1173
2012-03-10 00:02:36 +00:00
Chris Lattner
601e401dfa
document the forthcoming expr-anon-closure syntax, part of rdar://10666917
...
Swift SVN r1151
2012-03-02 01:30:18 +00:00
Chris Lattner
ce9d3c4398
remove Parser::isStartOfExpr, which is only used by one caller that can
...
be done in a simpler way.
Swift SVN r1150
2012-03-02 01:07:21 +00:00
Chris Lattner
58b4a5d7cc
have the parser produce ErrorStmt nodes to handle semantic errors...
...
except that it never produces semantic errors. How about that.
Swift SVN r1143
2012-03-01 22:54:41 +00:00
Chris Lattner
6692cba150
simplify expression parsing to return a NullablePtr<Expr> instead of a ParseError<Expr>.
...
The later could represent semantic errors, but we'd rather represent those with an
ExprError node instead. This simplifies the code and allows the parser to build a more
fully-formed AST that IDE clients will like.
Swift SVN r1141
2012-03-01 22:34:32 +00:00
Chris Lattner
17ea0a6670
finish my pass over LangRef, updating it and changing it and the parser to keep the grammars in sync.
...
Swift SVN r1132
2012-03-01 16:55:09 +00:00
John McCall
2b65cf22d1
Make 'this' implicitly [byref] when the container type does
...
not have reference semantics. Deciding whether the container
type has reference semantics requires us to perform
some amount of limited name-binding and type-checking first,
which introduces a few complexities.
Also, fix a bug in uncurried call emission.
Methods work now.
Swift SVN r1112
2012-02-11 07:37:57 +00:00
John McCall
d0f4d86f3e
Use LValueType everywhere instead of the l-value value kind.
...
Kill off TypeJudgement. Various fixes and improvements.
Swift SVN r1107
2012-02-06 22:47:08 +00:00
Chris Lattner
bab9ca384c
switch TupleExpr to use MutableArrayRef.
...
Swift SVN r1090
2012-01-19 06:54:43 +00:00
Chris Lattner
27f47dd705
eliminate the concept of a singular expression, which is obsolete and not in lang ref.
...
Swift SVN r1084
2012-01-18 23:59:04 +00:00
John McCall
59bed696a5
Introduce a ParenExpr to represent the special case of
...
a tuple with one element and no labels. This form is
treated specially in essentially every case, so it might
as well be its own expression kind.
Swift SVN r1021
2012-01-12 19:55:06 +00:00
Chris Lattner
17b11e9bbd
implement parsing, AST, and LangRef support for 'plus' methods. Dot syntax will need some work though to actually use them.
...
Swift SVN r949
2011-12-21 23:21:58 +00:00
Chris Lattner
eef2f69637
improve AST modeling of dot syntax calls to follow the syntactic structure instead of being weird and broken and losing source loc info.
...
Swift SVN r938
2011-12-15 00:52:58 +00:00
Chris Lattner
3d4111475e
fix a minor pasto.
...
Swift SVN r912
2011-12-07 00:10:42 +00:00
Chris Lattner
0b72409c9c
ensure that extension members get the proper function type, and a 'this' argument.
...
Swift SVN r908
2011-12-06 20:23:53 +00:00
Chris Lattner
8d53c9f3b9
restrict 'extension' to only exist at file scope.
...
Swift SVN r899
2011-12-06 00:11:13 +00:00
Doug Gregor
1ed6cdbb09
Fix broken source-range information for expressions of the form "x.y".
...
Swift SVN r861
2011-11-10 17:25:08 +00:00
Doug Gregor
0223f3edf1
Implement Expr::getSourceRange() and introduce proper support for this
...
function into all of the expression nodes. Re-implement
Expr::getStartLoc() in terms of this function, and add it's brother
Expr::getEndLoc(), removing the specialized implementations.
Clean up the source ranges of implicitly-created tuple expressions in
the process.
Swift SVN r855
2011-11-10 00:25:48 +00:00
Chris Lattner
9e783adda1
introduce and use a new parseMatchingToken method.
...
Swift SVN r841
2011-11-09 01:09:07 +00:00
Chris Lattner
f02dc055d3
introduce a form of parseToken that returns the location of the parsed token
...
on success, allowing simplifications in clients.
Swift SVN r840
2011-11-09 00:56:52 +00:00
Chris Lattner
ffa9a55002
implement skeleton of extension body parsing.
...
Swift SVN r839
2011-11-09 00:49:54 +00:00
Chris Lattner
0b9b982758
rework parseDecl to do validation itself, allow decls in oneof's
...
Swift SVN r837
2011-11-08 22:41:27 +00:00