44 lines
964 B
C++
44 lines
964 B
C++
|
|
#include <string>
|
||
|
|
#include <sstream>
|
||
|
|
#include <map>
|
||
|
|
#include "util.h"
|
||
|
|
#include "eval.h"
|
||
|
|
#include "machine.h"
|
||
|
|
#include "klammer_base.h"
|
||
|
|
|
||
|
|
using namespace std;
|
||
|
|
|
||
|
|
extern "C" VISIBLE string show(std::map<std::string, std::string> args)
|
||
|
|
{
|
||
|
|
cout << "SHOW\n" << args << "\n";
|
||
|
|
|
||
|
|
return "SHOW";
|
||
|
|
|
||
|
|
string s = getarg(args, "s");
|
||
|
|
string target = getarg(args, "_target");
|
||
|
|
|
||
|
|
string kt = string_replace(s, "\\^\\^", "__CIRCUM__");
|
||
|
|
kt = string_replace(kt, "\\^", "");
|
||
|
|
kt = string_replace(kt, "__CIRCUM__", "HAT");
|
||
|
|
//kt = "@lit " + kt + " @";
|
||
|
|
cout << "Modified: " << kt << "\n";
|
||
|
|
|
||
|
|
Machine M {};
|
||
|
|
M.state.state.set("K_program_name", "show");
|
||
|
|
Text T(true);
|
||
|
|
|
||
|
|
T.read_string(kt);
|
||
|
|
T.parse();
|
||
|
|
M.extract_definitions(T);
|
||
|
|
M.apply(target, T);
|
||
|
|
string processed = M.to_string(target, T);
|
||
|
|
|
||
|
|
stringstream ss {};
|
||
|
|
//ss << s << sp_arrow << processed;
|
||
|
|
|
||
|
|
ss << "@t " << s << " @ | " << processed;
|
||
|
|
|
||
|
|
return ss.str();
|
||
|
|
}
|
||
|
|
|