Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1export function wrap(result) {2 let program, module, comments, errors;3 return {4 get program() {5 if (!program) program = jsonParseAst(result.program);6 return program;7 },8 get module() {9 if (!module) module = result.module;10 return module;11 },12 get comments() {13 if (!comments) comments = result.comments;14 return comments;15 },16 get errors() {17 if (!errors) errors = result.errors;18 return errors;19 },20 };21}22 23// Used by `napi/playground/scripts/patch.js`.24//25// Set `value` field of `Literal`s which are `BigInt`s or `RegExp`s.26//27// Returned JSON contains an array `fixes` with paths to these nodes28// e.g. for `123n; foo(/xyz/)`, `fixes` will be29// `[["body", 0, "expression"], ["body", 1, "expression", "arguments", 2]]`.30//31// Walk down the AST to these nodes and alter them.32// Compiling the list of fixes on Rust side avoids having to do a full AST traversal on JS side33// to locate the likely very few `Literal`s which need fixing.34export function jsonParseAst(programJson) {35 const { node: program, fixes } = JSON.parse(programJson);36 for (const fixPath of fixes) {37 applyFix(program, fixPath);38 }39 return program;40}41 42function applyFix(program, fixPath) {43 let node = program;44 for (const key of fixPath) {45 node = node[key];46 }47 48 if (node.bigint) {49 node.value = BigInt(node.bigint);50 } else {51 try {52 node.value = RegExp(node.regex.pattern, node.regex.flags);53 } catch {54 // Invalid regexp, or valid regexp using syntax not supported by this version of NodeJS55 }56 }57}58 