1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-08 04:54:23 +00:00
TiddlyWiki5/js/JavaScriptParser.js
Jeremy Ruston 3ff1d9a76c Cleaned up JavaScript processing
I'm slowly trying to make the JavaScript processing and the WikiText
processing use the same conventions
2012-01-04 18:31:19 +00:00

30 lines
597 B
JavaScript

/*\
title: js/JavaScriptParser.js
JavaScript processing
\*/
(function(){
/*jslint node: true */
"use strict";
var JavaScriptParseTree = require("./JavaScriptParseTree.js").JavaScriptParseTree,
pegjs = require("pegjs");
var JavaScriptParser = function(parserText) {
this.parser = pegjs.buildParser(parserText);
};
JavaScriptParser.prototype.parse = function(code) {
return new JavaScriptParseTree(this.parser.parse(code),this);
};
JavaScriptParser.prototype.createTree = function(tree) {
return new JavaScriptParseTree(tree,this);
};
exports.JavaScriptParser = JavaScriptParser;
})();