blob: 52123345046d8379c1ed3dc7d88ab8ce93cc78e5 [file] [log] [blame]
swissChili923bd532021-12-08 22:48:58 -08001#pragma once
2
3#include <QString>
4#include <QList>
5
6#include "Token.h"
7#include "AstNode.h"
swissChili323883d2022-02-20 16:35:23 -08008#include "Parser.h"
swissChili923bd532021-12-08 22:48:58 -08009
10template <typename T>
11QString pprint(T val);
12
13template <>
14QString pprint<Token>(Token val);
15
16template <>
17QString pprint<AstNode>(AstNode val);
18
19template <typename T>
20QString pprint(QList<T> val)
21{
22 QStringList out;
23
24 for (const T &v : val)
25 out.append(static_cast<QString>(v));
26
27 return out.join(" ");
28}
29
30template <typename T>
31QString pprint(T val)
32{
33 return static_cast<QString>(val);
34}
swissChili323883d2022-02-20 16:35:23 -080035
36QString pprint(ParseResult val, const Parser &parser);
37
38void sout(QString string);