Commit Graph

503 Commits

Author SHA1 Message Date
Chris Lattner
2653092ae5 Change the grammar for oneof elements to require a ':' make them more swift like and less ml like. Before we had:
oneof MaybeInt {
  None,
  Some int
}

Now we have:

oneof MaybeInt {
  None,
  Some : int
}

This resolves a fixme in the langref.

Swift SVN r214
2010-11-11 21:06:00 +00:00
Chris Lattner
906ba908fd Rename 'data' to 'oneof', resolving a fixme in the spec. Yay for CLU!
Swift SVN r212
2010-11-11 01:20:36 +00:00
Chris Lattner
2f0d96885a Move field exprs to their own section in langref. Document subscript exprs. Still no sema support.
Swift SVN r210
2010-10-18 06:34:46 +00:00
Chris Lattner
6f8dd4cf32 add parser support for array indexes
Swift SVN r209
2010-10-17 14:15:33 +00:00
Chris Lattner
f66d7a6faf Update langref for array types.
Swift SVN r208
2010-10-17 13:57:10 +00:00
Chris Lattner
fd54c7f5a0 add parser support for array types, no sema or ast yet.
Swift SVN r205
2010-10-15 11:54:34 +00:00
Chris Lattner
d6862a7e5f Fix decl-brace to not require ';'s
Swift SVN r204
2010-10-15 11:16:36 +00:00
Chris Lattner
154c0c6eb9 Resolve a fixme by eliminating the ; in func decls and making the grammar more restrictive.
Swift SVN r203
2010-10-15 11:07:49 +00:00
Chris Lattner
b9fbd77f58 Fix a bunch of minor bugs found through inspection:
1. Punctuation identifiers were missing some characters.
2. Some parser production and methods were misnamed.
3. Top level var decls don't need a ; after them.
4. Various parser comments were out of date.
5. We now allow any type in a struct decl, e.g. "struct foo int", even though it's weird.

Swift SVN r199
2010-10-12 07:24:33 +00:00
Chris Lattner
bb541a2f31 add a note.
Swift SVN r198
2010-10-11 21:18:15 +00:00
Chris Lattner
26e63c29ac rip out a bunch of special case parsing logic for function arguments now that tuples have a sane syntax.
Swift SVN r197
2010-10-11 21:05:07 +00:00
Chris Lattner
0fcf9a4199 Bertand finally beat some sense into me, convincing me that tuples with named elements are more important than tuples with anonymous elements.
This changes the grammar for tuple type elements to be:
 ///   type-tuple-element:
 ///     identifier? ':' type

instead of:
///   type-tuple-element:
///     type
///     '.' identifier ':' type


In practice this means that you don't have to use things like (.x : int, .y : int) you can just use (x :int, y:int) which is what we already have for function argument lists.


Swift SVN r196
2010-10-11 21:00:55 +00:00
Chris Lattner
e9db331fa0 Struct declarations also inject their name into the global scope, allowing them to be used unqualified.
Swift SVN r193
2010-10-10 06:45:11 +00:00
Chris Lattner
f92a3d56d7 Implement parser support for structs, improve datadecl dumping.
Swift SVN r192
2010-10-10 06:38:24 +00:00
Chris Lattner
272cbcaba3 Implement parser, ast and minimal sema support for :foo expressions, type resolution isn't done yet.
Swift SVN r185
2010-10-10 00:15:46 +00:00
Chris Lattner
ad438c55e3 Implement the rest of sema for scoped identifier references (X::Y) we now get a proper DeclRefExpr, and this:
var def = DataSearchFlags::None;

-ast-dump's into:

(vardecl 'def' type='DataSearchFlags'
 (declref_expr type='DataSearchFlags' decl=None))
 

Swift SVN r182
2010-10-09 23:46:16 +00:00
Chris Lattner
43f2d1dfa5 wire up parser and basic sema support for scoped identifier expressions (X::Y).
Swift SVN r180
2010-10-09 23:01:17 +00:00
Chris Lattner
09a023c3cd Now that we have simple user defined data types, remove the __builtin_else_hack type. woot.
Swift SVN r179
2010-10-09 22:06:13 +00:00
Chris Lattner
ac855b690b Move ActOnTypeAlias to SemaDecl since a type alias *is* a decl that *installs* a type. Add some fixme's and rename some junk in ASTContext relating to the typemap. Diagnose redefinitions of named types. Install a typemap entry when a data declaration is defined.
We can now declare variables to be of data type.

