Revert "Preserve whitespace and comments during lexing as Trivia"

This reverts commit d6e2b58382.
This commit is contained in:
David Farler
2016-11-18 12:22:53 -08:00
parent 44f15558d6
commit f450f0ccdf
56 changed files with 1048 additions and 1816 deletions

View File

@@ -26,7 +26,6 @@
#include "swift/Parse/PersistentParserState.h"
#include "swift/SIL/SILModule.h"
#include "swift/SILOptimizer/PassManager/Passes.h"
#include "swift/Syntax/Token.h"
#include "llvm/ExecutionEngine/MCJIT.h"
#include "llvm/IR/Module.h"
#include "llvm/Transforms/Utils/Cloning.h"
@@ -1015,7 +1014,8 @@ public:
CI.getSourceMgr().addMemBufferCopy(Line, "<REPL Input>");
Lexer L(CI.getASTContext().LangOpts,
CI.getSourceMgr(), BufferID, nullptr, false /*not SIL*/);
auto Tok = L.lex();
Token Tok;
L.lex(Tok);
assert(Tok.is(tok::colon));
if (L.peekNextToken().getText() == "help") {
@@ -1049,8 +1049,8 @@ public:
L.peekNextToken().getText() == "print_decl") {
PrintOrDump doPrint = (L.peekNextToken().getText() == "print_decl")
? PrintOrDump::Print : PrintOrDump::Dump;
Tok = L.lex();
Tok = L.lex();
L.lex(Tok);
L.lex(Tok);
ASTContext &ctx = CI.getASTContext();
UnqualifiedLookup lookup(ctx.getIdentifier(Tok.getText()),
&REPLInputFile, nullptr);
@@ -1078,18 +1078,18 @@ public:
} else if (L.peekNextToken().getText() == "dump_source") {
llvm::errs() << DumpSource;
} else if (L.peekNextToken().getText() == "print_module") {
Tok = L.lex();
L.lex(Tok);
SmallVector<ImportDecl::AccessPathElement, 4> accessPath;
ASTContext &ctx = CI.getASTContext();
Tok = L.lex();
L.lex(Tok);
if (Tok.is(tok::identifier)) {
accessPath.push_back({ctx.getIdentifier(Tok.getText()),
Tok.getLoc()});
while (L.peekNextToken().is(tok::period)) {
Tok = L.lex();
Tok = L.lex();
L.lex(Tok);
L.lex(Tok);
if (Tok.is(tok::identifier)) {
accessPath.push_back({ctx.getIdentifier(Tok.getText()),
Tok.getLoc()});
@@ -1118,10 +1118,10 @@ public:
}
} else if (L.peekNextToken().getText() == "constraints") {
Tok = L.lex();
Tok = L.lex();
L.lex(Tok);
L.lex(Tok);
if (Tok.getText() == "debug") {
Tok = L.lex();
L.lex(Tok);
if (Tok.getText() == "on") {
CI.getASTContext().LangOpts.DebugConstraintSolver = true;
} else if (Tok.getText() == "off") {
@@ -1133,8 +1133,8 @@ public:
llvm::outs() << "Unknown :constraints command; try :help\n";
}
} else if (L.peekNextToken().getText() == "autoindent") {
Tok = L.lex();
Tok = L.lex();
L.lex(Tok);
L.lex(Tok);
if (Tok.getText() == "on") {
Input.Autoindent = true;
} else if (Tok.getText() == "off") {