-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvisitormath.h
41 lines (31 loc) · 1.13 KB
/
visitormath.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef VISITORMATH_H
#define VISITORMATH_H
#include <MathVisitor.h>
#include <QVariant>
#include <QTextEdit>
struct MathValue{
//temp global expr val
QVariant value;
//stored global expr val
std::unordered_map<std::string,QVariant> globalvars;
};
using namespace antlrtest;
class VisitorMath: public MathVisitor
{
MathValue value;
QVariant tmpVal;
public:
VisitorMath();
void setWidgetDebug(QTextEdit *out);
virtual antlrcpp::Any visitProg(MathParser::ProgContext *context);
virtual antlrcpp::Any visitBaseExpr(MathParser::BaseExprContext *context) ;
virtual antlrcpp::Any visitSetVariable(MathParser::SetVariableContext *context) ;
virtual antlrcpp::Any visitInteger(MathParser::IntegerContext *context) ;
virtual antlrcpp::Any visitVariable(MathParser::VariableContext *context) ;
virtual antlrcpp::Any visitAritLondo(MathParser::AritLondoContext *context) ;
virtual antlrcpp::Any visitAritPipo(MathParser::AritPipoContext *context) ;
virtual antlrcpp::Any visitArithBraches(MathParser::ArithBrachesContext *context) ;
private:
QTextEdit *edit;
};
#endif // VISITORMATH_H