Permalink
Browse files

archive old files

  • Loading branch information...
1 parent cbb9367 commit 597f4dd45e962fbbc9c15d59da2427bce608008e @hax hax committed Nov 14, 2012
View
58 archive/app.js
@@ -0,0 +1,58 @@
+//require('underscore')
+
+/*require('my').load('lib/Tabish/type', function(type){
+
+ console.log(type.Class)
+})*/
+
+
+/*
+require('my').load('lib/Tabish/iterator', function(m){
+
+ console.log(m.Iterator)
+ console.log(m.StopIteration)
+
+ var it = m.Iterator({a:1, b:2})
+ try {
+ while (true) {
+ console.log(it.next())
+ }
+ } catch(e) {}
+
+})
+
+require('my').load('lib/Tabish/matcher', function(m){
+
+ console.log(m.RegExpMatcherIterator)
+
+ var it = m.RegExpMatcherIterator(/l/g, 'Hello world!')
+
+ try {
+ while (true) {
+ console.log(it.next())
+ }
+ } catch(e) {}
+
+})
+*/
+
+
+/*require('my').load('lib/Tabish/tabish', function(m){
+
+ console.log(m.parse('Hello!\n Hello 2!'))
+
+})*/
+
+require('my').global.console = console
+
+require('my').load('jedi', function(jedi){
+
+ var source = 'html'
+ var runtime = new jedi.JSRuntime()
+ var template = runtime.eval(jedi.compileToJS(source))
+ template.echo = function(s){
+ console.log(s)
+ }
+ template()
+})
+
View
112 archive/baixing.js
@@ -0,0 +1,112 @@
+var express = require('express')
+
+var app = express(), fs = require('fs')
+
+// Configuration
+app.configure(function(){
+ app.set('views', __dirname + '/views');
+ app.set('view engine', 'jedi');
+ app.use(express.bodyParser());
+ app.use(express.methodOverride());
+ app.use(app.router);
+ app.use(express.static(__dirname + '/public'));
+});
+
+app.configure('development', function(){
+ app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+});
+
+app.configure('production', function(){
+ app.use(express.errorHandler());
+});
+
+require('my').load('jedi', function(jedi){
+ app.engine('jedi', function __express(path, options, callback) {
+ //console.log(arguments)
+ console.log(Object.keys(options))
+ fs.readFile(path, 'utf-8', function(err, data) {
+ if (err) callback(err)
+ else {
+ try {
+ var runtime = jedi.JSRuntime()
+ var source = data
+ var jsSrc = jedi.compileToJS(source)
+ var template = runtime.eval(jsSrc)
+ var result = ''
+ template.echo = function(s){
+ result += s
+ }
+ template(options.model)
+ callback(null, result)
+ } catch(e) {
+ e.message += jsSrc.replace(/&/g, '&amp;').replace(/</g, '&lt;')
+ callback(e, jsSrc)
+ }
+ }
+ })
+ })
+})
+
+// Routes
+
+var http = require('http')
+
+
+app.get('/u/:uid/', function(req, res){
+ var graphRes = http.get('http://graph.baixing.com' + req.url.slice(2) + 'ad', function(graphRes){
+ graphRes.setEncoding('utf-8')
+ var result = ''
+ graphRes.on('data', function(data){
+ result += data
+ })
+ graphRes.on('end', function(data){
+ var m = JSON.parse(result)
+ console.log(m)
+ ok(res, 'ad', m)
+ })
+ })
+ var graphReq = http.get('http://graph.baixing.com' + req.url.slice(2, -1), function(graphRes){
+ graphRes.setEncoding('utf-8')
+ var result = ''
+ graphRes.on('data', function(data){
+ result += data
+ })
+ graphRes.on('end', function(data){
+ var m = JSON.parse(result)
+ console.log(m)
+ ok(res, 'user', m)
+ res.render('test', {
+ model: m
+ })
+ })
+ })
+ graphReq.on('error', function(e){
+ console.error(e)
+ })
+})
+
+app.get('/*', function(req, res){
+ console.log('http://graph.baixing.com' + req.url)
+ var graphReq = http.get('http://graph.baixing.com' + req.url, function(graphRes){
+ graphRes.setEncoding('utf-8')
+ var result = ''
+ graphRes.on('data', function(data){
+ result += data
+ })
+ graphRes.on('end', function(data){
+ var m = JSON.parse(result)
+ console.log(m)
+ res.render('test', {
+ model: m
+ })
+ })
+ })
+ graphReq.on('error', function(e){
+ console.error(e)
+ })
+});
+
+app.listen(3000, function(){});
+
+
+
View
0 compiler.es5.js → archive/compiler.es5.js
File renamed without changes.
View
0 compiler.php5.js → archive/compiler.php5.js
File renamed without changes.
View
0 express.js → archive/express.js
File renamed without changes.
View
0 index.js → archive/index.js
File renamed without changes.
View
0 jedi.html → archive/jedi.html
File renamed without changes.
View
0 jedi.js → archive/jedi.js
File renamed without changes.
View
0 jedi.tabish → archive/jedi.tabish
File renamed without changes.
View
63 archive/ometa/api.js
@@ -0,0 +1,63 @@
+var ometajs = require('ometajs'),
+ //uglify = require('uglify-js'),
+ utils = ometajs.utils,
+ vm = require('vm'),
+ //Module = require('module'),
+ fail = ometajs.globals.fail;
+ objectThatDelegatesTo = ometajs.globals.objectThatDelegatesTo;
+
+function compilationError(m, i) {
+ throw objectThatDelegatesTo(fail, {errorPos: i});
+};
+
+function translationError(m, i) {
+ throw fail;
+};
+
+function wrapModule(code, options) {
+ var buf = [
+ 'var ometajs_ = require(\'',
+ options.root || ometajs.root || 'ometajs',
+ '\').globals;'
+ ];
+
+ Object.keys(ometajs.globals).forEach(function(key) {
+ buf.push('var ', key, ' = ometajs_.', key, ';\n');
+ });
+ buf.push(code);
+
+ return buf.join('');
+};
+
+function translateCode(code, options) {
+ options || (options = {});
+ var tree = ometajs.BSOMetaJSParser.matchAll(code, "topLevel", undefined,
+ compilationError);
+
+ code = ometajs.BSOMetaJSTranslator.match(tree, "trans", undefined,
+ translationError);
+
+ //code = uglify.uglify.gen_code(uglify.parser.parse(code), { beautify: true });
+
+ if (options.noContext) return code;
+
+ return wrapModule(code, options);
+};
+exports.translateCode = translateCode;
+
+function evalCode(code, filename, options) {
+ options || (options = {});
+ options.noContext = true;
+
+ code = translateCode(code, options);
+ return vm.runInNewContext('var exports = {};' + code + '\n;exports',
+ utils.clone(ometajs.globals),
+ filename || 'ometa');
+};
+exports.evalCode = evalCode;
+
+require.extensions['.ometajs'] = function(module, filename) {
+ var code = translateCode(require('fs').readFileSync(filename).toString());
+
+ module._compile(code, filename);
+};
View
1 archive/ometa/index.js
@@ -0,0 +1 @@
+'use strict'
View
77 archive/ometa/jedi-test.js
@@ -0,0 +1,77 @@
+var ometajs_ = require("ometajs");var AbstractGrammar = ometajs_.grammars.AbstractGrammar;var BSJSParser = ometajs_.grammars.BSJSParser;var BSJSIdentity = ometajs_.grammars.BSJSIdentity;var BSJSTranslator = ometajs_.grammars.BSJSTranslator;var tabish = require("./tabish")
+var Blocks = tabish.Blocks
+
+function toUTF16(codePoint) {
+ if (codePoint < 0x10000) return String.fromCharCode(codePoint)
+ codePoint -= 0x10000
+ var lead = (codePoint >> 10) + 0xd800
+ var trail = (codePoint & 0x3ff) + 0xdc00
+ return String.fromCharCode(lead, trail)
+}
+var ToJSCompiler = function ToJSCompiler(source) {AbstractGrammar.call(this, source)};ToJSCompiler.grammarName = "ToJSCompiler";ToJSCompiler.match = AbstractGrammar.match;ToJSCompiler.matchAll = AbstractGrammar.matchAll;exports.ToJSCompiler = ToJSCompiler;require("util").inherits(ToJSCompiler, AbstractGrammar);var ToPHPCompiler = function ToPHPCompiler(source) {AbstractGrammar.call(this, source)};ToPHPCompiler.grammarName = "ToPHPCompiler";ToPHPCompiler.match = AbstractGrammar.match;ToPHPCompiler.matchAll = AbstractGrammar.matchAll;exports.ToPHPCompiler = ToPHPCompiler;require("util").inherits(ToPHPCompiler, AbstractGrammar);var Expression = function Expression(source) {AbstractGrammar.call(this, source)};Expression.grammarName = "Expression";Expression.match = AbstractGrammar.match;Expression.matchAll = AbstractGrammar.matchAll;exports.Expression = Expression;require("util").inherits(Expression, AbstractGrammar);var Parser = function Parser(source) {Blocks.call(this, source)};Parser.grammarName = "Parser";Parser.match = Blocks.match;Parser.matchAll = Blocks.matchAll;exports.Parser = Parser;require("util").inherits(Parser, Blocks);Parser.prototype["doc"] = function $doc() {return this._rule("blocks",false,[],null,this["blocks"]) && this._rule("end",false,[],null,this["end"])};
+Parser.prototype["block"] = function $block() {return (this._atomic(function() {return this._rule("doctype",false,[],null,this["doctype"])}) || this._atomic(function() {return this._rule("comment",false,[],null,this["comment"])}) || this._atomic(function() {return this._rule("suppress",false,[],null,this["suppress"])}) || this._atomic(function() {return this._rule("inject",false,[],null,this["inject"])}) || this._atomic(function() {return this._rule("filter",false,[],null,this["filter"])}) || this._atomic(function() {return this._rule("binding",false,[],null,this["binding"])}) || this._atomic(function() {return this._rule("text",false,[],null,this["text"])}) || this._atomic(function() {return this._rule("element",false,[],null,this["element"])}) || this._atomic(function() {return this._rule("attribute",false,[],null,this["attribute"])}) || this._atomic(function() {return this._rule("placeholder",false,[],null,this["placeholder"])}) || this._atomic(function() {return this._rule("block",false,[],Blocks,Blocks.prototype["block"])}))};
+Parser.prototype["doctype"] = function $doctype() {var x;return (this._list(function() {return this._match("!") && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._exec(["DocType",x.join("")]))};
+Parser.prototype["comment"] = function $comment() {var x, y, e;return (this._list(function() {return this._rule("commentStart",false,[],null,this["commentStart"]) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Comment",[x].concat(y)]))};
+Parser.prototype["commentStart"] = function $commentStart() {return (this._match("!"))};
+Parser.prototype["suppress"] = function $suppress() {var x, y, e;return (this._list(function() {return this._rule("suppressStart",false,[],null,this["suppressStart"]) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Suppress",[x].concat(y)]))};
+Parser.prototype["suppressStart"] = function $suppressStart() {return (this._match("-") && this._match("-"))};
+Parser.prototype["inject"] = function $inject() {var x, y, e;return (this._list(function() {return this._rule("injectStart",false,[],null,this["injectStart"]) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Inject",[x].concat(y)]))};
+Parser.prototype["injectStart"] = function $injectStart() {return (this._match("-"))};
+Parser.prototype["binding"] = function $binding() {var x, y, e;return (this._list(function() {return this._rule("bindingForm",false,[],null,this["bindingForm"]) && ((x = this._getIntermediate()), true)}) && this._list(function() {return this._rule("blocks",false,[],null,this["blocks"]) && ((y = this._getIntermediate()), true)}) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Binding"].concat(x,[y])))};
+Parser.prototype["bindingForm"] = function $bindingForm() {var x, y;return (this._rule("bindingOp",false,[],null,this["bindingOp"]) && this._rule("spaces",false,[],null,this["spaces"]) && this._rule("expression",false,[],null,this["expression"]) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._optional(function() {return (this._rule("token",true,["use"],null,this["token"]) && this._rule("bindingNames",false,[],null,this["bindingNames"]) && ((y = this._getIntermediate()), true))}) && this._exec([x,y]))};
+Parser.prototype["bindingOp"] = function $bindingOp() {return (this._match("="))};
+Parser.prototype["filter"] = function $filter() {var x, y, z, e;return (this._list(function() {return this._rule("filterStart",false,[],null,this["filterStart"]) && this._rule("filterName",false,[],null,this["filterName"]) && ((x = this._getIntermediate()), true) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((y = this._getIntermediate()), true)}) && this._list(function() {return this._rule("blocks",false,[],null,this["blocks"]) && ((z = this._getIntermediate()), true)}) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Filter",x,y,z]))};
+Parser.prototype["filterStart"] = function $filterStart() {return (this._match(":"))};
+Parser.prototype["filterName"] = function $filterName() {return (this._many(function() { return this._atomic(function() { return this._rule("letter",false,[],null,this["letter"]) });}))};
+Parser.prototype["text"] = function $text() {var x, y, e, x, y, e, x, y, e, x, y, e, x, y, e, tag, x, y, e;return (this._atomic(function() {return (this._list(function() {return this._rule("stringLiteral",false,[],null,this["stringLiteral"]) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Text",x[1]]))}) || this._atomic(function() {return (this._list(function() {return this._match("'") && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Text",[x].concat(y)]))}) || this._atomic(function() {return (this._list(function() {return this._match("\"") && this._rule("templateString",false,[],null,this["templateString"]) && ((x = this._getIntermediate()), true)}) && this._rule("templateStrings",false,[],null,this["templateStrings"]) && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Quasi","",[x].concat(y)]))}) || this._atomic(function() {return (this._list(function() {return this._match("‘") && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Quasi","Unicode",[x].concat(y)]))}) || this._atomic(function() {return (this._list(function() {return this._match("“") && this._rule("templateString",false,[],null,this["templateString"]) && ((x = this._getIntermediate()), true)}) && this._rule("templateStrings",false,[],null,this["templateStrings"]) && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Quasi","Unicode",[x].concat(y)]))}) || this._atomic(function() {return (this._list(function() {return this._rule("quasiTag",false,[],null,this["quasiTag"]) && ((tag = this._getIntermediate()), true) && this._match("`") && this._rule("templateString",false,[],null,this["templateString"]) && ((x = this._getIntermediate()), true)}) && this._rule("templateStrings",false,[],null,this["templateStrings"]) && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Quasi",tag,[x].concat(y)]))}))};
+Parser.prototype["quasiTag"] = function $quasiTag() {return (this._atomic(function() {return this._rule("identifier",false,[],null,this["identifier"])}) || this._atomic(function() {return this._rule("empty",false,[],null,this["empty"])}))};
+Parser.prototype["templateString"] = function $templateString() {return (this._any(function() { return this._atomic(function() { return (this._atomic(function() {return this._rule("interpolation",false,[],null,this["interpolation"])}) || this._atomic(function() {return this._rule("char",false,[],null,this["char"])})) });}))};
+Parser.prototype["templateStrings"] = function $templateStrings() {var y;return (this._list(function() {return this._any(function() { return this._atomic(function() { return (this._atomic(function() {var x;return this._rule("skip",false,[],null,this["skip"]) && ((x = this._getIntermediate()), true) && this._exec(x)}) || this._atomic(function() {var x;return this._list(function() {return this._rule("templateString",false,[],null,this["templateString"]) && ((x = this._getIntermediate()), true)}) && this._exec(x)})) });}) && ((y = this._getIntermediate()), true)}) && this._exec(y))};
+Parser.prototype["interpolation"] = function $interpolation() {var x;return (this._match("{") && this._rule("expression",false,[],null,this["expression"]) && ((x = this._getIntermediate()), true) && this._match("}") && this._exec(x))};
+Parser.prototype["element"] = function $element() {var tag, cls, id, bind, body, e;return (this._list(function() {return this._rule("tagName",false,[],null,this["tagName"]) && ((tag = this._getIntermediate()), true) && this._rule("classList",false,[],null,this["classList"]) && ((cls = this._getIntermediate()), true) && this._optional(function() {return this._rule("id",false,[],null,this["id"])}) && ((id = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._optional(function() {return this._rule("binding",false,[],null,this["binding"])}) && ((bind = this._getIntermediate()), true)}) && this._list(function() {return this._rule("blocks",false,[],null,this["blocks"]) && ((body = this._getIntermediate()), true)}) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(bind?["Binding",bind[0],bind[1],["Element",tag,[cls,id],body]]:["Element",tag,[cls,id],body]))};
+Parser.prototype["simpleName"] = function $simpleName() {var x;return (this._many(function() { return this._atomic(function() { return (this._atomic(function() {return this._rule("escapedChar",false,[],null,this["escapedChar"])}) || this._atomic(function() {return !this._atomic(function() {return (this._match(".") || this._match("#") || this._atomic(function() {return this._rule("space",false,[],null,this["space"])}))}, true) && this._rule("char",false,[],null,this["char"])})) });}) && ((x = this._getIntermediate()), true) && this._exec(x.join("")))};
+Parser.prototype["tagName"] = function $tagName() {return (this._rule("simpleName",false,[],null,this["simpleName"]))};
+Parser.prototype["aclass"] = function $aclass() {return (this._match(".") && this._rule("simpleName",false,[],null,this["simpleName"]))};
+Parser.prototype["classList"] = function $classList() {return (this._any(function() { return this._atomic(function() { return this._rule("aclass",false,[],null,this["aclass"]) });}))};
+Parser.prototype["id"] = function $id() {return (this._match("#") && this._rule("simpleName",false,[],null,this["simpleName"]))};
+Parser.prototype["attribute"] = function $attribute() {var attr, y, exp, op, x;return (this._list(function() {return this._match("@") && this._rule("attrName",false,[],null,this["attrName"]) && ((attr = this._getIntermediate()), true) && this._optional(function() {return (this._rule("assignmentOperator",false,[],null,this["assignmentOperator"]) && ((op = this._getIntermediate()), true) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true))})}) && this._skip() && ((y = this._getIntermediate()), true) && this._rule("expression",false,[x.concat(y.join(""))],null,this["expression"]) && ((exp = this._getIntermediate()), true) && this._exec(["Attribute",attr,op,exp]))};
+Parser.prototype["attrName"] = function $attrName() {var x;return (this._many(function() { return this._atomic(function() { return (!this._atomic(function() {return this._rule("space",false,[],null,this["space"])}, true) && this._rule("char",false,[],null,this["char"])) });}) && ((x = this._getIntermediate()), true) && this._exec(x.join("")))};
+Parser.prototype["assignmentOperator"] = function $assignmentOperator() {var x;return (this._many(function() { return this._atomic(function() { return this._rule("space",false,[],null,this["space"]) });}) && (this._atomic(function() {return this._optional(function() {return (this._match("+") || this._match("-") || this._match("^") || this._match("$"))}) && this._match("=")})) && ((x = this._getIntermediate()), true) && this._many(function() { return this._atomic(function() { return this._rule("space",false,[],null,this["space"]) });}) && this._exec(x))};
+Parser.prototype["placeholder"] = function $placeholder() {var id, bind, body;return (this._list(function() {return this._rule("id",false,[],null,this["id"]) && ((id = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._optional(function() {return this._rule("bindingForm",false,[],null,this["bindingForm"])}) && ((bind = this._getIntermediate()), true)}) && this._list(function() {return this._rule("blocks",false,[],null,this["blocks"]) && ((body = this._getIntermediate()), true)}) && this._exec(bind?["Binding",bind[0],bind[1],["Placeholder",id,null,body]]:["Placeholder",id,null,body]))};
+Parser.prototype["literal"] = function $literal() {return (this._atomic(function() {return this._rule("booleanLiteral",false,[],null,this["booleanLiteral"])}) || this._atomic(function() {return this._rule("numberLiteral",false,[],null,this["numberLiteral"])}) || this._atomic(function() {return this._rule("stringLiteral",false,[],null,this["stringLiteral"])}) || this._atomic(function() {return this._rule("listLiteral",false,[],null,this["listLiteral"])}) || this._atomic(function() {return this._rule("tupleLiteral",false,[],null,this["tupleLiteral"])}))};
+Parser.prototype["booleanLiteral"] = function $booleanLiteral() {return (this._atomic(function() {return this._rule("token",true,["true"],null,this["token"]) && this._exec(["True"])}) || this._atomic(function() {return this._rule("token",true,["false"],null,this["token"]) && this._exec(["False"])}))};
+Parser.prototype["numberLiteral"] = function $numberLiteral() {var c, d, e, f, g;return (this._atomic(function() {return this._rule("token",true,["NaN"],null,this["token"]) && this._exec(["NaN"])}) || this._atomic(function() {return this._rule("token",true,["Infinite"],null,this["token"]) && this._exec(["PosInf"])}) || this._atomic(function() {return this._rule("token",true,["+Infinite"],null,this["token"]) && this._exec(["PosInf"])}) || this._atomic(function() {return this._rule("token",true,["-Infinite"],null,this["token"]) && this._exec(["NegInf"])}) || this._atomic(function() {var a, b;return this._optional(function() {return (this._match("+") || this._match("-"))}) && ((a = this._getIntermediate()), true) && this._many(function() { return this._atomic(function() { return this._rule("digit",false,[],null,this["digit"]) });}) && ((b = this._getIntermediate()), true) && this._optional(function() {return (this._match(".") && ((c = this._getIntermediate()), true) && this._any(function() { return this._atomic(function() { return this._rule("digit",false,[],null,this["digit"]) });}) && ((d = this._getIntermediate()), true))}) && this._optional(function() {return (this._match("e") && ((e = this._getIntermediate()), true) && (this._match("+") || this._match("-")) && ((f = this._getIntermediate()), true) && this._many(function() { return this._atomic(function() { return this._rule("digit",false,[],null,this["digit"]) });}) && ((g = this._getIntermediate()), true))}) && this._exec(["Number",parseFloat([].concat(a,b,c,d,e,f,g).join(""))])}))};
+Parser.prototype["stringLiteral"] = function $stringLiteral() {var x, x;return (this._atomic(function() {return (this._match("\"") && this._any(function() { return this._atomic(function() { return (this._atomic(function() {return this._rule("escapedChar",false,[],null,this["escapedChar"])}) || this._atomic(function() {return !this._atomic(function() {return this._match("\"")}, true) && this._rule("char",false,[],null,this["char"])})) });}) && ((x = this._getIntermediate()), true) && this._match("\"") && this._exec(["String",x]))}) || this._atomic(function() {return (this._match("'") && this._any(function() { return this._atomic(function() { return (!this._atomic(function() {return this._match("'")}, true) && this._rule("char",false,[],null,this["char"])) });}) && ((x = this._getIntermediate()), true) && this._match("'") && this._exec(["String",x]))}))};
+Parser.prototype["escapedChar"] = function $escapedChar() {return (this._atomic(function() {return this._match("\\") && this._match("n") && this._exec("\n")}) || this._atomic(function() {return this._match("\\") && this._match("r") && this._exec("\r")}) || this._atomic(function() {return this._match("\\") && this._match("t") && this._exec(" ")}) || this._atomic(function() {return this._match("\\") && this._match("f") && this._exec("\f")}) || this._atomic(function() {return this._match("\\") && this._match("v") && this._exec(" ")}) || this._atomic(function() {var u;return this._match("\\") && this._seq(/^[0-9a-f]{1,6}/i) && ((u = this._getIntermediate()), true) && this._optional(function() {return this._rule("space",false,[],null,this["space"])}) && this._exec(toUTF16(parseInt(u,16)))}) || this._atomic(function() {var u;return this._match("\\") && this._seq(/^u[0-9a-f]{4}/i) && ((u = this._getIntermediate()), true) && this._exec(String.fromCharCode(parseInt(u.slice(1),16)))}) || this._atomic(function() {var c;return this._match("\\") && this._rule("char",false,[],null,this["char"]) && ((c = this._getIntermediate()), true) && this._exec(c)}))};
+Parser.prototype["listLiteral"] = function $listLiteral() {var x, y;return (this._match("[") && this._rule("spaces",false,[],null,this["spaces"]) && this._any(function() { return this._atomic(function() { return (this._rule("listItem",false,[],null,this["listItem"]) && this._rule("comma",false,[],null,this["comma"])) });}) && ((x = this._getIntermediate()), true) && this._optional(function() {return this._rule("listItem",false,[],null,this["listItem"])}) && ((y = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._match("]") && this._exec(["List",y?x.concat([y]):x]))};
+Parser.prototype["listItem"] = function $listItem() {return (this._rule("expression",false,[],null,this["expression"]))};
+Parser.prototype["tupleLiteral"] = function $tupleLiteral() {var x, y;return (this._match("(") && this._rule("spaces",false,[],null,this["spaces"]) && this._any(function() { return this._atomic(function() { return (this._rule("tupleItem",false,[],null,this["tupleItem"]) && this._rule("comma",false,[],null,this["comma"])) });}) && ((x = this._getIntermediate()), true) && this._optional(function() {return this._rule("tupleItem",false,[],null,this["tupleItem"])}) && ((y = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._match(")") && this._exec(["Tuple",y?x.concat([y]):x]))};
+Parser.prototype["tupleItem"] = function $tupleItem() {return (this._rule("expression",false,[],null,this["expression"]))};
+Parser.prototype["comma"] = function $comma() {return (this._rule("spaces",false,[],null,this["spaces"]) && this._match(",") && this._rule("spaces",false,[],null,this["spaces"]))};
+Parser.prototype["expression"] = function $expression() {return (this._rule("exp1",false,[],null,this["exp1"]))};
+Parser.prototype["op1"] = function $op1() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["->"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<-"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op2"] = function $op2() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["||"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["&&"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op3"] = function $op3() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["==="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["!=="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["=="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["!="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<=>"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,[">="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,[">"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op4"] = function $op4() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["<<<"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,[">>>"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<<"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,[">>"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op5"] = function $op5() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["?:"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op6"] = function $op6() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["+"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["-"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op7"] = function $op7() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["��"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["��"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op8"] = function $op8() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["!"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op9"] = function $op9() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["?."],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["."],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["!"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["exp1"] = function $exp1() {return (this._atomic(function() {var x, op, y;return this._rule("exp1",false,[],null,this["exp1"]) && ((x = this._getIntermediate()), true) && this._rule("op1",false,[],null,this["op1"]) && ((op = this._getIntermediate()), true) && this._rule("exp2",false,[],null,this["exp2"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp2",false,[],null,this["exp2"])}))};
+Parser.prototype["exp2"] = function $exp2() {return (this._atomic(function() {var x, op, y;return this._rule("exp2",false,[],null,this["exp2"]) && ((x = this._getIntermediate()), true) && this._rule("op2",false,[],null,this["op2"]) && ((op = this._getIntermediate()), true) && this._rule("exp3",false,[],null,this["exp3"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp3",false,[],null,this["exp3"])}))};
+Parser.prototype["exp3"] = function $exp3() {return (this._atomic(function() {var x, op, y;return this._rule("exp3",false,[],null,this["exp3"]) && ((x = this._getIntermediate()), true) && this._rule("op3",false,[],null,this["op3"]) && ((op = this._getIntermediate()), true) && this._rule("exp4",false,[],null,this["exp4"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp4",false,[],null,this["exp4"])}))};
+Parser.prototype["exp4"] = function $exp4() {return (this._atomic(function() {var x, op, y;return this._rule("exp4",false,[],null,this["exp4"]) && ((x = this._getIntermediate()), true) && this._rule("op4",false,[],null,this["op4"]) && ((op = this._getIntermediate()), true) && this._rule("exp5",false,[],null,this["exp5"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp5",false,[],null,this["exp5"])}))};
+Parser.prototype["exp5"] = function $exp5() {return (this._atomic(function() {var x, op, y;return this._rule("exp5",false,[],null,this["exp5"]) && ((x = this._getIntermediate()), true) && this._rule("op5",false,[],null,this["op5"]) && ((op = this._getIntermediate()), true) && this._rule("exp6",false,[],null,this["exp6"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp6",false,[],null,this["exp6"])}))};
+Parser.prototype["exp6"] = function $exp6() {return (this._atomic(function() {var x, op, y;return this._rule("exp6",false,[],null,this["exp6"]) && ((x = this._getIntermediate()), true) && this._rule("op6",false,[],null,this["op6"]) && ((op = this._getIntermediate()), true) && this._rule("exp7",false,[],null,this["exp7"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp7",false,[],null,this["exp7"])}))};
+Parser.prototype["exp7"] = function $exp7() {return (this._atomic(function() {var x, op, y;return this._rule("exp7",false,[],null,this["exp7"]) && ((x = this._getIntermediate()), true) && this._rule("op7",false,[],null,this["op7"]) && ((op = this._getIntermediate()), true) && this._rule("exp8",false,[],null,this["exp8"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp8",false,[],null,this["exp8"])}))};
+Parser.prototype["exp8"] = function $exp8() {return (this._atomic(function() {var op, x;return this._rule("op8",false,[],null,this["op8"]) && ((op = this._getIntermediate()), true) && this._rule("exp8",false,[],null,this["exp8"]) && ((x = this._getIntermediate()), true) && this._exec(["UnaryOp",op,x])}) || this._atomic(function() {return this._rule("exp9",false,[],null,this["exp9"])}))};
+Parser.prototype["exp9"] = function $exp9() {return (this._atomic(function() {var x, op, y;return this._rule("exp9",false,[],null,this["exp9"]) && ((x = this._getIntermediate()), true) && this._rule("op9",false,[],null,this["op9"]) && ((op = this._getIntermediate()), true) && this._rule("exp9",false,[],null,this["exp9"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("atomic",false,[],null,this["atomic"])}))};
+Parser.prototype["atomic"] = function $atomic() {return (this._atomic(function() {return this._rule("literal",false,[],null,this["literal"])}) || this._atomic(function() {return this._rule("variable",false,[],null,this["variable"])}))};
+Parser.prototype["variable"] = function $variable() {var x, y, id;return (this._rule("identifier",false,[],null,this["identifier"]) && ((x = this._getIntermediate()), true) && this._any(function() { return this._atomic(function() { return (this._match("/") && this._rule("identifier",false,[],null,this["identifier"]) && ((id = this._getIntermediate()), true) && this._exec(id)) });}) && ((y = this._getIntermediate()), true) && this._exec(["Ref",x].concat(y)))};
+Parser.prototype["identifier"] = function $identifier() {return (this._match("*") || this._seq(/^[a-z0-9$_-]+[?!]?/i))};
+Parser.prototype["parameters"] = function $parameters() {return (this._rule("listOf",false,["identifier",","],null,this["listOf"]))};
+Parser.prototype["bindingNames"] = function $bindingNames() {return (this._atomic(function() {return this._rule("parameters",false,[],null,this["parameters"])}) || this._atomic(function() {var x;return this._match("(") && this._rule("spaces",false,[],null,this["spaces"]) && this._rule("parameters",false,[],null,this["parameters"]) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._match(")") && this._exec(x)}))};
+var Translator = function Translator(source) {AbstractGrammar.call(this, source)};Translator.grammarName = "Translator";Translator.match = AbstractGrammar.match;Translator.matchAll = AbstractGrammar.matchAll;exports.Translator = Translator;require("util").inherits(Translator, AbstractGrammar);Translator.prototype["filter"] = function $filter() {var x, y;return (this._list(function() {return this._match(":") && this._rule("structure",false,[],null,this["structure"]) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._exec(["Filter",x,y]))};
+Translator.prototype["structure"] = function $structure() {var x, x, x, y;return (this._atomic(function() {return (this._rule("token",true,["if"],null,this["token"]) && this._rule("expression",false,[],null,this["expression"]) && ((x = this._getIntermediate()), true) && this._exec(["If",x]))}) || this._atomic(function() {return (this._rule("token",true,["else"],null,this["token"]) && this._exec(["Else"]))}) || this._atomic(function() {return (this._rule("token",true,["case"],null,this["token"]) && this._rule("expression",false,[],null,this["expression"]) && ((x = this._getIntermediate()), true) && this._exec(["Case",x]))}) || this._atomic(function() {return (this._rule("token",true,["for"],null,this["token"]) && this._rule("forBindings",false,[],null,this["forBindings"]) && ((x = this._getIntermediate()), true) && this._rule("expression",false,[],null,this["expression"]) && ((y = this._getIntermediate()), true) && this._exec(["For",x,y]))}))};
+Translator.prototype["forBindings"] = function $forBindings() {return (this._atomic(function() {return (this._rule("identifier",false,[],null,this["identifier"]) && this._rule("token",true,["in"],null,this["token"]))}) || this._atomic(function() {return (this._rule("identifier",false,[],null,this["identifier"]) && this._rule("token",true,[":"],null,this["token"]) && this._rule("identifier",false,[],null,this["identifier"]) && this._rule("token",true,["in"],null,this["token"]))}) || this._atomic(function() {return (this._rule("identifier",false,[],null,this["identifier"]) && this._rule("token",true,["of"],null,this["token"]))}) || this._atomic(function() {return (this._rule("identifier",false,[],null,this["identifier"]) && this._rule("token",true,[","],null,this["token"]) && this._rule("identifier",false,[],null,this["identifier"]) && this._rule("token",true,["of"],null,this["token"]))}))};
View
164 archive/ometa/jedi.ometajs
@@ -0,0 +1,164 @@
+var tabish = require('./tabish')
+var Blocks = tabish.Blocks
+
+function toUTF16(codePoint) {
+ if (codePoint < 0x10000) return String.fromCharCode(codePoint)
+ codePoint -= 0x10000
+ var lead = (codePoint >> 10) + 0xd800
+ var trail = (codePoint & 0x3ff) + 0xdc00
+ return String.fromCharCode(lead, trail)
+}
+
+ometa ToJSCompiler {
+}
+
+ometa ToPHPCompiler {
+}
+
+ometa Expression {
+}
+
+ometa Parser <: Blocks {
+
+ doc blocks end,
+
+ block doctype,
+ block comment,
+ block suppress,
+ block inject,
+ block filter,
+ block binding,
+ block text,
+ block element,
+ block attribute,
+ block placeholder,
+ block ^block,
+
+ doctype = ['!' char*:x] -> [#DocType, x.join('')],
+
+ comment = [commentStart char*:x] :y :e -> [#Comment, [x].concat(y)],
+ commentStart = '!',
+
+ suppress = [suppressStart char*:x] :y :e -> [#Suppress, [x].concat(y)],
+ suppressStart = '-' '-',
+
+ inject = [injectStart char*:x] :y :e -> [#Inject, [x].concat(y)],
+ injectStart = '-',
+
+ binding = [bindingForm:x] [blocks:y] :e -> [#Binding].concat(x, [y]),
+ bindingForm = bindingOp spaces expression:x spaces ("use" bindingNames:y)? -> [x, y],
+ bindingOp = '=',
+
+ filter = [filterStart filterName:x char*:y] [blocks:z] :e -> [#Filter, x, y, z],
+ filterStart = ':',
+ filterName = letter+,
+
+ text = [stringLiteral:x] :y :e -> [#Text, x[1]],
+ text = ['\'' char*:x] :y :e -> [#Text, [x].concat(y) ],
+ text = ['"' templateString:x] templateStrings:y :e -> [#Quasi, '', [x].concat(y)],
+ text = ['\u2018' char*:x] :y :e -> [#Quasi, #Unicode, [x].concat(y)],
+ text = ['\u201c' templateString:x] templateStrings:y :e -> [#Quasi, #Unicode, [x].concat(y)],
+ text = [quasiTag:tag '`' templateString:x] templateStrings:y :e -> [#Quasi, tag, [x].concat(y)],
+ quasiTag = identifier | empty,
+ templateString = (interpolation | char)*,
+ //templateStrings = [[anything*]*],
+ templateStrings = [(skip:x -> x | [templateString:x] -> x)*:y] -> y,
+ //interpolation = '{' (~'}' char)*:x '}' -> [#Expression, x],
+ interpolation = '{' expression:x '}' -> x,
+
+ element = [tagName:tag classList:cls id?:id spaces binding?:bind] [blocks:body] :e
+ -> bind ?
+ [#Binding, bind[0], bind[1], [#Element, tag, [cls, id], body]] :
+ [#Element, tag, [cls, id], body],
+ simpleName = (escapedChar | ~('.'|'#'|space) char)+:x -> x.join(''),
+ tagName = simpleName,
+ aclass = '.' simpleName,
+ classList = aclass*,
+ id = '#' simpleName,
+
+ attribute = ['@' attrName:attr (assignmentOperator:op char*:x)?] :y
+ expression(x.concat(y.join(''))):exp
+ -> [#Attribute, attr, op, exp],
+ attrName = (~space char)+:x -> x.join(''),
+ assignmentOperator = space+ (('+' | '-' | '^' | '$')? '='):x space+ -> x,
+
+ placeholder = [id:id spaces bindingForm?:bind] [blocks:body]
+ -> bind ?
+ [#Binding, bind[0], bind[1], [#Placeholder, id, null, body]] :
+ [#Placeholder, id, null, body],
+
+
+ literal = booleanLiteral | numberLiteral | stringLiteral | listLiteral | tupleLiteral,
+
+ booleanLiteral "true" -> [#True],
+ booleanLiteral "false" -> [#False],
+
+ numberLiteral "NaN" -> [#NaN],
+ numberLiteral "Infinite" -> [#PosInf],
+ numberLiteral "+Infinite" -> [#PosInf],
+ numberLiteral "-Infinite" -> [#NegInf],
+ numberLiteral ('+' | '-')?:a digit+:b ('.':c digit*:d)? ('e':e ('+' | '-'):f digit+:g)?
+ -> [#Number, parseFloat([].concat(a, b, c, d, e, f, g).join(''))],
+
+ stringLiteral = '"' (escapedChar | ~'"' char)*:x '"' -> [#String, x],
+ stringLiteral = '\'' (~'\'' char)*:x '\'' -> [#String, x],
+
+ escapedChar '\\' 'n' -> '\n',
+ escapedChar '\\' 'r' -> '\r',
+ escapedChar '\\' 't' -> '\t',
+ escapedChar '\\' 'f' -> '\f',
+ escapedChar '\\' 'v' -> '\u000b',
+ escapedChar '\\' /^[0-9a-f]{1,6}/i:u space? -> toUTF16(parseInt(u, 16)),
+ escapedChar '\\' /^u[0-9a-f]{4}/i:u -> String.fromCharCode(parseInt(u.slice(1), 16)),
+ escapedChar '\\' char:c -> c,
+
+ listLiteral = '[' spaces (listItem comma)*:x listItem?:y spaces ']' -> [#List, y ? x.concat([y]) : x],
+ listItem = expression,
+
+ tupleLiteral = '(' spaces (tupleItem comma)*:x tupleItem?:y spaces ')' -> [#Tuple, y ? x.concat([y]) : x],
+ tupleItem = expression,
+
+ comma = spaces ',' spaces,
+
+ expression = exp1,
+ op1 = spaces ("->" | "<-"):x spaces -> x,
+ op2 = spaces ("||" | "&&"):x spaces -> x,
+ op3 = spaces ("===" | "!==" | "==" | "!=" | "<=>" | ">=" | "<=" | ">" | "<"):x spaces -> x,
+ op4 = spaces ("<<<" | ">>>" | "<<" | ">>"):x spaces -> x,
+ op5 = spaces ("?:"):x spaces -> x,
+ op6 = spaces ("+" | "-"):x spaces -> x,
+ op7 = spaces ("��" | "��"):x spaces -> x,
+ op8 = spaces ("!"):x spaces -> x,
+ op9 = spaces ("?." | "." | "!"):x spaces -> x,
+ exp1 = exp1:x op1:op exp2:y -> [#BinaryOp, op, x, y] | exp2,
+ exp2 = exp2:x op2:op exp3:y -> [#BinaryOp, op, x, y] | exp3,
+ exp3 = exp3:x op3:op exp4:y -> [#BinaryOp, op, x, y] | exp4,
+ exp4 = exp4:x op4:op exp5:y -> [#BinaryOp, op, x, y] | exp5,
+ exp5 = exp5:x op5:op exp6:y -> [#BinaryOp, op, x, y] | exp6,
+ exp6 = exp6:x op6:op exp7:y -> [#BinaryOp, op, x, y] | exp7,
+ exp7 = exp7:x op7:op exp8:y -> [#BinaryOp, op, x, y] | exp8,
+ exp8 = op8:op exp8:x -> [#UnaryOp, op, x] | exp9,
+ exp9 = exp9:x op9:op exp9:y -> [#BinaryOp, op, x, y] | atomic,
+ atomic = literal | variable,
+
+ variable = identifier:x ('/' identifier:id -> id)*:y
+ -> [#Ref, x].concat(y),
+ identifier = '*' | /^[a-z0-9$_-]+[?!]?/i,
+ parameters = listOf('identifier', ','),
+ bindingNames = parameters | '(' spaces parameters:x spaces ')' -> x,
+}
+
+ometa Translator {
+
+ filter = [':' structure:x] :y -> [#Filter, x, y],
+
+ structure = "if" expression:x -> [#If, x],
+ structure = "else" -> [#Else],
+ structure = "case" expression:x -> [#Case, x],
+ structure = "for" forBindings:x expression:y -> [#For, x, y],
+
+ forBindings = identifier "in",
+ forBindings = identifier ":" identifier "in",
+ forBindings = identifier "of",
+ forBindings = identifier "," identifier "of",
+}
View
116 archive/ometa/jedi2.js
@@ -0,0 +1,116 @@
+var ometajs_ = require("ometajs");var AbstractGrammar = ometajs_.grammars.AbstractGrammar;var BSJSParser = ometajs_.grammars.BSJSParser;var BSJSIdentity = ometajs_.grammars.BSJSIdentity;var BSJSTranslator = ometajs_.grammars.BSJSTranslator;var util = {isArray: Array.isArray}
+util.flattenStrings = function flattenStrings(a) {
+ if (!util.isArray(a)) return a
+ if (a.length > 0 && a.every(util.isChar)) return a.join("")
+ else return a.map(flattenStrings)
+}
+util.isChar = function isChar(c) {
+ return typeof c === "string" && c.length === 1
+}
+
+function test(ometa, input, rule, args) {
+ console.log(
+ util.flattenStrings(ometa.matchAll(input, rule, args))
+ )
+}
+
+function toUTF16(codePoint) {
+ if (codePoint < 0x10000) return String.fromCharCode(codePoint)
+ codePoint -= 0x10000
+ var lead = (codePoint >> 10) + 0xd800
+ var trail = (codePoint & 0x3ff) + 0xdc00
+ return String.fromCharCode(lead, trail)
+}
+var Lines = function Lines(source) {AbstractGrammar.call(this, source)};Lines.grammarName = "Lines";Lines.match = AbstractGrammar.match;Lines.matchAll = AbstractGrammar.matchAll;exports.Lines = Lines;require("util").inherits(Lines, AbstractGrammar);Lines.prototype["lines"] = function $lines() {return (this._any(function() { return this._atomic(function() { return this._rule("line",false,[],null,this["line"]) });}))};
+Lines.prototype["line"] = function $line() {return (this._atomic(function() {return this._any(function() { return this._atomic(function() { return this._rule("whitespace",false,[],null,this["whitespace"]) });}) && this._rule("eol",false,[],null,this["eol"]) && this._exec("")}) || this._atomic(function() {var x;return this._any(function() { return this._atomic(function() { return this._rule("whitespace",false,[],null,this["whitespace"]) });}) && (this._atomic(function() {return this._rule("ignore",false,[],null,this["ignore"]) && this._rule("content",false,[],null,this["content"])})) && ((x = this._getIntermediate()), true) && this._rule("eol",false,[],null,this["eol"]) && this._exec(x)}) || this._atomic(function() {var x;return this._rule("content",false,[],null,this["content"]) && ((x = this._getIntermediate()), true) && this._rule("eol",false,[],null,this["eol"]) && this._exec(x)}))};
+Lines.prototype["ignore"] = function $ignore() {return (this._match("/") && this._match("/"))};
+Lines.prototype["content"] = function $content() {return (this._any(function() { return this._atomic(function() { return (!this._atomic(function() {return this._rule("eol",false,[],null,this["eol"])}, true) && this._rule("char",false,[],null,this["char"])) });}))};
+Lines.prototype["eol"] = function $eol() {return (this._atomic(function() {return this._match("\r") && this._match("\n")}) || this._atomic(function() {return this._match("\n") && this._match("\r")}) || this._match("\n") || this._match("\r"))};
+Lines.prototype["whitespace"] = function $whitespace() {return (this._atomic(function() {return !this._atomic(function() {return this._rule("eol",false,[],null,this["eol"])}, true) && this._rule("space",false,[],null,this["space"])}) || this._match("…"))};
+Lines.prototype["END"] = function $END() {return true};
+var UnicodeLines = function UnicodeLines(source) {Lines.call(this, source)};UnicodeLines.grammarName = "UnicodeLines";UnicodeLines.match = Lines.match;UnicodeLines.matchAll = Lines.matchAll;exports.UnicodeLines = UnicodeLines;require("util").inherits(UnicodeLines, Lines);UnicodeLines.prototype["eol"] = function $eol() {return (this._atomic(function() {return this._rule("eol",false,[],Lines,Lines.prototype["eol"])}) || this._atomic(function() {var c;return this._rule("char",false,[],null,this["char"]) && ((c = this._getIntermediate()), true) && (/^[\u2028\u2029]/.test(c))}))};
+UnicodeLines.prototype["END"] = function $END() {return true};
+test(UnicodeLines, "Hello world!\nThis is a simple test.", "lines")
+var Blocks = function Blocks(source) {AbstractGrammar.call(this, source)};Blocks.grammarName = "Blocks";Blocks.match = AbstractGrammar.match;Blocks.matchAll = AbstractGrammar.matchAll;exports.Blocks = Blocks;require("util").inherits(Blocks, AbstractGrammar);Blocks.prototype["blocks"] = function $blocks() {var x;return this._rule("startBody",false,[],null,this["startBody"]) && this._any(function() { return this._atomic(function() { return (this._atomic(function() {return this._rule("skip",false,[],null,this["skip"])}) || this._atomic(function() {return this._rule("parseBlock",false,[],null,this["parseBlock"])}) || this._atomic(function() {return this._rule("offside",false,[],null,this["offside"])})) });}) && ((x = this._getIntermediate()), true) && this._rule("endBody",false,[],null,this["endBody"]) && this._exec(x)};
+Blocks.prototype["startBody"] = function $startBody() {return this._exec(function(){if(!this.indents)this.indents=[];return this.indents.unshift(null)}.call(this))};
+Blocks.prototype["endBody"] = function $endBody() {return this._exec(function(){return this.indents.shift()}.call(this))};
+Blocks.prototype["parseBlock"] = function $parseBlock() {var error, head, body;return this._list(function() {return this._rule("indent",false,[],null,this["indent"]) && this._optional(function() {return this._rule("mixed",false,[],null,this["mixed"])}) && ((error = this._getIntermediate()), true) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((head = this._getIntermediate()), true)}) && this._any(function() { return this._atomic(function() { return (this._atomic(function() {return this._rule("skip",false,[],null,this["skip"])}) || this._atomic(function() {var x;return this._list(function() {return this._rule("indent",false,[],null,this["indent"]) && this._rule("tab",false,[],null,this["tab"]) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._exec(x)})) });}) && ((body = this._getIntermediate()), true) && this._rule("block",false,[head,body,error],null,this["block"])};
+Blocks.prototype["block"] = function $block() {var head, body, error;return this._skip() && ((head = this._getIntermediate()), true) && this._skip() && ((body = this._getIntermediate()), true) && this._skip() && ((error = this._getIntermediate()), true) && this._exec(["Block",head,body].concat(error?[error]:[]))};
+Blocks.prototype["offside"] = function $offside() {var line;return this._skip() && ((line = this._getIntermediate()), true) && this._exec(["Offside",line])};
+Blocks.prototype["mixed"] = function $mixed() {var whitespaces, c;return this._many(function() { return this._atomic(function() { return (this._rule("char",false,[],null,this["char"]) && ((c = this._getIntermediate()), true) && (/^[\u0000-\u0020\u0085\u00A0\u1680\u180E\u2000-\u200A\u202F\u205F\u3000\uFDD0-\uFDEF\uFEFF\uFFFE\uFFFF]/.test(c))) });}) && ((whitespaces = this._getIntermediate()), true) && this._exec(["MixedWhitespaces",whitespaces])};
+Blocks.prototype["skip"] = function $skip() {return (this._list(function() {return true}) || this._list(function() {return this._rule("ignore",false,[],null,this["ignore"]) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });})}))};
+Blocks.prototype["ignore"] = function $ignore() {return (this._match("/") && this._match("/"))};
+Blocks.prototype["indent"] = function $indent() {var x;return (this._atomic(function() {return ((this.indents[0]===null) && this._any(function() { return this._atomic(function() { return this._rule("tab",false,[],null,this["tab"]) });}) && ((x = this._getIntermediate()), true) && this._exec(this.indents[0]=x.length))}) || this._atomic(function() {return (this._rule("repeat",false,["tab",this.indents[0]],null,this["repeat"]))}))};
+Blocks.prototype["tab"] = function $tab() {return (this._match("\t") || this._atomic(function() {var x;return this._rule("tabSize",false,[],null,this["tabSize"]) && ((x = this._getIntermediate()), true) && (x!==null) && this._rule("repeat",false,["sp",x],null,this["repeat"])}))};
+Blocks.prototype["sp"] = function $sp() {return (this._match(" "))};
+Blocks.prototype["tabSize"] = function $tabSize() {return this._exec(null)};
+Blocks.prototype["repeat"] = function $repeat() {var r, n;return this._skip() && ((r = this._getIntermediate()), true) && this._skip() && ((n = this._getIntermediate()), true) && (this._atomic(function() {return (n===0)}) || this._atomic(function() {return this._rule("apply",false,[r],null,this["apply"]) && this._rule("repeat",false,[r,n-1],null,this["repeat"])}))};
+Blocks.prototype["END"] = function $END() {return true};
+test(Blocks, ["", "head", "", "\tbody line", "\tbody line"], "blocks")
+var Parser = function Parser(source) {Blocks.call(this, source)};Parser.grammarName = "Parser";Parser.match = Blocks.match;Parser.matchAll = Blocks.matchAll;exports.Parser = Parser;require("util").inherits(Parser, Blocks);Parser.prototype["doc"] = function $doc() {return this._rule("blocks",false,[],null,this["blocks"]) && this._rule("end",false,[],null,this["end"])};
+Parser.prototype["block"] = function $block() {return (this._atomic(function() {return this._rule("doctype",false,[],null,this["doctype"])}) || this._atomic(function() {return this._rule("comment",false,[],null,this["comment"])}) || this._atomic(function() {return this._rule("suppress",false,[],null,this["suppress"])}) || this._atomic(function() {return this._rule("inject",false,[],null,this["inject"])}) || this._atomic(function() {return this._rule("filter",false,[],null,this["filter"])}) || this._atomic(function() {return this._rule("binding",false,[],null,this["binding"])}) || this._atomic(function() {return this._rule("text",false,[],null,this["text"])}) || this._atomic(function() {return this._rule("element",false,[],null,this["element"])}) || this._atomic(function() {return this._rule("attribute",false,[],null,this["attribute"])}) || this._atomic(function() {return this._rule("placeholder",false,[],null,this["placeholder"])}) || this._atomic(function() {return this._rule("block",false,[],Blocks,Blocks.prototype["block"])}))};
+Parser.prototype["doctype"] = function $doctype() {var x;return (this._list(function() {return this._match("!") && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._exec(["DocType",x.join("")]))};
+Parser.prototype["comment"] = function $comment() {var x, y, e;return (this._list(function() {return this._rule("commentStart",false,[],null,this["commentStart"]) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Comment",[x].concat(y)]))};
+Parser.prototype["commentStart"] = function $commentStart() {return (this._match("!"))};
+Parser.prototype["suppress"] = function $suppress() {var x, y, e;return (this._list(function() {return this._rule("suppressStart",false,[],null,this["suppressStart"]) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Suppress",[x].concat(y)]))};
+Parser.prototype["suppressStart"] = function $suppressStart() {return (this._match("-") && this._match("-"))};
+Parser.prototype["inject"] = function $inject() {var x, y, e;return (this._list(function() {return this._rule("injectStart",false,[],null,this["injectStart"]) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Inject",[x].concat(y)]))};
+Parser.prototype["injectStart"] = function $injectStart() {return (this._match("-"))};
+Parser.prototype["binding"] = function $binding() {var x, y, e;return (this._list(function() {return this._rule("bindingForm",false,[],null,this["bindingForm"]) && ((x = this._getIntermediate()), true)}) && this._list(function() {return this._rule("blocks",false,[],null,this["blocks"]) && ((y = this._getIntermediate()), true)}) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Binding"].concat(x,[y])))};
+Parser.prototype["bindingForm"] = function $bindingForm() {var x, y;return (this._rule("bindingOp",false,[],null,this["bindingOp"]) && this._rule("spaces",false,[],null,this["spaces"]) && this._rule("expression",false,[],null,this["expression"]) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._optional(function() {return (this._rule("token",true,["use"],null,this["token"]) && this._rule("bindingNames",false,[],null,this["bindingNames"]) && ((y = this._getIntermediate()), true))}) && this._exec([x,y]))};
+Parser.prototype["bindingOp"] = function $bindingOp() {return (this._match("="))};
+Parser.prototype["filter"] = function $filter() {var x, y, z, e;return (this._list(function() {return this._rule("filterStart",false,[],null,this["filterStart"]) && this._rule("filterName",false,[],null,this["filterName"]) && ((x = this._getIntermediate()), true) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((y = this._getIntermediate()), true)}) && this._list(function() {return this._rule("blocks",false,[],null,this["blocks"]) && ((z = this._getIntermediate()), true)}) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Filter",x,y,z]))};
+Parser.prototype["filterStart"] = function $filterStart() {return (this._match(":"))};
+Parser.prototype["filterName"] = function $filterName() {return (this._many(function() { return this._atomic(function() { return this._rule("letter",false,[],null,this["letter"]) });}))};
+Parser.prototype["text"] = function $text() {var x, y, e, x, y, e, x, y, e, x, y, e, x, y, e, tag, x, y, e;return (this._atomic(function() {return (this._list(function() {return this._rule("stringLiteral",false,[],null,this["stringLiteral"]) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Text",x[1]]))}) || this._atomic(function() {return (this._list(function() {return this._match("'") && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Text",[x].concat(y)]))}) || this._atomic(function() {return (this._list(function() {return this._match("\"") && this._rule("templateString",false,[],null,this["templateString"]) && ((x = this._getIntermediate()), true)}) && this._rule("templateStrings",false,[],null,this["templateStrings"]) && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Quasi","",[x].concat(y)]))}) || this._atomic(function() {return (this._list(function() {return this._match("‘") && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true)}) && this._skip() && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Quasi","Unicode",[x].concat(y)]))}) || this._atomic(function() {return (this._list(function() {return this._match("“") && this._rule("templateString",false,[],null,this["templateString"]) && ((x = this._getIntermediate()), true)}) && this._rule("templateStrings",false,[],null,this["templateStrings"]) && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Quasi","Unicode",[x].concat(y)]))}) || this._atomic(function() {return (this._list(function() {return this._rule("quasiTag",false,[],null,this["quasiTag"]) && ((tag = this._getIntermediate()), true) && this._match("`") && this._rule("templateString",false,[],null,this["templateString"]) && ((x = this._getIntermediate()), true)}) && this._rule("templateStrings",false,[],null,this["templateStrings"]) && ((y = this._getIntermediate()), true) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(["Quasi",tag,[x].concat(y)]))}))};
+Parser.prototype["quasiTag"] = function $quasiTag() {return (this._atomic(function() {return this._rule("identifier",false,[],null,this["identifier"])}) || this._atomic(function() {return this._rule("empty",false,[],null,this["empty"])}))};
+Parser.prototype["templateString"] = function $templateString() {return (this._any(function() { return this._atomic(function() { return (this._atomic(function() {return this._rule("interpolation",false,[],null,this["interpolation"])}) || this._atomic(function() {return this._rule("char",false,[],null,this["char"])})) });}))};
+Parser.prototype["templateStrings"] = function $templateStrings() {var y;return (this._list(function() {return this._any(function() { return this._atomic(function() { return (this._atomic(function() {var x;return this._rule("skip",false,[],null,this["skip"]) && ((x = this._getIntermediate()), true) && this._exec(x)}) || this._atomic(function() {var x;return this._list(function() {return this._rule("templateString",false,[],null,this["templateString"]) && ((x = this._getIntermediate()), true)}) && this._exec(x)})) });}) && ((y = this._getIntermediate()), true)}) && this._exec(y))};
+Parser.prototype["interpolation"] = function $interpolation() {var x;return (this._match("{") && this._rule("expression",false,[],null,this["expression"]) && ((x = this._getIntermediate()), true) && this._match("}") && this._exec(x))};
+Parser.prototype["element"] = function $element() {var tag, cls, id, bind, body, e;return (this._list(function() {return this._rule("tagName",false,[],null,this["tagName"]) && ((tag = this._getIntermediate()), true) && this._rule("classList",false,[],null,this["classList"]) && ((cls = this._getIntermediate()), true) && this._optional(function() {return this._rule("id",false,[],null,this["id"])}) && ((id = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._optional(function() {return this._rule("binding",false,[],null,this["binding"])}) && ((bind = this._getIntermediate()), true)}) && this._list(function() {return this._rule("blocks",false,[],null,this["blocks"]) && ((body = this._getIntermediate()), true)}) && this._skip() && ((e = this._getIntermediate()), true) && this._exec(bind?["Binding",bind[0],bind[1],["Element",tag,[cls,id],body]]:["Element",tag,[cls,id],body]))};
+Parser.prototype["simpleName"] = function $simpleName() {var x;return (this._many(function() { return this._atomic(function() { return (this._atomic(function() {return this._rule("escapedChar",false,[],null,this["escapedChar"])}) || this._atomic(function() {return !this._atomic(function() {return (this._match(".") || this._match("#") || this._atomic(function() {return this._rule("space",false,[],null,this["space"])}))}, true) && this._rule("char",false,[],null,this["char"])})) });}) && ((x = this._getIntermediate()), true) && this._exec(x.join("")))};
+Parser.prototype["tagName"] = function $tagName() {return (this._rule("simpleName",false,[],null,this["simpleName"]))};
+Parser.prototype["aclass"] = function $aclass() {return (this._match(".") && this._rule("simpleName",false,[],null,this["simpleName"]))};
+Parser.prototype["classList"] = function $classList() {return (this._any(function() { return this._atomic(function() { return this._rule("aclass",false,[],null,this["aclass"]) });}))};
+Parser.prototype["id"] = function $id() {return (this._match("#") && this._rule("simpleName",false,[],null,this["simpleName"]))};
+Parser.prototype["attribute"] = function $attribute() {var attr, y, exp, op, x;return (this._list(function() {return this._match("@") && this._rule("attrName",false,[],null,this["attrName"]) && ((attr = this._getIntermediate()), true) && this._optional(function() {return (this._rule("assignmentOperator",false,[],null,this["assignmentOperator"]) && ((op = this._getIntermediate()), true) && this._any(function() { return this._atomic(function() { return this._rule("char",false,[],null,this["char"]) });}) && ((x = this._getIntermediate()), true))})}) && this._skip() && ((y = this._getIntermediate()), true) && this._rule("expression",false,[x.concat(y.join(""))],null,this["expression"]) && ((exp = this._getIntermediate()), true) && this._exec(["Attribute",attr,op,exp]))};
+Parser.prototype["attrName"] = function $attrName() {var x;return (this._many(function() { return this._atomic(function() { return (!this._atomic(function() {return this._rule("space",false,[],null,this["space"])}, true) && this._rule("char",false,[],null,this["char"])) });}) && ((x = this._getIntermediate()), true) && this._exec(x.join("")))};
+Parser.prototype["assignmentOperator"] = function $assignmentOperator() {var x;return (this._many(function() { return this._atomic(function() { return this._rule("space",false,[],null,this["space"]) });}) && (this._atomic(function() {return this._optional(function() {return (this._match("+") || this._match("-") || this._match("^") || this._match("$"))}) && this._match("=")})) && ((x = this._getIntermediate()), true) && this._many(function() { return this._atomic(function() { return this._rule("space",false,[],null,this["space"]) });}) && this._exec(x))};
+Parser.prototype["placeholder"] = function $placeholder() {var id, bind, body;return (this._list(function() {return this._rule("id",false,[],null,this["id"]) && ((id = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._optional(function() {return this._rule("bindingForm",false,[],null,this["bindingForm"])}) && ((bind = this._getIntermediate()), true)}) && this._list(function() {return this._rule("blocks",false,[],null,this["blocks"]) && ((body = this._getIntermediate()), true)}) && this._exec(bind?["Binding",bind[0],bind[1],["Placeholder",id,null,body]]:["Placeholder",id,null,body]))};
+Parser.prototype["literal"] = function $literal() {return (this._atomic(function() {return this._rule("booleanLiteral",false,[],null,this["booleanLiteral"])}) || this._atomic(function() {return this._rule("numberLiteral",false,[],null,this["numberLiteral"])}) || this._atomic(function() {return this._rule("stringLiteral",false,[],null,this["stringLiteral"])}) || this._atomic(function() {return this._rule("listLiteral",false,[],null,this["listLiteral"])}) || this._atomic(function() {return this._rule("tupleLiteral",false,[],null,this["tupleLiteral"])}))};
+Parser.prototype["booleanLiteral"] = function $booleanLiteral() {return (this._atomic(function() {return this._rule("token",true,["true"],null,this["token"]) && this._exec(["True"])}) || this._atomic(function() {return this._rule("token",true,["false"],null,this["token"]) && this._exec(["False"])}))};
+Parser.prototype["numberLiteral"] = function $numberLiteral() {var c, d, e, f, g;return (this._atomic(function() {return this._rule("token",true,["NaN"],null,this["token"]) && this._exec(["NaN"])}) || this._atomic(function() {return this._rule("token",true,["Infinite"],null,this["token"]) && this._exec(["PosInf"])}) || this._atomic(function() {return this._rule("token",true,["+Infinite"],null,this["token"]) && this._exec(["PosInf"])}) || this._atomic(function() {return this._rule("token",true,["-Infinite"],null,this["token"]) && this._exec(["NegInf"])}) || this._atomic(function() {var a, b;return this._optional(function() {return (this._match("+") || this._match("-"))}) && ((a = this._getIntermediate()), true) && this._many(function() { return this._atomic(function() { return this._rule("digit",false,[],null,this["digit"]) });}) && ((b = this._getIntermediate()), true) && this._optional(function() {return (this._match(".") && ((c = this._getIntermediate()), true) && this._any(function() { return this._atomic(function() { return this._rule("digit",false,[],null,this["digit"]) });}) && ((d = this._getIntermediate()), true))}) && this._optional(function() {return (this._match("e") && ((e = this._getIntermediate()), true) && (this._match("+") || this._match("-")) && ((f = this._getIntermediate()), true) && this._many(function() { return this._atomic(function() { return this._rule("digit",false,[],null,this["digit"]) });}) && ((g = this._getIntermediate()), true))}) && this._exec(["Number",parseFloat([].concat(a,b,c,d,e,f,g).join(""))])}))};
+Parser.prototype["stringLiteral"] = function $stringLiteral() {var x, x;return (this._atomic(function() {return (this._match("\"") && this._any(function() { return this._atomic(function() { return (this._atomic(function() {return this._rule("escapedChar",false,[],null,this["escapedChar"])}) || this._atomic(function() {return !this._atomic(function() {return this._match("\"")}, true) && this._rule("char",false,[],null,this["char"])})) });}) && ((x = this._getIntermediate()), true) && this._match("\"") && this._exec(["String",x]))}) || this._atomic(function() {return (this._match("'") && this._any(function() { return this._atomic(function() { return (!this._atomic(function() {return this._match("'")}, true) && this._rule("char",false,[],null,this["char"])) });}) && ((x = this._getIntermediate()), true) && this._match("'") && this._exec(["String",x]))}))};
+Parser.prototype["escapedChar"] = function $escapedChar() {return (this._atomic(function() {return this._match("\\") && this._match("n") && this._exec("\n")}) || this._atomic(function() {return this._match("\\") && this._match("r") && this._exec("\r")}) || this._atomic(function() {return this._match("\\") && this._match("t") && this._exec(" ")}) || this._atomic(function() {return this._match("\\") && this._match("f") && this._exec("\f")}) || this._atomic(function() {return this._match("\\") && this._match("v") && this._exec(" ")}) || this._atomic(function() {var u;return this._match("\\") && (this._atomic(function() {return this._rule("hexChar",false,[],null,this["hexChar"]) && this._optional(function() {return this._rule("hexChar",false,[],null,this["hexChar"])}) && this._optional(function() {return this._rule("hexChar",false,[],null,this["hexChar"])}) && this._optional(function() {return this._rule("hexChar",false,[],null,this["hexChar"])}) && this._optional(function() {return this._rule("hexChar",false,[],null,this["hexChar"])}) && this._optional(function() {return this._rule("hexChar",false,[],null,this["hexChar"])})})) && ((u = this._getIntermediate()), true) && this._optional(function() {return this._rule("space",false,[],null,this["space"])}) && this._exec(toUTF16(parseInt(u,16)))}) || this._atomic(function() {var u;return this._match("\\") && this._match("u") && (this._atomic(function() {return this._rule("hexChar",false,[],null,this["hexChar"]) && this._rule("hexChar",false,[],null,this["hexChar"]) && this._rule("hexChar",false,[],null,this["hexChar"]) && this._rule("hexChar",false,[],null,this["hexChar"])})) && ((u = this._getIntermediate()), true) && this._exec(String.fromCharCode(parseInt(u,16)))}) || this._atomic(function() {var c;return this._match("\\") && this._rule("char",false,[],null,this["char"]) && ((c = this._getIntermediate()), true) && this._exec(c)}))};
+Parser.prototype["hexChar"] = function $hexChar() {var c;return this._rule("char",false,[],null,this["char"]) && ((c = this._getIntermediate()), true) && (/^[0-9a-f]/i.test(c))};
+Parser.prototype["listLiteral"] = function $listLiteral() {var x, y;return (this._match("[") && this._rule("spaces",false,[],null,this["spaces"]) && this._any(function() { return this._atomic(function() { return (this._rule("listItem",false,[],null,this["listItem"]) && this._rule("comma",false,[],null,this["comma"])) });}) && ((x = this._getIntermediate()), true) && this._optional(function() {return this._rule("listItem",false,[],null,this["listItem"])}) && ((y = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._match("]") && this._exec(["List",y?x.concat([y]):x]))};
+Parser.prototype["listItem"] = function $listItem() {return (this._rule("expression",false,[],null,this["expression"]))};
+Parser.prototype["tupleLiteral"] = function $tupleLiteral() {var x, y;return (this._match("(") && this._rule("spaces",false,[],null,this["spaces"]) && this._any(function() { return this._atomic(function() { return (this._rule("tupleItem",false,[],null,this["tupleItem"]) && this._rule("comma",false,[],null,this["comma"])) });}) && ((x = this._getIntermediate()), true) && this._optional(function() {return this._rule("tupleItem",false,[],null,this["tupleItem"])}) && ((y = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._match(")") && this._exec(["Tuple",y?x.concat([y]):x]))};
+Parser.prototype["tupleItem"] = function $tupleItem() {return (this._rule("expression",false,[],null,this["expression"]))};
+Parser.prototype["comma"] = function $comma() {return (this._rule("spaces",false,[],null,this["spaces"]) && this._match(",") && this._rule("spaces",false,[],null,this["spaces"]))};
+Parser.prototype["expression"] = function $expression() {return (this._rule("exp1",false,[],null,this["exp1"]))};
+Parser.prototype["op1"] = function $op1() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["->"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<-"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op2"] = function $op2() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["||"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["&&"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op3"] = function $op3() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["==="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["!=="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["=="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["!="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<=>"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,[">="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<="],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,[">"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op4"] = function $op4() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["<<<"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,[">>>"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["<<"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,[">>"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op5"] = function $op5() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["?:"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op6"] = function $op6() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["+"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["-"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op7"] = function $op7() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["×"],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["÷"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op8"] = function $op8() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["!"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["op9"] = function $op9() {var x;return (this._rule("spaces",false,[],null,this["spaces"]) && (this._atomic(function() {return this._rule("token",true,["?."],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["."],null,this["token"])}) || this._atomic(function() {return this._rule("token",true,["!"],null,this["token"])})) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._exec(x))};
+Parser.prototype["exp1"] = function $exp1() {return (this._atomic(function() {var x, op, y;return this._rule("exp1",false,[],null,this["exp1"]) && ((x = this._getIntermediate()), true) && this._rule("op1",false,[],null,this["op1"]) && ((op = this._getIntermediate()), true) && this._rule("exp2",false,[],null,this["exp2"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp2",false,[],null,this["exp2"])}))};
+Parser.prototype["exp2"] = function $exp2() {return (this._atomic(function() {var x, op, y;return this._rule("exp2",false,[],null,this["exp2"]) && ((x = this._getIntermediate()), true) && this._rule("op2",false,[],null,this["op2"]) && ((op = this._getIntermediate()), true) && this._rule("exp3",false,[],null,this["exp3"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp3",false,[],null,this["exp3"])}))};
+Parser.prototype["exp3"] = function $exp3() {return (this._atomic(function() {var x, op, y;return this._rule("exp3",false,[],null,this["exp3"]) && ((x = this._getIntermediate()), true) && this._rule("op3",false,[],null,this["op3"]) && ((op = this._getIntermediate()), true) && this._rule("exp4",false,[],null,this["exp4"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp4",false,[],null,this["exp4"])}))};
+Parser.prototype["exp4"] = function $exp4() {return (this._atomic(function() {var x, op, y;return this._rule("exp4",false,[],null,this["exp4"]) && ((x = this._getIntermediate()), true) && this._rule("op4",false,[],null,this["op4"]) && ((op = this._getIntermediate()), true) && this._rule("exp5",false,[],null,this["exp5"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp5",false,[],null,this["exp5"])}))};
+Parser.prototype["exp5"] = function $exp5() {return (this._atomic(function() {var x, op, y;return this._rule("exp5",false,[],null,this["exp5"]) && ((x = this._getIntermediate()), true) && this._rule("op5",false,[],null,this["op5"]) && ((op = this._getIntermediate()), true) && this._rule("exp6",false,[],null,this["exp6"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp6",false,[],null,this["exp6"])}))};
+Parser.prototype["exp6"] = function $exp6() {return (this._atomic(function() {var x, op, y;return this._rule("exp6",false,[],null,this["exp6"]) && ((x = this._getIntermediate()), true) && this._rule("op6",false,[],null,this["op6"]) && ((op = this._getIntermediate()), true) && this._rule("exp7",false,[],null,this["exp7"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp7",false,[],null,this["exp7"])}))};
+Parser.prototype["exp7"] = function $exp7() {return (this._atomic(function() {var x, op, y;return this._rule("exp7",false,[],null,this["exp7"]) && ((x = this._getIntermediate()), true) && this._rule("op7",false,[],null,this["op7"]) && ((op = this._getIntermediate()), true) && this._rule("exp8",false,[],null,this["exp8"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("exp8",false,[],null,this["exp8"])}))};
+Parser.prototype["exp8"] = function $exp8() {return (this._atomic(function() {var op, x;return this._rule("op8",false,[],null,this["op8"]) && ((op = this._getIntermediate()), true) && this._rule("exp8",false,[],null,this["exp8"]) && ((x = this._getIntermediate()), true) && this._exec(["UnaryOp",op,x])}) || this._atomic(function() {return this._rule("exp9",false,[],null,this["exp9"])}))};
+Parser.prototype["exp9"] = function $exp9() {return (this._atomic(function() {var x, op, y;return this._rule("exp9",false,[],null,this["exp9"]) && ((x = this._getIntermediate()), true) && this._rule("op9",false,[],null,this["op9"]) && ((op = this._getIntermediate()), true) && this._rule("exp9",false,[],null,this["exp9"]) && ((y = this._getIntermediate()), true) && this._exec(["BinaryOp",op,x,y])}) || this._atomic(function() {return this._rule("atomic",false,[],null,this["atomic"])}))};
+Parser.prototype["atomic"] = function $atomic() {return (this._atomic(function() {return this._rule("literal",false,[],null,this["literal"])}) || this._atomic(function() {return this._rule("variable",false,[],null,this["variable"])}))};
+Parser.prototype["variable"] = function $variable() {var x, y, id;return (this._rule("identifier",false,[],null,this["identifier"]) && ((x = this._getIntermediate()), true) && this._any(function() { return this._atomic(function() { return (this._match("/") && this._rule("identifier",false,[],null,this["identifier"]) && ((id = this._getIntermediate()), true) && this._exec(id)) });}) && ((y = this._getIntermediate()), true) && this._exec(["Ref",x].concat(y)))};
+Parser.prototype["identifier"] = function $identifier() {return (this._match("*") || this._atomic(function() {return this._many(function() { return this._atomic(function() { return (this._atomic(function() {return this._rule("digit",false,[],null,this["digit"])}) || this._atomic(function() {return this._rule("letter",false,[],null,this["letter"])})) });})}))};
+Parser.prototype["parameters"] = function $parameters() {return (this._rule("listOf",false,["identifier",","],null,this["listOf"]))};
+Parser.prototype["bindingNames"] = function $bindingNames() {return (this._atomic(function() {return this._rule("parameters",false,[],null,this["parameters"])}) || this._atomic(function() {var x;return this._match("(") && this._rule("spaces",false,[],null,this["spaces"]) && this._rule("parameters",false,[],null,this["parameters"]) && ((x = this._getIntermediate()), true) && this._rule("spaces",false,[],null,this["spaces"]) && this._match(")") && this._exec(x)}))};
+Parser.prototype["END"] = function $END() {return true};
+test(Parser, ["", "head", "\t@title = 0", "\ttitle", "\t\t\"Hello {user}"], "blocks")
View
188 archive/ometa/jedi2.ometajs
@@ -0,0 +1,188 @@
+ometa Lines {
+ lines = line*,
+ line whitespace* eol -> '',
+ line whitespace* (ignore content):x eol -> x,
+ line content:x eol -> x,
+
+ ignore = '/' '/',
+ content = (~eol char)*,
+ eol = '\r' '\n' | '\n' '\r' | '\n' | '\r',
+ whitespace = ~eol space | '\u0085',
+ END
+}
+
+ometa UnicodeLines <: Lines {
+ eol = ^eol | char:c ?(/^[\u2028\u2029]/.test(c)),
+ //whitespace = ^whitespace | /^[\u00A0\u1680\u180E\u2000-\u200A\u202F\u205F\u3000\uFDD0-\uFDEF\uFEFF\uFFFE\uFFFF]/),
+ END
+}
+test(UnicodeLines, 'Hello world!\nThis is a simple test.', 'lines')
+
+
+
+ometa Blocks {
+ blocks startBody (skip | parseBlock | offside)*:x endBody -> x,
+ startBody -> { if (!this.indents) this.indents = []; this.indents.unshift(null) },
+ endBody -> { this.indents.shift() },
+
+ parseBlock
+ [indent mixed?:error char*:head]
+ (skip | [indent tab char*:x] -> x)*:body
+ block(head, body, error),
+
+ block :head :body :error -> [#Block, head, body].concat(error ? [error] : []),
+
+ offside :line -> [#Offside, line],
+ mixed (char:c ?(/^[\u0000-\u0020\u0085\u00A0\u1680\u180E\u2000-\u200A\u202F\u205F\u3000\uFDD0-\uFDEF\uFEFF\uFFFE\uFFFF]/.test(c)))+:whitespaces
+ -> [#MixedWhitespaces, whitespaces],
+
+ skip [],
+ skip [ignore char*],
+ ignore = '/' '/',
+
+ indent = ?(this.indents[0] === null) tab*:x { this.indents[0] = x.length },
+ indent = repeat('tab', this.indents[0]),
+
+ tab = '\t' | tabSize:x ?(x !== null) repeat('sp', x),
+ sp = ' ',
+ tabSize -> null,
+
+ repeat :r :n = ?(n === 0) | apply(r) repeat(r, n - 1),
+ END
+}
+
+test(Blocks, ['', 'head', '', '\tbody line', '\tbody line'], 'blocks')
+
+ometa Parser <: Blocks {
+
+ doc blocks end,
+
+ block doctype,
+ block comment,
+ block suppress,
+ block inject,
+ block filter,
+ block binding,
+ block text,
+ block element,
+ block attribute,
+ block placeholder,
+ block ^block,
+
+ doctype = ['!' char*:x] -> [#DocType, x.join('')],
+
+ comment = [commentStart char*:x] :y :e -> [#Comment, [x].concat(y)],
+ commentStart = '!',
+
+ suppress = [suppressStart char*:x] :y :e -> [#Suppress, [x].concat(y)],
+ suppressStart = '-' '-',
+
+ inject = [injectStart char*:x] :y :e -> [#Inject, [x].concat(y)],
+ injectStart = '-',
+
+ binding = [bindingForm:x] [blocks:y] :e -> [#Binding].concat(x, [y]),
+ bindingForm = bindingOp spaces expression:x spaces ("use" bindingNames:y)? -> [x, y],
+ bindingOp = '=',
+
+ filter = [filterStart filterName:x char*:y] [blocks:z] :e -> [#Filter, x, y, z],
+ filterStart = ':',
+ filterName = letter+,
+
+ text = [stringLiteral:x] :y :e -> [#Text, x[1]],
+ text = ['\'' char*:x] :y :e -> [#Text, [x].concat(y) ],
+ text = ['"' templateString:x] templateStrings:y :e -> [#Quasi, '', [x].concat(y)],
+ text = ['\u2018' char*:x] :y :e -> [#Quasi, #Unicode, [x].concat(y)],
+ text = ['\u201c' templateString:x] templateStrings:y :e -> [#Quasi, #Unicode, [x].concat(y)],
+ text = [quasiTag:tag '`' templateString:x] templateStrings:y :e -> [#Quasi, tag, [x].concat(y)],
+ quasiTag = identifier | empty,
+ templateString = (interpolation | char)*,
+ //templateStrings = [[anything*]*],
+ templateStrings = [(skip:x -> x | [templateString:x] -> x)*:y] -> y,
+ //interpolation = '{' (~'}' char)*:x '}' -> [#Expression, x],
+ interpolation = '{' expression:x '}' -> x,
+
+ element = [tagName:tag classList:cls id?:id spaces binding?:bind] [blocks:body] :e
+ -> (bind ?
+ [#Binding, bind[0], bind[1], [#Element, tag, [cls, id], body]] :
+ [#Element, tag, [cls, id], body]),
+ simpleName = (escapedChar | ~('.'|'#'|space) char)+:x -> x.join(''),
+ tagName = simpleName,
+ aclass = '.' simpleName,
+ classList = aclass*,
+ id = '#' simpleName,
+
+ attribute = ['@' attrName:attr (assignmentOperator:op char*:x)?] :y
+ expression(x.concat(y.join(''))):exp
+ -> [#Attribute, attr, op, exp],
+ attrName = (~space char)+:x -> x.join(''),
+ assignmentOperator = space+ (('+' | '-' | '^' | '$')? '='):x space+ -> x,
+
+ placeholder = [id:id spaces bindingForm?:bind] [blocks:body]
+ -> (bind ?
+ [#Binding, bind[0], bind[1], [#Placeholder, id, null, body]] :
+ [#Placeholder, id, null, body]),
+
+
+ literal = booleanLiteral | numberLiteral | stringLiteral | listLiteral | tupleLiteral,
+
+ booleanLiteral "true" -> [#True],
+ booleanLiteral "false" -> [#False],
+
+ numberLiteral "NaN" -> [#NaN],
+ numberLiteral "Infinite" -> [#PosInf],
+ numberLiteral "+Infinite" -> [#PosInf],
+ numberLiteral "-Infinite" -> [#NegInf],
+ numberLiteral ('+' | '-')?:a digit+:b ('.':c digit*:d)? ('e':e ('+' | '-'):f digit+:g)?
+ -> [#Number, parseFloat([].concat(a, b, c, d, e, f, g).join(''))],
+
+ stringLiteral = '"' (escapedChar | ~'"' char)*:x '"' -> [#String, x],
+ stringLiteral = '\'' (~'\'' char)*:x '\'' -> [#String, x],
+
+ escapedChar '\\' 'n' -> '\n',
+ escapedChar '\\' 'r' -> '\r',
+ escapedChar '\\' 't' -> '\t',
+ escapedChar '\\' 'f' -> '\f',
+ escapedChar '\\' 'v' -> '\u000b',
+ escapedChar '\\' (hexChar hexChar? hexChar? hexChar? hexChar? hexChar?):u space? -> toUTF16(parseInt(u, 16)),
+ escapedChar '\\' 'u' (hexChar hexChar hexChar hexChar):u -> String.fromCharCode(parseInt(u, 16)),
+ escapedChar '\\' char:c -> c,
+ hexChar char:c ?(/^[0-9a-f]/i.test(c)),
+
+ listLiteral = '[' spaces (listItem comma)*:x listItem?:y spaces ']' -> [#List, y ? x.concat([y]) : x],
+ listItem = expression,
+
+ tupleLiteral = '(' spaces (tupleItem comma)*:x tupleItem?:y spaces ')' -> [#Tuple, y ? x.concat([y]) : x],
+ tupleItem = expression,
+
+ comma = spaces ',' spaces,
+
+ expression = exp1,
+ op1 = spaces ("->" | "<-"):x spaces -> x,
+ op2 = spaces ("||" | "&&"):x spaces -> x,
+ op3 = spaces ("===" | "!==" | "==" | "!=" | "<=>" | ">=" | "<=" | ">" | "<"):x spaces -> x,
+ op4 = spaces ("<<<" | ">>>" | "<<" | ">>"):x spaces -> x,
+ op5 = spaces ("?:"):x spaces -> x,
+ op6 = spaces ("+" | "-"):x spaces -> x,
+ op7 = spaces ("×" | "÷"):x spaces -> x,
+ op8 = spaces ("!"):x spaces -> x,
+ op9 = spaces ("?." | "." | "!"):x spaces -> x,
+ exp1 = exp1:x op1:op exp2:y -> [#BinaryOp, op, x, y] | exp2,
+ exp2 = exp2:x op2:op exp3:y -> [#BinaryOp, op, x, y] | exp3,
+ exp3 = exp3:x op3:op exp4:y -> [#BinaryOp, op, x, y] | exp4,
+ exp4 = exp4:x op4:op exp5:y -> [#BinaryOp, op, x, y] | exp5,
+ exp5 = exp5:x op5:op exp6:y -> [#BinaryOp, op, x, y] | exp6,
+ exp6 = exp6:x op6:op exp7:y -> [#BinaryOp, op, x, y] | exp7,
+ exp7 = exp7:x op7:op exp8:y -> [#BinaryOp, op, x, y] | exp8,
+ exp8 = op8:op exp8:x -> [#UnaryOp, op, x] | exp9,
+ exp9 = exp9:x op9:op exp9:y -> [#BinaryOp, op, x, y] | atomic,
+ atomic = literal | variable,
+
+ variable = identifier:x ('/' identifier:id -> id)*:y
+ -> [#Ref, x].concat(y),
+ identifier = '*' | (digit | letter)+,
+ parameters = listOf('identifier', ','),
+ bindingNames = parameters | '(' spaces parameters:x spaces ')' -> x,
+ END
+}
+
+test(Parser, ['', 'head', '\t@title = 0', '\ttitle', '\t\t"Hello {user}'], 'blocks')
View
123 archive/ometa/ometa-samples/bs-ometa-compiler.ometajs
@@ -0,0 +1,123 @@
+ometa BSOMetaParser {
+ space = ^space | fromTo('//', '\n') | fromTo('/*', '*/'),
+ nameFirst = '_' | '$' | letter,
+ nameRest = nameFirst | digit,
+ tsName = <nameFirst nameRest*>,
+ name = spaces tsName,
+ eChar = '\\' char:c -> unescape('\\' +c)
+ | char,
+ tsString = '\'' (~'\'' eChar)*:xs '\'' -> xs.join(''),
+ characters = '`' '`' (~('\'' '\'') eChar)*:xs '\'' '\'' -> [#App, #seq, inspect(xs.join(''))],
+ sCharacters = '"' (~'"' eChar)*:xs '"' -> [#App, #token, inspect(xs.join(''))],
+ string = (('#' | '`') tsName | tsString):xs -> [#App, #exactly, inspect(xs)],
+ number = <'-'? digit+>:n -> [#App, #exactly, n],
+ keyword :xs = token(xs) ~letterOrDigit -> xs,
+ args = '(' listOf(#hostExpr, ','):xs ")" -> xs
+ | empty -> [],
+ application = "^" name:rule args:as -> [#App, "super", "'" + rule + "'"].concat(as)
+ | name:grm "." name:rule args:as -> [#App, "foreign", grm, "'" + rule + "'"].concat(as)
+ | name:rule args:as -> [#App, rule].concat(as),
+ hostExpr = BSSemActionParser.asgnExpr:r BSJSTranslator.trans(r),
+ curlyHostExpr = BSSemActionParser.curlySemAction:r BSJSTranslator.trans(r),
+ primHostExpr = BSSemActionParser.semAction:r BSJSTranslator.trans(r),
+ atomicHostExpr = curlyHostExpr | primHostExpr,
+ semAction = curlyHostExpr:x -> [#Act, x]
+ | "!" atomicHostExpr:x -> [#Act, x],
+ arrSemAction = "->" atomicHostExpr:x -> [#Act, x],
+ semPred = "?" atomicHostExpr:x -> [#Pred, x],
+ expr = expr5(true):x ("|" expr5(true))+:xs -> [#Or, x].concat(xs)
+ | expr5(true):x ("||" expr5(true))+:xs -> [#XOr, x].concat(xs)
+ | expr5(false),
+ expr5 :ne = interleavePart:x ("&&" interleavePart)+:xs -> [#Interleave, x].concat(xs)
+ | expr4(ne),
+ interleavePart = "(" expr4(true):part ")" -> ["1", part]
+ | expr4(true):part modedIPart(part),
+ modedIPart = [#And [#Many :part]] -> ["*", part]
+ | [#And [#Many1 :part]] -> ["+", part]
+ | [#And [#Opt :part]] -> ["?", part]
+ | :part -> ["1", part],
+ expr4 :ne = expr3*:xs arrSemAction:act -> [#And].concat(xs).concat([act])
+ | ?ne expr3+:xs -> [#And].concat(xs)
+ | ?(ne == false) expr3*:xs -> [#And].concat(xs),
+ optIter :x = '*' -> [#Many, x]
+ | '+' -> [#Many1, x]
+ | '?' -> [#Opt, x]
+ | empty -> x,
+ optBind :x = ':' name:n -> { this.locals.push(n); [#Set, n, x] }
+ | empty -> x,
+ expr3 = ":" name:n -> { this.locals.push(n); [#Set, n, [#App, #anything]] }
+ | (expr2:x optIter(x) | semAction):e optBind(e)
+ | semPred,
+ expr2 = "~" expr2:x -> [#Not, x]
+ | "&" expr1:x -> [#Lookahead, x]
+ | expr1,
+ expr1 = application
+ | ( keyword('undefined') | keyword('nil')
+ | keyword('true') | keyword('false') ):x -> [#App, #exactly, x]
+ | spaces (characters | sCharacters | string | number)
+ | "[" expr:x "]" -> [#Form, x]
+ | "<" expr:x ">" -> [#ConsBy, x]
+ | "@<" expr:x ">" -> [#IdxConsBy, x]
+ | "(" expr:x ")" -> x,
+ ruleName = name
+ | spaces tsString,
+ rule = &(ruleName:n) !(this.locals = ['$elf=this', '_fromIdx=this.input.idx'])
+ rulePart(n):x ("," rulePart(n))*:xs -> [#Rule, n, this.locals, [#Or, x].concat(xs)],
+ rulePart :rn = ruleName:n ?(n == rn) expr4:b1 ( "=" expr:b2 -> [#And, b1, b2]
+ | empty -> b1
+ ),
+ grammar = keyword('ometa') name:n
+ ( "<:" name | empty -> 'OMeta' ):sn
+ "{" listOf(#rule, ','):rs "}" BSOMetaOptimizer.optimizeGrammar(
+ [#Grammar, n, sn].concat(rs)
+ )
+}
+
+// By dispatching on the head of a list, the following idiom allows translators to avoid doing a linear search.
+// (Note that the "=" in a rule definition is optional, so you can give your rules an "ML feel".)
+ometa BSOMetaTranslator {
+ App 'super' anything+:args -> [this.sName, '._superApplyWithArgs(this,', args.join(','), ')'] .join(''),
+ App :rule anything+:args -> ['this._applyWithArgs("', rule, '",', args.join(','), ')'] .join(''),
+ App :rule -> ['this._apply("', rule, '")'] .join(''),
+ Act :expr -> expr,
+ Pred :expr -> ['this._pred(', expr, ')'] .join(''),
+ Or transFn*:xs -> ['this._or(', xs.join(','), ')'] .join(''),
+ XOr transFn*:xs { inspect(xs.unshift((this.name + "." + this.rName))) }
+ -> ['this._xor(', xs.join(','), ')'] .join(''),
+ And notLast(#trans)*:xs trans:y
+ {xs.push('return ' + y)} -> ['(function(){', xs.join(';'), '}).call(this)'] .join(''),
+ And -> 'undefined',
+ Opt transFn:x -> ['this._opt(', x, ')'] .join(''),
+ Many transFn:x -> ['this._many(', x, ')'] .join(''),
+ Many1 transFn:x -> ['this._many1(', x, ')'] .join(''),
+ Set :n trans:v -> [n, '=', v] .join(''),
+ Not transFn:x -> ['this._not(', x, ')'] .join(''),
+ Lookahead transFn:x -> ['this._lookahead(', x, ')'] .join(''),
+ Form transFn:x -> ['this._form(', x, ')'] .join(''),
+ ConsBy transFn:x -> ['this._consumedBy(', x, ')'] .join(''),
+ IdxConsBy transFn:x -> ['this._idxConsumedBy(', x, ')'] .join(''),
+ JumpTable jtCase*:cases -> this.jumpTableCode(cases),
+ Interleave intPart*:xs -> ['this._interleave(', xs.join(','), ')'] .join(''),
+
+ Rule :name {this.rName = name}
+ locals:ls trans:body -> ['\n"', name, '":function(){', ls, 'return ', body, '}'] .join(''),
+ Grammar :name :sName
+ {this.name = name}
+ {this.sName = sName}
+ trans*:rules -> ['var ', name, "=exports.", name, '=objectThatDelegatesTo(', sName, ',{', rules.join(','), '})'].join(''),
+ intPart = [:mode transFn:part] -> (inspect(mode) + "," + part),
+ jtCase = [:x trans:e] -> [inspect(x), e],
+ locals = [string+:vs] -> ['var ', vs.join(','), ';'] .join('')
+ | [] -> '',
+ trans = [:t apply(t):ans] -> ans,
+ transFn = trans:x -> ['(function(){return ', x, '})'] .join('')
+}
+BSOMetaTranslator.jumpTableCode = function(cases) {
+ var buf = new StringBuffer()
+ buf.put("(function(){switch(this._apply('anything')){")
+ for (var i = 0; i < cases.length; i += 1)
+ buf.put("case " + cases[i][0] + ":return " + cases[i][1] + ";")
+ buf.put("default: throw fail()}}).call(this)")
+ return buf.contents()
+}
+
View
5 archive/ometa/ometa-samples/local.ometajs
@@ -0,0 +1,5 @@
+ometa Local {
+ plus %(this.x = 1, this.y = {}) = '+' %(this.y = 1) -> this.x * this.y,
+ minus = '-' -> 0,
+ rule { this.x = 0 } (plus | minus):v -> this.x + v
+}
View
8 archive/ometa/ometa-samples/lr.ometajs
@@ -0,0 +1,8 @@
+ometa LeftRecursion {
+ number = <digit+ ('.' digit+)?>:f spaces -> [#number, parseFloat(f)],
+ expr = expr:a "+" number:b -> ['+', a, b]
+ | expr:a "-" number:b -> ['-', a, b]
+ | number:a -> a,
+ exprs = exprs:a "," expr:b -> [',', a, b]
+ | expr:b -> b
+}
View
5 archive/ometa/ometa-samples/regr-1.ometajs
@@ -0,0 +1,5 @@
+ometa Regr1 {
+ isKeyword = :x ?(x === 'a') -> true
+ | :x ?(x === 'b') -> true,
+ run = isKeyword('b'):r -> r
+}
View
4 archive/ometa/ometa-samples/rep-rule.ometajs
@@ -0,0 +1,4 @@
+ometa Grammar {
+ rule false -> false,
+ rule true -> true
+}
View
322 archive/ometa/ometa-samples/xjst.ometajs
@@ -0,0 +1,322 @@
+var ometajs = require('ometajs'),
+ xjst = require('../../xjst'),
+ utils = xjst.utils,
+
+ Identifier = utils.Identifier,
+ BSJSParser = ometajs.BSJSParser,
+ BSJSTranslator = ometajs.BSJSTranslator,
+ BSJSIdentity = ometajs.BSJSIdentity;
+
+ometa XJSTParser <: BSJSParser {
+
+ isKeyword :x = ?(BSJSParser._isKeyword(x) || x === 'local' ||
+ x === 'apply' || x === 'template' || x === 'extends' ||
+ x === 'super'),
+
+ primExprHd = "local" "(" expr:a ")" asgnExpr:b localExpr([#local, a, b]):r -> r
+ | "super" "apply" "(" ")" superExpr([#super]):st -> st
+ | "super" "apply" "(" expr:a ")" superExpr([#super]):st
+ localExpr([#local, a, st]):r -> r
+ | "apply" "(" ")" applyStmt([#apply]):st -> st
+ | "apply" "(" expr:a ")" applyStmt([#apply]):st
+ localExpr([#local, a, st]):r -> r
+ | "apply" applyExpr([#apply]):expr -> expr
+ | ^primExprHd,
+
+ stmt = "local" "(" expr:a ")" stmt:b localStmt([#local, a, b]):r -> r
+ | "super" "apply" "(" ")" superStmt([#super]):st -> st
+ | "super" "apply" "(" expr:a ")" superStmt([#super]):st
+ localStmt([#local, a, st]):r -> r
+ | "apply" "(" ")" applyStmt([#apply]):st -> st
+ | "apply" "(" expr:a ")" applyStmt([#apply]):st
+ localStmt([#local, a, st]):r -> r
+ | ^stmt,
+
+ extends = "extends" spaces str:filename -> [#extends, filename[1]],
+
+ template = "template" "(" expr:m ")" stmt:b -> [#template, m, b],
+
+ superExpr = [#super] applyStmt([#apply]):st -> [#superExpr, st],
+ superStmt = [#super] applyStmt([#apply]):st -> [#superStmt, st],
+
+ applyStmt = [#apply] -> [#nhApplyStmt, {}],
+ applyExpr = [#apply] -> [#nhApplyExpr],
+
+ localStmt = [#local :a :b] -> [#localStmt, a, b],
+ localExpr = [#local :a :b] -> [#localExpr, a, b],
+
+ topLevel = (
+ extends:t -> t |
+ template:t -> t |
+ srcElem:s -> [#stmt, s]
+ )+:ts spaces end -> ts
+}
+
+ometa XJSTTranslator <: BSJSIdentity {
+
+ const = [#string :s] | [#number :n],
+
+ extends :filename -> [#extends, filename],
+
+ superStmt :op localStmt([
+ #json,
+ [#binding, '__d0' + this.id, [#get, true]]
+ ], op):st -> {
+ st
+ },
+ superExpr :op localExpr([
+ #json,
+ [#binding, '__d' + this.id, [#get, true]]
+ ], op):st -> {
+ st
+ },
+
+ nhApplyStmt :p -> [#applyStmt, p],
+ nhApplyExpr -> [#nhApplyExpr],
+
+ localStmt localAsmts:as trans:t -> {
+ [#begin].concat(
+ [[
+ #localStart,
+ XJSTTranslator._localToPred(this.identifier, as),
+ []
+ ]],
+ as[0],
+ [t],
+ as[1],
+ [[#localEnd]]
+ );
+ },
+
+ localExpr localAsmts:as trans:t -> {
+ var result = XJSTTranslator._getLocalVar(this),
+ prelude = [
+ [
+ #localStart,
+ XJSTTranslator._localToPred(this.identifier, as),
+ as[0].filter(function(op) {
+ return op[0] === 'var';
+ }).map(function(op) {
+ return op.slice(1).map(function(asmt) {
+ return [asmt[0]];
+ });
+ }).concat([[[result[1]]]])
+ ]
+ ],
+ self = this;
+
+ as[0].forEach(function(e) {
+ if (e[0] === 'var') {
+ e.slice(1).forEach(function(v) {
+ prelude.push([#set, [#get, v[0]], v[1]]);
+ });
+ } else {
+ prelude.push(e);
+ }
+ });
+
+ [].concat(
+ prelude,
+ [[#set, result, t]],
+ as[1],
+ [[#localEnd], result]
+ ).reduce(function(a, i) {
+ return a ? [#binop, ",", a, i] : i;
+ });
+ },
+
+ bindingToAsmt = [#binding :k :v]
+ localAsmt([#set, [#getp, [#string, k], [#get, '__this']], v]):r -> r,
+
+ localAsmts = [#json bindingToAsmt*:as] -> {
+ var es = [];
+
+ as.forEach(function(a) {
+ a.forEach(function(e, i) {
+ es[i] = es[i] ? es[i].concat(e) : e;
+ });
+ });
+
+ es
+ }
+ | localAsmt:e1 -> e1
+ | [#binop ',' localAsmts:es localAsmt:e2] -> {
+ es.forEach(function(e, i) {
+ es[i] = e.concat(e2[i]);
+ });
+ es
+ },
+
+ localAsmt = [#set [(#get :n | #getp :k :o)]:p :v]
+ localProps(p):props -> {
+ var lv = XJSTTranslator._getLocalVar(this),
+ vars = [[#var].concat(props[1], [[lv[1], props[0]]])];
+
+ [
+ vars.concat([[#set, props[0], v]]),
+ [[#set, props[0], lv]],
+ [[p, v]]
+ ]
+ },
+
+ localProps = [#getp const:k [#this]]:expr -> [expr, []]
+ | [#getp const:k [#get :o]]:expr -> [expr, []]
+ | [#getp :k [#this]] -> {
+ var v = XJSTTranslator._getLocalVar(this);
+
+ [ [#getp, v, [#this]], [[v[1], k]] ]
+ } | [#getp const:k :o] -> {
+ var v = XJSTTranslator._getLocalVar(this);
+
+ [ [#getp, k, v], [[v[1], o]] ]
+ } | [#getp :k :o] -> {
+ var v1 = XJSTTranslator._getLocalVar(this),
+ v2 = XJSTTranslator._getLocalVar(this);
+
+ [
+ [#getp, v1, v2],
+ [[v1[1], k], [v2[1], o]]
+ ]
+ } | :expr -> [expr, []],
+
+ subMatch = [#binop '===' :e1 const:c] -> [e1, c] |
+ [#binop '===' const:c :e2] -> [e2, c] |
+ :e3 -> [[#unop, '!', e3], [#get, #false]],
+
+ expr2match = [#binop '&&' expr2match:ms subMatch:m1] -> { ms.push(m1); ms} |
+ subMatch:m2 -> [m2] ,
+
+ template :m trans:b -> [
+ #template,
+ [XJSTTranslator.match(m, #expr2match), b]
+ ],
+ stmt trans:s -> [#stmt, s],
+
+ topLevel :id = {
+ this.id = id; this._vars = []; this.identifier = new Identifier();
+ } trans*:ts -> {
+
+ if (this._vars.length) {
+ this._vars.unshift(#var);
+ ts.unshift([#stmt, this._vars]);
+ }
+
+ XJSTTranslator._splitTemplates(this.identifier, ts);
+ }
+
+}
+
+XJSTTranslator._getLocalIdCounter = 0;
+XJSTTranslator._getLocalId = function() {
+ return this._getLocalIdCounter++;
+};
+XJSTTranslator._getLocalVar = function(p) {
+ var id = this._getLocalId();
+ return [#get, '__r' + id];
+};
+
+XJSTTranslator._localToPred = function(identifier, as) {
+ return as[2].map(function(as) {
+ function replaceThis(as) {
+ if (Array.isArray(as)) {
+ if (as[0] === 'get' && as[1] === '__this') return ['this'];
+ return as.map(replaceThis);
+ } else {
+ return as;
+ }
+ }
+
+ as = [identifier.identify(replaceThis(as[0])), as[0], as[1]];
+ if (as[2][0] !== 'string' && as[2][0] !== 'number') {
+ return [as[0], as[1], 'reset'];
+ } else {
+ return as;
+ }
+ });
+};
+
+XJSTTranslator._splitTemplates = function(predicates, ts) {
+ var extend = [],
+ templates = [],
+ other = [],
+ i;
+
+ while(i = ts.shift())
+ i[0] === 'extends' ?
+ extend.push(i[1]) :
+ i[0] === 'template'?
+ templates.push(i[1]) :
+ other.push(i[1]);
+
+ return [
+ other,
+ XJSTTranslator._identify(predicates, templates.reverse()),
+ extend
+ ];
+};
+
+XJSTTranslator._identify = function(predicates, templates) {
+ templates.forEach(function(template) {
+ template[0].forEach(function(subMatch) {
+ subMatch.unshift(predicates.identify(subMatch[0]));
+ })
+ });
+
+ return templates;
+};
+
+ometa XJSTLocalAndApplyCompiler <: BSJSIdentity {
+ extends :filename -> [#extends, filename],
+ superStmt trans:op -> [#superStmt, op],
+ superExpr trans:op -> [#superExpr, op],
+
+ applyStmt = :p -> { this.result.push(['apply', p]); [#applyStmt, p] },
+ nhApplyExpr = [#nhApplyExpr],
+
+ localStart = :as :vars -> {
+ this.result.push(['localStart', as, vars]); [#localStart, as, vars]
+ },
+ localEnd -> { this.result.push(['localEnd']); [#localEnd] },
+
+ topLevel = { this.result = []; } trans:t { this.result; }
+}
+
+ometa XJSTCompiler <: BSJSTranslator {
+ extends trans:filename -> { '"extends" + ' + filename },
+ superStmt trans:op -> op,
+ superExpr trans:op -> op,
+
+ applyStmt = :param -> { param.code || 'apply.call(__this)' },
+
+ nhApplyStmt = :param -> 'apply()',
+ nhApplyExpr -> 'apply',
+
+ localStmt = trans:a trans:b -> { 'local (' + a + ') ' + b + ';' },
+ localExpr = trans:a trans:b -> { 'local (' + a + ') ' + b },
+
+ localStart = :as :vars -> '""',
+ localEnd -> '""',
+
+ subMatch = [:id trans:m [#get #true]] -> m |
+ [:id trans:e trans:c] -> (e + ' === ' + c),
+
+ tMatch = [subMatch:m] -> m |
+ [subMatch+:ms] -> ms.join(' && '),
+
+ tBody = trans:e -> e,
+
+ template = [tMatch:m tBody:b] -> ('if(' + m + ') {' + b + ';return}'),
+
+ templates = [template*:ts] -> ('exports.apply = apply;function apply(c) {\nvar __this = this;\n' + ts.join('\n') +'\n};'),
+
+ other = [trans*:o] -> o.join(';'),
+
+ skipBraces = [#begin skipBraces*:e] -> e.join(';')
+ | trans:e -> e,
+
+ topLevel = [other:o templates:t] -> {
+ '(function(exports) {' +
+ o + ';' + t +
+ 'return exports})(typeof exports === "undefined"? {} : exports)' }
+
+}
View
7 archive/ometa/stacksize.js
@@ -0,0 +1,7 @@
+var i = 0
+function a(x) {
+ i++
+ if (i % 100 === 0) console.log(i)
+ a.apply(null, new Array(i))
+}
+a(100)
View
47 archive/ometa/tabish.ometajs
@@ -0,0 +1,47 @@
+
+ometa Lines {
+ lines = line*,
+ line whitespace* eol -> '',
+ line whitespace* (ignore content):x eol -> x,
+ line content:x eol -> x,
+
+ ignore = '/' '/',
+ content = (~eol char)*,
+ eol = '\r' '\n' | '\n' '\r' | '\n' | '\r' | end,
+ whitespace = ~eol space | '\u0085',
+}
+
+ometa UnicodeLines <: Lines {
+ eol = ^eol | /^[\u2028\u2029]/,
+ whitespace = ^whitespace | /^[\u00A0\u1680\u180E\u2000-\u200A\u202F\u205F\u3000\uFDD0-\uFDEF\uFEFF\uFFFE\uFFFF]/),
+}
+
+ometa Blocks {
+ blocks startBody (skip | parseBlock | offside)*:x endBody -> x,
+ startBody -> { if (!this.indents) this.indents = []; this.indents.unshift(null) },
+ endBody -> { this.indents.shift() },
+
+ parseBlock
+ [indent mixed?:error char*:head]
+ (skip | [indent tab char*:x] -> x)*:body
+ block(head, body, error),
+
+ block :head :body :error -> [#Block, head, body].concat(error ? [error] : []),
+
+ offside :line -> [#Offside, line],
+ mixed /^[\u0000-\u0020\u0085\u00A0\u1680\u180E\u2000-\u200A\u202F\u205F\u3000\uFDD0-\uFDEF\uFEFF\uFFFE\uFFFF]+/:whitespaces
+ -> [#MixedWhitespaces, whitespaces],
+
+ skip [],
+ skip [ignore char*],
+ ignore = '/' '/',
+
+ indent = ?(this.indents[0] === null) tab*:x { this.indents[0] = x.length },
+ indent = repeat('tab', this.indents[0]),
+
+ tab = '\t' | tabSize:x ?(x !== null) repeat('sp', x),
+ sp = ' ',
+ tabSize -> null,
+
+ repeat :r :n = ?(n === 0) | apply(r) repeat(r, n - 1),
+}
View
30 archive/ometa/test2.js
@@ -0,0 +1,30 @@
+
+
+//console.log(Object.keys(ometa.globals))
+//require('./jedi2')
+
+//ometa.translateCode('')
+
+var fs = require('fs')
+
+var code = fs.readFileSync('./jedi2.ometajs', 'utf-8')
+
+var code = require('./api.js').translateCode(code)
+
+var util = require('./util')
+
+function test(ometa, input, rule, args) {
+ console.log(
+ util.inspect(util.flattenStrings(ometa.matchAll(input, rule, args)), false, 10, true)
+ )
+}
+
+function toUTF16(codePoint) {
+ if (codePoint < 0x10000) return String.fromCharCode(codePoint)
+ codePoint -= 0x10000
+ var lead = (codePoint >> 10) + 0xd800
+ var trail = (codePoint & 0x3ff) + 0xdc00
+ return String.fromCharCode(lead, trail)
+}
+
+eval(code)
View
40 archive/ometa/testing.ometajs
@@ -0,0 +1,40 @@
+ometa Test {
+ testString1 = ('Hello' 'world' '!'),
+ testString2 = 'Hello',
+ testChars = ``Hello'',
+ testList1 = ['H' 'e' 'l' 'l' 'o'],
+ testList2 = [testChars],
+ testSymbol = 'H',
+ pattern = /(ab*)c/,
+ p2 = 'T' pattern ``bc'',
+ emptyEnd = empty end,
+}
+
+ometa TestRe {
+ test = /test/i,
+ start = 'T',
+ end = 'T',
+ source = (start test end):x -> x,
+}
+
+/*
+console.log(TestRe.matchAll('test...', 'test'))
+console.log(TestRe.matchAll('TtestT', 'source'))
+console.log(TestRe.matchAll('T.tesT', 'source'))
+*/
+
+/*
+console.log(t.Test.matchAll('Hello', 'testChars'))
+//console.log(t.Test.match('Hello'.split(''), 'testChars'))
+console.log(t.Test.match('Hello', 'testList1'))
+console.log(t.Test.match('Hello', 'testList2'))
+console.log(t.Test.match('Hello'.split(''), 'testList1'))
+console.log(t.Test.match('Hello'.split(''), 'testList2'))
+//console.log(t.Test.matchAll('Hello', 'testString'))
+console.log(t.Test.matchAll('Hello', 'testSymbol'))
+console.log(t.Test.matchAll(['H'], 'testSymbol'))
+console.log(t.Test.matchAll('H', 'testSymbol'))
+console.log(t.Test.match('H', 'testSymbol'))
+console.log(t.Test.match('H', 'testSymbol'))
+//console.log(t.Test.matchAll(['Hello', 'world', '!'], 'testString'))
+*/
View
0 parser.js → archive/parser.js
File renamed without changes.
View
0 views/test.jade → archive/views/test.jade
File renamed without changes.
View
0 views/test.jedi → archive/views/test.jedi
File renamed without changes.

0 comments on commit 597f4dd

Please sign in to comment.