mirror of
https://github.com/ArthurSonzogni/Diagon.git
synced 2026-08-29 16:40:45 +08:00
Fix coding style.
This commit is contained in:
+9
-7
@@ -4,13 +4,15 @@
|
||||
#include "MyParser.h"
|
||||
|
||||
namespace analysis {
|
||||
float evaluate(MyParser::ExpressionContext* expression);
|
||||
|
||||
struct DisplayTree {
|
||||
int entrance;
|
||||
std::vector<std::string> content;
|
||||
};
|
||||
DisplayTree display_tree(MyParser::ExpressionContext* expression);
|
||||
} // namespace analysis
|
||||
float evaluate(MyParser::ExpressionContext* expression);
|
||||
|
||||
struct DisplayTree {
|
||||
int entrance;
|
||||
std::vector<std::string> content;
|
||||
};
|
||||
DisplayTree display_tree(MyParser::ExpressionContext* expression);
|
||||
|
||||
} // namespace analysis
|
||||
|
||||
#endif /* end of include guard: COMPUTE_EXPRESSION_H */
|
||||
|
||||
+6
-6
@@ -5,14 +5,14 @@
|
||||
#include "MyParser.h"
|
||||
#include "analysis.h"
|
||||
|
||||
//using namespace antlrcpptest;
|
||||
//using namespace antlr4;
|
||||
|
||||
int main(int , const char **) {
|
||||
// using namespace antlrcpptest;
|
||||
// using namespace antlr4;
|
||||
|
||||
int main(int, const char**) {
|
||||
// Ask the user for an input.
|
||||
std::string text_input;
|
||||
std::cout << "Please enter an expression (for instance (1+2)*(3-4)/(5-6))" << std::endl;
|
||||
std::cout << "Please enter an expression (for instance (1+2)*(3-4)/(5-6))"
|
||||
<< std::endl;
|
||||
std::cout << "input = ";
|
||||
std::cin >> text_input;
|
||||
antlr4::ANTLRInputStream input(text_input);
|
||||
@@ -32,7 +32,7 @@ int main(int , const char **) {
|
||||
// Print the tree.
|
||||
std::cout << "Tree = " << std::endl;
|
||||
analysis::DisplayTree tree = analysis::display_tree(expression);
|
||||
for(const auto& line : tree.content)
|
||||
for (const auto& line : tree.content)
|
||||
std::cout << line << std::endl;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user