Added peg::udl for 'tag' user defined literal.

pull/38/head
yhirose 7 years ago
parent 1520849708
commit 6b63bd48af
  1. 6
      language/culebra/culebra.h
  2. 1
      language/culebra/main.cc
  3. 1
      language/pl0/pl0.cc
  4. 2
      peglib.h

@ -547,7 +547,7 @@ struct Interpreter
}
Value eval(const peg::Ast& ast, std::shared_ptr<Environment> env) {
using peg::operator"" _;
using namespace peg::udl;
if (debugger_) {
if (ast.original_tag == "STATEMENT"_) {
@ -715,7 +715,7 @@ private:
}
Value eval_call(const peg::Ast& ast, std::shared_ptr<Environment> env) {
using peg::operator"" _;
using namespace peg::udl;
Value val = eval(*ast.nodes[0], env);
@ -836,7 +836,7 @@ private:
}
return rval;
} else {
using peg::operator"" _;
using namespace peg::udl;
Value lval = eval(*ast.nodes[lvaloff], env);

@ -6,6 +6,7 @@
#include <vector>
using namespace peg;
using namespace peg::udl;
using namespace std;
bool read_file(const char* path, vector<char>& buff)

@ -11,6 +11,7 @@
#include <sstream>
using namespace peg;
using namespace peg::udl;
using namespace std;
/*

@ -2151,9 +2151,11 @@ inline constexpr unsigned int str2tag(const char* str, int h = 0) {
return !str[h] ? 5381 : (str2tag(str, h + 1) * 33) ^ static_cast<unsigned char>(str[h]);
}
namespace udl {
inline constexpr unsigned int operator "" _(const char* s, size_t) {
return str2tag(s);
}
}
#endif
template <typename Annotation>

Loading…
Cancel
Save