Commit Graph

18 Commits

Author SHA1 Message Date
Chris Lattner
0001dc27bb remove support for the experiemental "character literals" feature.
Swift SVN r30509
2015-07-22 22:35:19 +00:00
Argyrios Kyrtzidis
a935e7c13e [Lexer] Recognize editor placeholders as identifiers and provide a specific error when encountered.
Swift SVN r26212
2015-03-17 01:52:59 +00:00
Dmitri Hrybenko
4d0a6d7db8 Update unittests for LLVM API changes in MemoryBuffer
Swift SVN r21411
2014-08-22 08:46:53 +00:00
Ted Kremenek
7da31bdfdd Disable parsing of single quoted character literals, enabling under a flag.
I didn't want to rip this logic out wholesale.  There is a possibility
the character lexing can be reborn/revisited later, and
disabling it in the parser was easy.

Swift SVN r18102
2014-05-15 07:05:59 +00:00
Dmitri Hrybenko
65cf5f2098 Lexer: compute ArtificialEOF correctly in a sublexer of a sublexer
This fixes code completion crash in rdar://15561934, but there are still no
code completion results in interpolated string literals.


Swift SVN r14539
2014-02-28 23:03:06 +00:00
Dmitri Hrybenko
d681b81641 Revert my r14516, it breaks the buildbot
Swift SVN r14518
2014-02-28 15:28:39 +00:00
Dmitri Hrybenko
3bb9166405 Lexer: don't advance current pointer past end of the source buffer in case
there is a string literal with embedded NUL just before EOF

This used to crash, rdar://15561934


Swift SVN r14516
2014-02-28 14:28:25 +00:00
John McCall
10ac15ed0d Lex $notAllDigits as an identifier and diagnose it in the lexer
outside of debugger-support mode.  Rip out the existing special-case
code when parsing expr-identifier.

This means that the Lexer needs a LangOptions.  Doug and I
talked about just adding that as a field of SourceMgr, but
decided that it was worth it to preserve the possibility of
parsing different dialects in different source files.

By design, the lexer doesn't tokenize fundamentally differently
in different language modes; it might decide something is invalid,
or it might (eventually) use a different token kind for the
same consumed text, but we don't want it deciding to consume more or
less of the stream per token.

Note that SIL mode does make that kind of difference, and that
arguably means that various APIs for tokenizing need to take a
"is SIL mode" flag, but we're getting away with it because we
just don't really care about fidelity of SIL source files.

rdar://14899000

Swift SVN r13896
2014-02-14 01:54:17 +00:00
Argyrios Kyrtzidis
44d46de7c9 Use swift::SourceManager's addNewSourceBuffer() instead of llvm::SourceMgr's AddNewSourceBuffer().
Also remove the SourceLoc parameter from addNewSourceBuffer(). In llvm::SourceMgr
it is used to indicate textual inclusion, which we don't have in swift.

Swift SVN r10014
2013-11-07 00:51:56 +00:00
Argyrios Kyrtzidis
5db368ce7b [Lexer] Introduce Lexer::getLocForStartOfToken() that returns the location at the start of the token that a given offset points to.
Swift SVN r8281
2013-09-16 18:41:16 +00:00
Dmitri Hrybenko
8a8b97985b Lexer: fix a bug where restoring lexer state could produce duplicate
code_complete tokens


Swift SVN r7636
2013-08-27 22:34:29 +00:00
Dmitri Hrybenko
dc439adb59 Lexer: improve recovery for invalid character literals and invalid escape
sequences in charater literals

Now we return tok::character_literal with REPLACEMENT CHARACTER U+FFFD instead
of tok::unknown.


Swift SVN r7475
2013-08-22 20:56:47 +00:00
Argyrios Kyrtzidis
4908da8361 [Lexer] Remove the public Lexer constructor that accepts a StringRef.
Replace uses of it with the newly introduced constructor that accepts a buffer ID.
The StringRef constructor was rather unsafe since it had the implicit requirement that the StringRef
was null-terminated.

Swift SVN r6942
2013-08-06 14:59:03 +00:00
Dmitri Hrybenko
e1c4ae3174 Wrap llvm::SourceMgr in swift::SourceManager so that we can add new members
to the source manager.


Swift SVN r6815
2013-08-01 20:39:22 +00:00
Dmitri Hrybenko
68bba56cec Lexer tests: simplify helper function: no need to pass down a SourceMgr
Swift SVN r6810
2013-08-01 18:39:20 +00:00
Dmitri Hrybenko
72ae1fd842 swift::tokenize: don't include tok::eof, per feedback from Argyrios
Swift SVN r6716
2013-07-29 22:23:31 +00:00
Dmitri Hrybenko
464df1cc11 Lexer: make tok::eof length equal to 0
It used to be equal to 1, which makes Lexer::getLocForEndOfToken() return
an out-of-bounds location for tok::eof.


Swift SVN r6626
2013-07-26 00:14:09 +00:00
Argyrios Kyrtzidis
6e7d0490f7 Allow optionally to produce comment tokens when lexing and add a tokenize() utility function.
Swift SVN r6008
2013-07-05 15:02:42 +00:00