blob: 7bb84faef4121ca5febfe8a67fba5e0e42c4c26a [file] [log] [blame]
swissChilic71acc62021-12-07 08:03:37 -08001#include "AstNode.h"
2
3AstNode::AstNode(QString function, QList<AstNode> args)
4{
5 _type = FUNC;
6 _stringVal = function;
7 _listVal = args;
8}
9
10QList<AstNode> AstNode::funcArgs()
11{
12 return _listVal;
13}
14
15bool AstNode::isFunc() const
16{
17 return _type == FUNC;
18}
19
20AstNode::operator QString() const
21{
22 if (isFunc())
23 {
24 QStringList args;
25
26 for (const AstNode &node : _listVal)
27 {
28 args.append(static_cast<QString>(node));
29 }
30
31 return "<" + _stringVal + " " + args.join(" ") + ">";
32 }
33
34 return TokenBase<AstNode>::operator QString();
35}