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 { IGNORABLE_RUNTIME_WARNINGS } from '../../constants.js';2import fuzzymatch from '../phases/1-parse/utils/fuzzymatch.js';3import * as w from '../warnings.js';4 5const regex_svelte_ignore = /^\s*svelte-ignore\s/;6 7/** @type {Record<string, string>} Map of legacy code -> new code */8const replacements = {9 'non-top-level-reactive-declaration': 'reactive_declaration_invalid_placement',10 'module-script-reactive-declaration': 'reactive_declaration_module_script',11 'empty-block': 'block_empty',12 'avoid-is': 'attribute_avoid_is',13 'invalid-html-attribute': 'attribute_invalid_property_name',14 'a11y-structure': 'a11y_figcaption_parent',15 'illegal-attribute-character': 'attribute_illegal_colon',16 'invalid-rest-eachblock-binding': 'bind_invalid_each_rest',17 'unused-export-let': 'export_let_unused'18};19 20const codes = w.codes.concat(IGNORABLE_RUNTIME_WARNINGS);21 22/**23 * @param {number} offset24 * @param {string} text25 * @param {boolean} runes26 * @returns {string[]}27 */28export function extract_svelte_ignore(offset, text, runes) {29 const match = regex_svelte_ignore.exec(text);30 if (!match) return [];31 32 let length = match[0].length;33 offset += length;34 35 /** @type {string[]} */36 const ignores = [];37 38 if (runes) {39 // Warnings have to be separated by commas, everything after is interpreted as prose40 for (const match of text.slice(length).matchAll(/([\w$-]+)(,)?/gm)) {41 const code = match[1];42 43 if (codes.includes(code)) {44 ignores.push(code);45 } else {46 const replacement = replacements[code] ?? code.replace(/-/g, '_');47 48 // The type cast is for some reason necessary to pass the type check in CI49 const start = offset + /** @type {number} */ (match.index);50 const end = start + code.length;51 52 if (codes.includes(replacement)) {53 w.legacy_code({ start, end }, code, replacement);54 } else {55 const suggestion = fuzzymatch(code, codes);56 w.unknown_code({ start, end }, code, suggestion);57 }58 }59 60 if (!match[2]) {61 break;62 }63 }64 } else {65 // Non-runes mode: lax parsing, backwards compat with old codes66 for (const match of text.slice(length).matchAll(/[\w$-]+/gm)) {67 const code = match[0];68 69 ignores.push(code);70 71 if (!codes.includes(code)) {72 const replacement = replacements[code] ?? code.replace(/-/g, '_');73 74 if (codes.includes(replacement)) {75 ignores.push(replacement);76 }77 }78 }79 }80 81 return ignores;82}83 84/**85 * Replaces legacy svelte-ignore codes with new codes.86 * @param {string} text87 * @returns {string}88 */89export function migrate_svelte_ignore(text) {90 const match = regex_svelte_ignore.exec(text);91 if (!match) return text;92 93 const length = match[0].length;94 return (95 text.substring(0, length) +96 text.substring(length).replace(/\w+-\w+(-\w+)*/g, (code, _, idx) => {97 let replacement = replacements[code] ?? code.replace(/-/g, '_');98 if (/\w+-\w+/.test(text.substring(length + idx + code.length))) {99 replacement += ',';100 }101 return replacement;102 })103 );104}105 