Doug Gregor
35e6e56595
When we split a token starting with '<' or '>', make sure that the
...
resulting token goes back through the lexer to get the appropriate
token kind. Thanks to Chris for spotting this.
Also, document the '<' and '>' splitting behavior in LangRef.
Swift SVN r2192
2012-06-18 16:40:59 +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
Chris Lattner
22300ed57f
improve diagnostic for a " in the middle of an interpolated string, including a range:
...
t.swift:4:19: error: unexpected '"' character in string interpolation
"Hello \(x+1 world"
~~~~~~~~~~^
Swift SVN r1759
2012-05-05 23:12:07 +00:00
Chris Lattner
024e592beb
Now that the parser's lexer can be changed, just change it, instead of mutating the lexer,
...
simplifying things a bit.
Swift SVN r1741
2012-05-04 06:16:29 +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
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
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
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
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
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
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
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
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
23759c8624
rename Lex -> lex too.
...
Swift SVN r484
2011-08-03 00:08:21 +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
6f7c702321
disable copy and assignment of various types, and plain 'operator new' of others
...
using the new '0x way.
Swift SVN r443
2011-07-24 19:33:27 +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
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
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
Chris Lattner
3bd8a85784
Fix weirdness in the lang spec by making $123 be a special type of implementation identifier token, handling it uniformly in the grammar in the few places that it is valid.
...
Swift SVN r215
2010-11-11 22:27:39 +00:00
Chris Lattner
19e5390b78
twinify more diagnostics.
...
Swift SVN r168
2010-10-09 17:50:40 +00:00
Chris Lattner
47afc23bac
Expand lexer to cover a broader range of punctuators for function names. Add comparison functions to standard prolog.
...
Swift SVN r128
2010-08-01 05:58:41 +00:00
Chris Lattner
05f5028b7a
stub out a parser hook.
...
Swift SVN r13
2010-07-18 20:17:04 +00:00
Chris Lattner
3cd9e46705
add numeric constant support, we can now lex exciting stuff
...
like this:
// Comment.
var x : int;
var x2 = 4;
var x3 = 4+5;
Swift SVN r11
2010-07-18 19:01:18 +00:00
Chris Lattner
6236deaabc
implement lexer support for identifiers and our 2 keywords so far.
...
Swift SVN r10
2010-07-18 18:57:12 +00:00
Chris Lattner
80ba9c7e66
add some more punctuator characters and // comments.
...
Swift SVN r9
2010-07-18 01:44:13 +00:00
Chris Lattner
461f41edb1
start lexing trivial tokens, discard whitespace between them.
...
Swift SVN r8
2010-07-18 01:32:14 +00:00
Chris Lattner
db8e1301ff
Start setting up the lexer object.
...
Swift SVN r7
2010-07-18 01:14:09 +00:00
Chris Lattner
874badb51b
consolidate lexer stuff into the Parser lib.
...
Swift SVN r6
2010-07-18 00:50:29 +00:00