forked from posecode-dev/posecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiagnose_parser.js
More file actions
24 lines (19 loc) · 820 Bytes
/
Copy pathdiagnose_parser.js
File metadata and controls
24 lines (19 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { readFileSync } from "node:fs";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { parse } from "./packages/posecode-parser/dist/index.js";
const here = dirname(fileURLToPath(import.meta.url));
const repoRoot = here;
const originalDeadlift = readFileSync(resolve(repoRoot, "spec/examples/deadlift.posecode"), "utf-8");
const modified = originalDeadlift.replace(
"knees: flex 25",
"knees: flex 25\n ankles: plantarflex 20"
);
console.log("=== Modified posecode ===");
console.log(modified);
const { ir, errors, warnings } = parse(modified);
console.log("=== Parse results ===");
console.log("Errors:", errors);
console.log("Warnings:", warnings);
console.log("Parsed targets for Lower phase:");
console.log(JSON.stringify(ir.phases[0].targets, null, 2));