Final finishing touches
This commit is contained in:
parent
68b95e1cfd
commit
eb09d691fd
4 changed files with 13 additions and 14 deletions
8
src/api/jstqlsh.ts
Normal file
8
src/api/jstqlsh.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import { SelfHostedRecipe } from "../transform/transform";
|
||||||
|
import { transform } from "../transform/transform";
|
||||||
|
|
||||||
|
export function transformSH(spec: SelfHostedRecipe[], code: string) {
|
||||||
|
let res = transform(spec, code);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ import { readdir } from "node:fs/promises";
|
||||||
import { parseJSTQL } from "./langium/langiumRunner";
|
import { parseJSTQL } from "./langium/langiumRunner";
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
let basepathExamplesJSFiles = "../next.js";
|
let basepathExamplesJSFiles = "../three.js";
|
||||||
let examples = (await readdir(basepathExamplesJSFiles, { recursive: true }))
|
let examples = (await readdir(basepathExamplesJSFiles, { recursive: true }))
|
||||||
.filter((x) => x.endsWith(".js"))
|
.filter((x) => x.endsWith(".js"))
|
||||||
.map((x) => basepathExamplesJSFiles + "/" + x);
|
.map((x) => basepathExamplesJSFiles + "/" + x);
|
||||||
|
|
|
@ -201,18 +201,9 @@ export class Matcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let [key, val] of Object.entries(aplToNode)) {
|
return codeNode.type === aplToNode.type
|
||||||
if (keys_to_ignore.includes(key)) {
|
? MatchResult.Matched
|
||||||
continue;
|
: MatchResult.NoMatch;
|
||||||
}
|
|
||||||
if (typeof val !== "object") {
|
|
||||||
if (codeNode[key] !== val) {
|
|
||||||
return MatchResult.NoMatch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return MatchResult.Matched;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
multiStatementMatcher(code: TreeNode<t.Node>, aplTo: TreeNode<t.Node>) {
|
multiStatementMatcher(code: TreeNode<t.Node>, aplTo: TreeNode<t.Node>) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ export function transform(
|
||||||
return [output, amount];
|
return [output, amount];
|
||||||
}
|
}
|
||||||
|
|
||||||
function transformSelfHosted(
|
export function transformSelfHosted(
|
||||||
recipe: TransformRecipe,
|
recipe: TransformRecipe,
|
||||||
internals: Wildcard[],
|
internals: Wildcard[],
|
||||||
codeAST: t.Node
|
codeAST: t.Node
|
||||||
|
|
Loading…
Reference in a new issue