blob: c05a5c837f3bece6f9501ac3a816c839ba95012c (
plain)
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
|
#include "tikzgraphassembler.h"
#include "tikzparserdefs.h"
#include "tikzparser.parser.hpp"
#include "tikzlexer.h"
int yyparse(void *scanner);
TikzGraphAssembler::TikzGraphAssembler(Graph *graph, QObject *parent) :
QObject(parent), _graph(graph)
{
yylex_init(&scanner);
yyset_extra(this, scanner);
}
void TikzGraphAssembler::addNodeToMap(Node *n) { _nodeMap.insert(n->name(), n); }
Node *TikzGraphAssembler::nodeWithName(QString name) { return _nodeMap[name]; }
bool TikzGraphAssembler::parse(const QString &tikz)
{
yy_scan_string(tikz.toLatin1().data(), scanner);
int result = yyparse(scanner);
if (result == 0) return true;
else return false;
}
Graph *TikzGraphAssembler::graph() const
{
return _graph;
}
|