Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ffa5c4e

Browse files
Added support for OUTPUT with comma separated list of StringExp
1 parent cf4a1ec commit ffa5c4e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎InputOutput.hpp‎

100644100755
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ class UserInput : public Expression {
2020
};
2121

2222
class Output : public Tree {
23+
std::vector<Expression *> out;
2324
public:
24-
Output(Expression *o)
25-
: Tree(o, nullptr) {}
25+
Output(std::vector<Expression *> &o)
26+
: Tree(nullptr, nullptr), out{ o } {}
2627
virtual void emit() override {
27-
Expression *out = dynamic_cast<Expression*>(left);
28-
if (!out || (out->type() != ExpI::StringT)) {
29-
throw std::runtime_error("needs to be a StringExp for output");
30-
}
3128
output << indent << "print(";
32-
out->emit();
29+
for (auto sep = ""; auto& o : out) {
30+
output << sep;
31+
o->emit();
32+
sep = " + ";
33+
}
3334
output << ");\n";
3435
if (right) {
3536
right->emit();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /