-
Notifications
You must be signed in to change notification settings - Fork 36
[wip] Added undo operation for xeus-cpp #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
{ | ||
try | ||
{ | ||
n = std::stoi(code.substr(6)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::stoi" is directly included [misc-include-cleaner]
n = std::stoi(code.substr(6));
^
{ | ||
n = std::stoi(code.substr(6)); | ||
} | ||
catch (const std::invalid_argument&) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::invalid_argument" is directly included [misc-include-cleaner]
src/xinterpreter.cpp:20:
- #ifndef EMSCRIPTEN
+ #include <stdexcept>
+ #ifndef EMSCRIPTEN
} | ||
catch (const std::invalid_argument&) | ||
{ | ||
throw std::runtime_error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::runtime_error" is directly included [misc-include-cleaner]
throw std::runtime_error(
^
"Invalid format for %undo. Expected '%undo n' where n is an integer." | ||
); | ||
} | ||
catch (const std::out_of_range&) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::out_of_range" is directly included [misc-include-cleaner]
catch (const std::out_of_range&)
^
throw std::runtime_error("Number out of range for %undo."); | ||
} | ||
} | ||
compilation_result = Cpp::Undo(n) ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no member named 'Undo' in namespace 'Cpp' [clang-diagnostic-error]
compilation_result = Cpp::Undo(n) ? true : false;
^
throw std::runtime_error("Number out of range for %undo."); | ||
} | ||
} | ||
compilation_result = Cpp::Undo(n) ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: redundant boolean literal in ternary expression result [readability-simplify-boolean-expr]
compilation_result = Cpp::Undo(n) ? true : false; | |
compilation_result = Cpp::static_cast<bool>(Undo(n)); |
} | ||
else | ||
{ | ||
compilation_result = Cpp::Process(code.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "Cpp::Process" is directly included [misc-include-cleaner]
compilation_result = Cpp::Process(code.c_str());
^
Maybe you can add a couple tests ? |
Sure. |
Description
Undo last N operations.
Fixes #263