Swift SVN r178
2010-10-09 22:01:25 +00:00
Chris Lattner
a43a8f27f5 Wire data decls up to -ast-dump. Fix some minor bugs exposed along the way.
Swift SVN r175
2010-10-09 20:46:10 +00:00
Chris Lattner
57c697172a Split NamedDecl into NamedDecl with a ValueDecl subclass that has the type and value of the decl.
Swift SVN r173
2010-10-09 20:28:11 +00:00
Chris Lattner
3ea5878390 add scafolding for sema of datas.
Swift SVN r172
2010-10-09 19:33:50 +00:00
Chris Lattner
ecdc8da738 add parser support for type specifiers in data descriptors.
Swift SVN r171
2010-10-09 18:58:18 +00:00
Chris Lattner
17c36aa749 add parser support for simple data declarations
Swift SVN r170
2010-10-09 18:42:54 +00:00
Chris Lattner
19e5390b78 twinify more diagnostics.
Swift SVN r168
2010-10-09 17:50:40 +00:00
Chris Lattner
51b9de2931 update to build with llvm mainline (twinification of SourceMgr)
Swift SVN r167
2010-10-09 17:44:21 +00:00
Chris Lattner
91f5abd1e9 Implement parser support for assignment, what a hack :-)
Swift SVN r166
2010-09-18 17:26:01 +00:00
Chris Lattner
fb75d0cdf1 cleanup
Swift SVN r164
2010-09-04 19:26:34 +00:00
Chris Lattner
29503975d2 Enhance juxtaposition binding handling to handle binary operators and functions in a more fine-grained way, allowing if/else to work without braces.
Swift SVN r163
2010-09-04 19:25:56 +00:00
Chris Lattner
d2abfde434 introduce a new builtin type to represent the result of the else binary operator (which is a temporary hack until we get user defined types).
Use it to define ife/else.  Fix some precedence/parsing bugs that implementing else exposed. 

Swift SVN r162
2010-08-08 22:37:56 +00:00
Chris Lattner
45610c0ecc rework func argument parsing to be more consistent across ->'s.
Swift SVN r161
2010-08-08 21:36:26 +00:00
Chris Lattner
b927b55863 Finally get around to allowing *use* of a named incoming function argument. The first step is to set up a scope for them and walk the argument names, keeping track of access path info.
Swift SVN r158
2010-08-07 20:10:19 +00:00
Chris Lattner
025143611f implement support for tuple expressions with names specified for the elements.
Swift SVN r157
2010-08-07 06:51:12 +00:00
Chris Lattner
429ecb81da Finish ast and sema support for name binding elements of tuples in var decls.
Swift SVN r152
2010-08-05 22:22:22 +00:00
Chris Lattner
544f3fde60 Now that tuples aren't abusing ParseDeclVar, we can have ParseDeclVar insert the decl into the current scope, a prereq for more interesting names.
Swift SVN r151
2010-08-05 05:10:57 +00:00
Chris Lattner
bf63029ecd rework tuple element parsing to not use ParseDeclVar, since tuple elements are fundamentally different. While we're at it, switch to an arguably more natural syntax for field elements, naming them with .x : type instead of var x : type
Swift SVN r150
2010-08-05 05:03:55 +00:00
Chris Lattner
34a1beac31 inline ParseTypeOrDeclVar and ParseExprOrDeclVar into their single callers and simplify the code around them.
Swift SVN r149
2010-08-05 04:42:13 +00:00
Chris Lattner
43a526f1f5 a step towards parsing richer names. I need to do some refactoring of var parsing before going further.
Swift SVN r148
2010-08-05 04:28:32 +00:00
Chris Lattner
c1294622bf Cleanup type stuff.
Swift SVN r147
2010-08-04 06:35:54 +00:00
Chris Lattner
e1e335610f int is no longer a keyword, it is a type alias for the new __builtin_int32_type type.
Swift SVN r146
2010-08-04 05:27:45 +00:00
Chris Lattner
69133a6ed2 now that we have type aliases, eliminate void as a keyword.
Swift SVN r145
2010-08-04 05:16:37 +00:00
Chris Lattner
a8916a6106 implement semantic analysis and AST representation for AliasType (aka typedefs in C).
Swift SVN r144
2010-08-04 05:14:57 +00:00
Chris Lattner
8f86874c19 add parser support for typealiases, we have to be able to exercise the canonical type system somehow.
Swift SVN r143
2010-08-04 04:42:13 +00:00
Chris Lattner
86ce100404 clean up some parser logic.
Swift SVN r142
2010-08-04 03:38:45 +00:00
Chris Lattner
f704c58c42 Two significant changes:
1. Change the representation of TupleType to contain TupleTypeElt structs instead of PointerUnion<Type*, NameDecl*>
 2. Change type canonicalization to not strip field names off tuples, and change type conversion logic to use canonical types again.

Also adds some stuff to the todo list, destined to never be short.

Swift SVN r141
2010-08-04 03:35:53 +00:00
Chris Lattner
807a82cd3d Resolve a fixme involving precedence of juxtaposition.
Swift SVN r140
2010-08-04 00:34:27 +00:00
Chris Lattner
04f7a08621 add support for tuple field access with ".", e.g.:
var a : (int, var f : int, int);
  var b = a.field0+a.field1+a.f;

This also eliminates TupleConvertExpr.

Swift SVN r137
2010-08-03 06:55:08 +00:00
Chris Lattner
23cca34bae FIXME fixed!
Swift SVN r132
2010-08-03 04:06:56 +00:00
Chris Lattner
c6499fe1ed Fixme patrol, clean some up.
Swift SVN r131
2010-08-01 07:09:40 +00:00
Chris Lattner
08fead5f63 rework func scope insertion so that recursion works, next up: vars.
Swift SVN r127
2010-08-01 05:07:59 +00:00