Chris Lattner
e5108826c2
change the interface to skipToEndOfInterpolatedExpression to return the
...
interesting character on failure as well as on success. Simplify the
code in Lexer::getEncodedStringLiteral since it cannot be called on a
string with an malformed interpolated expression.
Swift SVN r1758
2012-05-05 22:56:40 +00:00
Chris Lattner
822c7a2689
remove a hack that isn't needed now that we pre-lex the tokens in an interpolated string literal, thanks doug.
...
Swift SVN r1757
2012-05-05 22:44:14 +00:00
Chris Lattner
2f44c0038c
Initial stab at implementing string literal interpolation for simple expressions,
...
e.g. "foo is \(i+j)". This implements rdar://11223686
Doug implemented all the hard parts of this. I ripped out support for nested string
literals (i.e. string literals within an interpolated string), which simplified the
approach and defined away some problems with his patch in progress. I plan a few refinements
on top of this basic patch.
Swift SVN r1738
2012-05-04 05:53:50 +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
aa069a90cc
fix error recovery to not crash: the lexer should always return a token even in an erroneous token.
...
Swift SVN r1676
2012-04-27 06:34:45 +00:00
Chris Lattner
615ca4a360
implement the rest of character literal support, and enhance Char to be character literal
...
compatible. This wraps up rdar://11305635, though some cleanup of the testsuite can now be done.
Swift SVN r1672
2012-04-27 06:18:30 +00:00
Chris Lattner
c7e68a4a8b
langref and lexer support for character literals.
...
Swift SVN r1671
2012-04-27 05:51:30 +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
df74bc03c0
lang ref and parser support for for statements. AST and sema next.
...
Swift SVN r1493
2012-04-19 18:25:48 +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
71157c65d5
Add parsing support, but no type-checking or IR-generation,
...
for new expressions.
Swift SVN r1466
2012-04-18 08:09:18 +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
9009d294d2
More strictly special-case '..'; making '-.' etc. an operator would be a complete disaster.
...
Swift SVN r1444
2012-04-17 00:34:25 +00:00
Eli Friedman
6a001efbbb
Make "..", "*^.^*", etc. into overloadable operators. Make 1..10 construct a Range.
...
This has the side-effect that you can't explicitly refer to an operator* with "swift.*", etc., but per discussion with Doug, that's probably okay.
Swift SVN r1443
2012-04-17 00:21:38 +00:00
Chris Lattner
cc421b20c1
allow ~ as the first character of an operator.
...
Swift SVN r1413
2012-04-13 05:57:48 +00:00
Chris Lattner
8a7c6f7258
Eli points out that 4 is the max length. apparently I can't handle this. Thanks Eli! :)
...
Swift SVN r1406
2012-04-12 23:21:54 +00:00
Chris Lattner
b01c3bd989
We need to eventually add unicode identifier support, but it is beyond the scope of
...
what I intend to do right now.
Swift SVN r1405
2012-04-12 23:14:48 +00:00
Chris Lattner
09e051ce99
reject invalid UTF8 characters in comments.
...
Swift SVN r1403
2012-04-12 21:58:30 +00:00
Chris Lattner
d19939ead3
rearrange file a bit, no functionality change.
...
Swift SVN r1402
2012-04-12 21:51:55 +00:00
Chris Lattner
c92cf52358
since we allow utf8 source files, start validating utf8 characters in string literals
...
and test that they continue to work. Part of rdar://11220029
Swift SVN r1401
2012-04-12 21:47:12 +00:00
Chris Lattner
2e3c720e46
fix regex's for floating_literal because "0" is an integer literal not floating.
...
Swift SVN r1396
2012-04-11 22:22:27 +00:00
Chris Lattner
9b2c6acd37
improve comment with some justification.
...
Swift SVN r1374
2012-04-10 23:54:59 +00:00
Chris Lattner
ac61437b8b
by popular demand, reject over-large codepoints.
...
Swift SVN r1371
2012-04-10 23:52:06 +00:00
Chris Lattner
cac963c6d6
reject unicode encodings for surrogate pairs, and reject \x80 and above.
...
This completes unicode validation for \x, \u, and \U.
Swift SVN r1369
2012-04-10 23:26:46 +00:00
Chris Lattner
4ff016d0a8
start diagnosing invalid UTF encodings, more to follow.
...
Swift SVN r1365
2012-04-10 22:02:57 +00:00
Chris Lattner
2b1bcdcdf6
Implement basic encoding to UTF8, giving us the snowman. Codepoint validation comes next.
...
Swift SVN r1364
2012-04-10 21:50:28 +00:00
Chris Lattner
ce7403dd1e
implement IRGen of escapes. High unicode escapes aren't handled yet, but all the
...
basics are.
Swift SVN r1363
2012-04-10 20:59:45 +00:00
Chris Lattner
1bb2443498
document and lex the basic and unicode escape characters.
...
IRGen after lunch.
Swift SVN r1361
2012-04-10 19:30:18 +00:00
Chris Lattner
e31361f174
Progress towards rdar://11216049 - Strings cannot span multiple lines, and \ is an
...
escape character (not yet implemented).
Swift SVN r1360
2012-04-10 18:14:27 +00:00
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