mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-02 01:47:14 +00:00
Cleaned up JavaScript processing
I'm slowly trying to make the JavaScript processing and the WikiText processing use the same conventions
This commit is contained in:
29
js/JavaScriptParser.js
Normal file
29
js/JavaScriptParser.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/*\
|
||||
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;
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user