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
1import defineFunction from "../defineFunction";2import ParseError from "../ParseError";3import {assertNodeType} from "../parseNode";4import environments from "../environments";5 6import type {ParseNode} from "../parseNode";7 8// Environment delimiters. HTML/MathML rendering is defined in the corresponding9// defineEnvironment definitions.10defineFunction({11 type: "environment",12 names: ["\\begin", "\\end"],13 props: {14 numArgs: 1,15 argTypes: ["text"],16 },17 handler({parser, funcName}, args) {18 const nameGroup = args[0];19 if (nameGroup.type !== "ordgroup") {20 throw new ParseError("Invalid environment name", nameGroup);21 }22 let envName = "";23 for (let i = 0; i < nameGroup.body.length; ++i) {24 envName += assertNodeType(nameGroup.body[i], "textord").text;25 }26 27 if (funcName === "\\begin") {28 // begin...end is similar to left...right29 if (!environments.hasOwnProperty(envName)) {30 throw new ParseError(31 "No such environment: " + envName, nameGroup);32 }33 // Build the environment object. Arguments and other information will34 // be made available to the begin and end methods using properties.35 const env = environments[envName];36 const {args, optArgs} =37 parser.parseArguments("\\begin{" + envName + "}", env);38 const context = {39 mode: parser.mode,40 envName,41 parser,42 };43 const result = env.handler(context, args, optArgs);44 parser.expect("\\end", false);45 const endNameToken = parser.nextToken;46 const end = assertNodeType(parser.parseFunction(), "environment");47 if (end.name !== envName) {48 throw new ParseError(49 `Mismatch: \\begin{${envName}} matched by \\end{${end.name}}`,50 endNameToken);51 }52 // env.handler returns the specific node type (e.g. "array"),53 // not "environment". This cast is unavoidable: defineFunction54 // requires the handler to return ParseNode<"environment"> but55 // \begin delegates to environment handlers with different types.56 return result as unknown as ParseNode<"environment">;57 }58 59 return {60 type: "environment",61 mode: parser.mode,62 name: envName,63 nameGroup,64 };65 },66});67 