Explorar el Código

Compiles but not working again

yakomaxa hace 2 años
padre
commit
cecd4d4179
Se han modificado 2 ficheros con 33 adiciones y 15 borrados
  1. 17 15
      src/mol-script/transpile.ts
  2. 16 0
      src/mol-script/transpilers/all.ts

+ 17 - 15
src/mol-script/transpile.ts

@@ -1,7 +1,6 @@
-
 import Transpiler from './transpilers/transpiler'
 import _transpiler from './transpilers/all'
-import compile from './runtime/query/compiler'
+//import compile from './runtime/query/compiler'
 //import compile from './reference-implementation/molql/compiler'
 
 const transpiler: {[index: string]: Transpiler} = _transpiler
@@ -9,21 +8,24 @@ const transpiler: {[index: string]: Transpiler} = _transpiler
 const util = require('util')
 
 function parse(lang: string, str: string) {
-  try {
-    const query = transpiler[lang](str)
-    console.log(str)
-    console.log(util.inspect(query, {depth: 20, color: true}))
-    console.log('\n')
-    compile(query)
-  } catch (e) {
-    console.log(str)
-    console.log(e.message)
-    console.log('\n')
-  }
+    try {
+	const query = transpiler[lang](str);
+	console.log(str);
+	console.log(util.inspect(query, {depth: 20, color: true}));
+	console.log('\n');
+	return query;      
+	//compile(query)
+    } catch (e) {
+	console.log(str);
+	console.log(e.message);
+	console.log('\n');
+    }
 }
 
-const [,,lang, str] = process.argv
+const [,,lang, str] = process.argv;
 
 if (lang && str) {
-  parse(lang, str)
+    parse(lang, str);
 }
+
+default export parse;

+ 16 - 0
src/mol-script/transpilers/all.ts

@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2017 MolQL contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+//import jmol from './jmol/parser'
+//import json from './json/parser'
+//import molQLscript from './molql-script/parser'
+import pymol from './pymol/parser'
+import vmd from './vmd/parser'
+
+export default {
+    pymol,
+    vmd
+}