Chris Lattner
c78bdcff0e
Initial lexer support for string literals. The regex is trivial and will be extended in the future.
...
Swift SVN r1348
2012-04-10 00:38:13 +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
John McCall
b8b1694564
Complain about file names that aren't valid identifiers.
...
When we divide the world into scripts and modules, this
won't matter for the former. Recognize <stdin> as a
special case; it should instead just always be a script.
Fixes rdar://problem/10986311.
Swift SVN r1181
2012-03-11 09:15:17 +00:00
Eli Friedman
eada7c6558
Make sure we catch 0x/0o/0b which isn't followed by an appropriate digit. Per Chris's comment.
...
Swift SVN r1174
2012-03-10 00:12:43 +00:00
Eli Friedman
6c439ec301
Add grammar for hex/octal/binary literals. Not completely sure this is the grammar we want (how do we want to handle 0b1a?), but it appears to work. Sema already handles hex and binary; still needs a bit of hacking for octal. <rdar://problem/10700832>
...
Swift SVN r1170
2012-03-07 04:01:05 +00:00
Chris Lattner
21c8b4dae9
implement a more-sane floating point literal syntax, adding support for
...
exponents. This resolves rdar://10877508
Swift SVN r1140
2012-03-01 21:42:10 +00:00
Chris Lattner
1076367d73
implement rdar://10962528 - split up the int/fp literal lexing and grammar.
...
This cleans up handling of int/fp literals by splitting them appart at the
lexer level.
Swift SVN r1137
2012-03-01 19:06:55 +00:00
Chris Lattner
578686379d
start updating some dox.
...
Swift SVN r1082
2012-01-18 22:58:18 +00:00
Chris Lattner
f1db6de509
remove the :: token and DCE UnresolvedScopedIdentifierExpr.
...
Swift SVN r1043
2012-01-14 07:00:45 +00:00
Chris Lattner
378f91b07f
add lexer support for the new & terrible 'plus' keyword.
...
Swift SVN r946
2011-12-21 22:17:14 +00:00
Doug Gregor
b1c98e1731
Introduce Lexer::getLocForEndOfToken() to adjust source locations to
...
the end of the current token, and use it for proper translation from
SourceRange to SMRange when printing diagnostics.
Swift SVN r853
2011-11-09 22:03:30 +00:00
Doug Gregor
fc183b9cc3
Decouple the lexer from the ASTContext and specific BufferID. They
...
aren't needed for the lexer proper (which just needs a buffer to dig
through). Also, make it possible to suppress lexer diagnostics merely
by not giving it a diagnostic engine to work with.
Swift SVN r852
2011-11-09 21:49:40 +00:00
Doug Gregor
d0dd4d44bc
Surface the Token and Lexer headers as public headers, since we're
...
going to need to be able to use the lexer from the 'swift' tool itself.
Swift SVN r851
2011-11-09 21:09:49 +00:00
Doug Gregor
cd7a21de83
Introduce support for adding source ranges to diagnostics.
...
We don't yet properly perform the SourceRange -> llvm::SMRange mapping.
Swift SVN r847
2011-11-09 17:53:30 +00:00
Chris Lattner
5c7c1416c1
Sketch out a LangRef description of extensions, and add
...
lexer support for them.
Swift SVN r838
2011-11-08 23:17:58 +00:00
Chris Lattner
9298082ebb
move Diagnostics header to include/swift/AST to match .cpp files.
...
Swift SVN r782
2011-10-22 00:47:35 +00:00
Chris Lattner
dfd529ce3a
rename diags::foo to diag::foo
...
Swift SVN r779
2011-10-22 00:36:19 +00:00
Chris Lattner
2092ddeb54
switch the lexer over to the new diagnostics subsystem. Drop the
...
"no newline at the end of // comment" warning, swift doesn't require
a \n at the end of file.
Swift SVN r770
2011-10-20 21:52:16 +00:00
Chris Lattner
a7c7d64fa0
Switch swift to use SourceLoc instead of SMLoc.
...
Also use the new getAdvancedLoc() method instead of hacking
on SMLoc directly.
Also fix the warning/note/error methods to forward through ASTContext
instead of being replicated everywhere.
Swift SVN r750
2011-10-18 01:22:29 +00:00
Chris Lattner
2d43b8812f
update for mainline API changes.
...
Swift SVN r745
2011-10-16 06:17:27 +00:00
John McCall
c61c807589
Mangle types for all declarations. Save the names of modules and mangle
...
those in, too.
Swift SVN r713
2011-09-18 09:21:42 +00:00
Chris Lattner
9d240a1d18
add lexer and langref support for floating point literals. No AST/CodeGen support yet.
...
Swift SVN r706
2011-09-15 21:29:12 +00:00
John McCall
1e89b0e274
Remove the __builtin type keywords and make the Builtin
...
module export those types.
Also, document the language changes I've been making in this area.
Swift SVN r688
2011-09-04 07:34:01 +00:00
John McCall
6dfa91282d
'float' -> 'float32', 'double' -> 'float64'
...
Swift SVN r654
2011-08-31 19:57:52 +00:00
Chris Lattner
f9b024adb0
implement parser and AST support for trivial (empty) protocol types.
...
Swift SVN r652
2011-08-31 19:43:06 +00:00
John McCall
58b81c8da0
Add builtin float and double types.
...
Swift SVN r650
2011-08-31 18:43:22 +00:00
Chris Lattner
f03486e991
diagnose a bunch of problem cases with operators.
...
Swift SVN r575
2011-08-20 01:29:00 +00:00
Chris Lattner
26f66a8b24
move all the parser headers into lib/Parse since they are now all private.
...
I chose to just delete the -lex action in swift, since it was only useful for
about 10 minutes during bringup and probably never will be again.
Swift SVN r557
2011-08-13 22:51:04 +00:00
Chris Lattner
b8fd157450
rip out the dead "isPrecededByIdentifier" logic from the AST and Lexer.
...
Swift SVN r529
2011-08-12 21:36:25 +00:00
Chris Lattner
c81d4c3c17
lets use isspace here, this gives us \f for free! woo
...
Swift SVN r511
2011-08-12 04:53:00 +00:00
John McCall
4eb22011b6
Make the lexer just determine whether an LP is spaced or not; the
...
parser can consume this as appropriate. For now it isn't, but that
will change.
Swift SVN r509
2011-08-12 02:12:48 +00:00
Chris Lattner
36f5427de3
Make the lexer disambiguate between a ( that is the start of an expression and a ( that is the start of
...
a call argument list.
Swift SVN r508
2011-08-12 01:46:39 +00:00
Chris Lattner
0871b128f8
add support for /**/ comments to the lexer, allow nesting of them since we won't
...
have the #if 0 hack to handle nesting.
Swift SVN r506
2011-08-12 00:37:01 +00:00
Chris Lattner
9e6817b3cd
implement lexer, parser, and dox support for while loops, everything is hooked up now.
...
Swift SVN r502
2011-08-11 20:47:33 +00:00
John McCall
944183d985
Split tok::oper out of tok::identifier. No functionality change.
...
The consumeToken(Tok.getKind()) is terrible, but will disappear when
most of these cases have operators stripped out.
Swift SVN r500
2011-08-11 06:17:31 +00:00
Chris Lattner
39660b5017
add langref and lexer support for return stmt.
...
Swift SVN r492
2011-08-03 22:43:57 +00:00
Chris Lattner
a64c74ec94
Replace lambda keyword with func. One annoying aspect of this that I didn't
...
think about will occur when/if we want to support attributes on func expression.
That should look like "func [attributes]{ ... }" but now that requires looking
beyond that attributes to know if this is a funcdecl or funcexpr. Nothing that
more heroic lookahead can't handle.
Swift SVN r486
2011-08-03 00:28:11 +00:00
Chris Lattner
fdc2dcc7db
rename lexer methods to follow the naming convention and add the ability to lookahead one token.
...
Swift SVN r483
2011-08-03 00:07:43 +00:00
Chris Lattner
c3bbefcbaa
add support for lambda expressions (anonymous functions), which are the thing that
...
func is sugar for. Unfortunately, we can't use 'func' without introducing ambiguity
since decls and exprs can exist in the same context, I'm not wed to 'lambda' as the
keyword, thoughts welcome.
Swift SVN r467
2011-07-31 20:12:20 +00:00
Chris Lattner
0fc77abf5c
Per discussion on swift-dev, unify 'meth' and 'func' syntax into just 'func' syntax
...
where you can optionally declare a receiver type. This is cleaner both conceptually
and in implementation, and eliminates drug references. :)
Swift SVN r444
2011-07-24 20:11:35 +00:00
Chris Lattner
6fbe70dd87
convert TokenKind to a scoped enum, eliminating the old c++'98 hackaround to
...
emulate it.
Swift SVN r442
2011-07-24 19:28:36 +00:00
Chris Lattner
7275ca527a
pull in StringRef and Twine.
...
Swift SVN r422
2011-07-19 06:00:20 +00:00
Chris Lattner
e647b29339
stop the llvm-namespace-qualification-insanity by caving in and
...
adding a new swift/AST/LLVM.h file which forward declares and imports
common llvm classes, starting with SMLoc.
Swift SVN r420
2011-07-19 05:49:43 +00:00
Chris Lattner
504ee85c0e
introduce a 'meth' keyword.
...
Swift SVN r414
2011-07-19 04:19:40 +00:00
Chris Lattner
b9e7823656
Implement lexing and parsing support for a proper if expression. There
...
is no AST building or typechecking support yet. Document the intended
semantics in LangRef. This is clearly subject to change, but is a starting
point.
Swift SVN r393
2011-06-05 02:03:48 +00:00
Chris Lattner
de094d7cde
Introduce i1/i8/i16/i64 types, and switch int to be 64-bit.
...
Swift SVN r390
2011-05-31 03:48:36 +00:00
Chris Lattner
7530ec988c
Add a error to reject foo() when foo is not a function type. Previously we allowed it because these are two valid top-level values, but we now reject them because they are almost certainly a bug. This can be disabled by putting a space between them if this is useful for some reason.
...
Swift SVN r339
2011-03-27 02:56:47 +00:00
Chris Lattner
d23c2f26f3
Document and implement lexer and parser support for trivial import decls. No Sema/AST support yet.
...
Swift SVN r285
2011-03-18 22:52:48 +00:00
Chris Lattner
b3e5c55fbc
Change the parser methods to lower case to follow naming conventions.
...
Swift SVN r256
2011-03-06 23:28:17 +00:00
Chris Lattner
272d9e8dad
Propagate "there were errors in the input" out to the exit code of the swift app by adding a "HadError" bool to ASTContext.
...
Swift SVN r244
2011-03-01 07:59:53 +00:00