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";
|
||||
|
||||
const main = async () => {
|
||||
let basepathExamplesJSFiles = "../next.js";
|
||||
let basepathExamplesJSFiles = "../three.js";
|
||||
let examples = (await readdir(basepathExamplesJSFiles, { recursive: true }))
|
||||
.filter((x) => x.endsWith(".js"))
|
||||
.map((x) => basepathExamplesJSFiles + "/" + x);
|
||||
|
|
|
@ -201,18 +201,9 @@ export class Matcher {
|
|||
}
|
||||
}
|
||||
|
||||
for (let [key, val] of Object.entries(aplToNode)) {
|
||||
if (keys_to_ignore.includes(key)) {
|
||||
continue;
|
||||
}
|
||||
if (typeof val !== "object") {
|
||||
if (codeNode[key] !== val) {
|
||||
return MatchResult.NoMatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return MatchResult.Matched;
|
||||
return codeNode.type === aplToNode.type
|
||||
? MatchResult.Matched
|
||||
: MatchResult.NoMatch;
|
||||
}
|
||||
|
||||
multiStatementMatcher(code: TreeNode<t.Node>, aplTo: TreeNode<t.Node>) {
|
||||
|
|
|
@ -71,7 +71,7 @@ export function transform(
|
|||
return [output, amount];
|
||||
}
|
||||
|
||||
function transformSelfHosted(
|
||||
export function transformSelfHosted(
|
||||
recipe: TransformRecipe,
|
||||
internals: Wildcard[],
|
||||
codeAST: t.Node
|
||||
|
|
Loading…
Reference in a new issue