Dirty (much like the content you will be converting) parser and converter that bends the rules and expect well-behaved rpy;
Most of the time you just stick an rpy in and get a folder full of files back. It assumes you have a variable with something that can call Say or Pose or or other renpy-ish proxies. I wrote this to work with my phaser library.
import Lexer from "./lexer.mjs";
import Convert2 from "./convert2.js";
import fs from "fs";
const data = fs.readFileSync('./test.yaml', 'utf-8')
const lines = data.split(/\r?\n/).filter(a => a.trim().length > 0);
let convert = new Convert2(lines);
let parsed_lines = [];
let line;
while (line = convert.Tokenize()) {
parsed_lines.push(line);
}
const ast = new RpyFile({}, null);
that'll do donkey.
let i = 0;
while (i < parsed_lines.length) {
let {j, statement} = parseStatement(parsed_lines, i, ast);
//console.log(statement)
i = j
ast.Statements.push(statement)
}
for (let statement of ast.Statements) {
statement.PreProcess();
}
for (let statement of ast.Statements) {
let getLabelName = statement.GetLabelName().replace(/\(.*/g, '');
console.log(getLabelName);
fs.writeFileSync('./out/' + getLabelName + ".js", statement.ConvertToJavascript(), 'utf-8')
}
and print it some where. call preprocess because I like to refractor shit out. don't call it to have hob flob code all nimbly wimbly in there stacked like your hentai harem's tiddy stat.
const pyLine = RenPyLine("if",`not quest.isabelle_stolen["hold_your_horse_dick"] or (quest.isabelle_stolen["hold_your_horse_dick"] and not quest.isabelle_stolen["help_with_the_project"])`.split(" "))
console.log(pyLine)
console.log(new IfStatement(pyLine,null).ConvertToJavascript())
// lexer example