New line shouldn't be the first token
This commit is contained in:
@@ -24,6 +24,10 @@ vector<shared_ptr<Token>> Lexer::getTokens() {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't add new line as the first token
|
||||||
|
if (tokens.empty() && token->isOfKind({TokenKind::NEW_LINE}))
|
||||||
|
continue;
|
||||||
|
|
||||||
// Insert an additional new line just before end
|
// Insert an additional new line just before end
|
||||||
if (token->getKind() == TokenKind::END && tokens.back()->getKind() != TokenKind::NEW_LINE)
|
if (token->getKind() == TokenKind::END && tokens.back()->getKind() != TokenKind::NEW_LINE)
|
||||||
tokens.push_back(make_shared<Token>(TokenKind::NEW_LINE, "\n", token->getLine(), token->getColumn()));
|
tokens.push_back(make_shared<Token>(TokenKind::NEW_LINE, "\n", token->getLine(), token->getColumn()));
|
||||||
|
|||||||
@@ -74,14 +74,14 @@ int main(int argc, char **argv) {
|
|||||||
cout << endl << endl;
|
cout << endl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ModuleBuilder moduleBuilder(moduleName, inputFilePath, statements);
|
ModuleBuilder moduleBuilder(moduleName, inputFilePath, statements);
|
||||||
shared_ptr<llvm::Module> module = moduleBuilder.getModule();
|
shared_ptr<llvm::Module> module = moduleBuilder.getModule();
|
||||||
if (isVerbose) {
|
if (isVerbose) {
|
||||||
module->print(llvm::outs(), nullptr);
|
module->print(llvm::outs(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeGenerator codeGenerator(module);
|
CodeGenerator codeGenerator(module);
|
||||||
codeGenerator.generateObjectFile(outputKind);*/
|
codeGenerator.generateObjectFile(outputKind);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user