Don't throw an exception when "isTypeString" is false in lexer.cpp
This commit is contained in:
parent
4201e3bcfb
commit
44e160ebf9
|
@ -34,7 +34,7 @@ vector<tok> lex(const string& in)
|
||||||
for (;i < in.size(); ++i) {
|
for (;i < in.size(); ++i) {
|
||||||
const tok::type currentCharType = getIdentifierCharType(in[i]);
|
const tok::type currentCharType = getIdentifierCharType(in[i]);
|
||||||
const bool isString = currentCharType == STRING;
|
const bool isString = currentCharType == STRING;
|
||||||
if (i == in.size() - 1 && not isString) throw tok::LexerException("A never ending string was found", lineNumber);
|
if (isTypeString && (i == in.size() - 1 && not isString)) throw tok::LexerException("A never ending string was found", lineNumber);
|
||||||
if ((currentCharType == type || isTypeString) && !isString) {
|
if ((currentCharType == type || isTypeString) && !isString) {
|
||||||
formedString += string(1, in[i]);
|
formedString += string(1, in[i]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -69,10 +69,11 @@ int main(int argc, char* argv[]) {
|
||||||
for (future<pair<string, optional<Yerbacon::Exception>>>& currentFuture: Units) {
|
for (future<pair<string, optional<Yerbacon::Exception>>>& currentFuture: Units) {
|
||||||
const auto&& result = currentFuture.get();
|
const auto&& result = currentFuture.get();
|
||||||
if (not result.second.has_value()) {
|
if (not result.second.has_value()) {
|
||||||
if (printResult) cout << result.first << "\n\n";
|
if (printResult) cout << result.first;
|
||||||
} else {
|
} else {
|
||||||
cout << "Compilation of " << result.first << " has failed with the following error:\n" << result.second.value().what() << "\n\n";
|
cout << "Compilation of " << result.first << " has failed with the following error:\n" << result.second.value().what();
|
||||||
}
|
}
|
||||||
|
cout << "\n\n";
|
||||||
}
|
}
|
||||||
} else cout << "No valid file provided.\n";
|
} else cout << "No valid file provided.\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue