mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 01:20:30 +00:00
24 lines
372 B
JavaScript
24 lines
372 B
JavaScript
/*\
|
|
title: js/Sandbox.js
|
|
|
|
Execute a fragment of JavaScript in a sandbox
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint evil: true, node: true */
|
|
"use strict";
|
|
|
|
var pegjs = require("pegjs");
|
|
|
|
var Sandbox = function(parserText) {
|
|
this.parser = pegjs.buildParser(parserText);
|
|
};
|
|
|
|
Sandbox.prototype.parse = function(code) {
|
|
return this.parser.parse(code);
|
|
};
|
|
|
|
exports.Sandbox = Sandbox;
|
|
|
|
})(); |