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
1# regexpu-core [](https://github.com/mathiasbynens/regexpu-core/actions?query=workflow%3Arun-checks) [](https://www.npmjs.com/package/regexpu-core)2 3_regexpu_ is a source code transpiler that enables the use of ES2015 Unicode regular expressions in JavaScript-of-today (ES5).4 5_regexpu-core_ contains _regexpu_’s core functionality, i.e. `rewritePattern(pattern, flag)`, which enables rewriting regular expressions that make use of [the ES2015 `u` flag](https://mathiasbynens.be/notes/es6-unicode-regex) into equivalent ES5-compatible regular expression patterns.6 7## Installation8 9To use _regexpu-core_ programmatically, install it as a dependency via [npm](https://www.npmjs.com/):10 11```bash12npm install regexpu-core --save13```14 15Then, `require` it:16 17```js18const rewritePattern = require('regexpu-core');19```20 21## API22 23This module exports a single function named `rewritePattern`.24 25### `rewritePattern(pattern, flags, options)`26 27This function takes a string that represents a regular expression pattern as well as a string representing its flags, and returns an ES5-compatible version of the pattern.28 29```js30rewritePattern('foo.bar', 'u', { unicodeFlag: "transform" });31// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar'32 33rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'u', { unicodeFlag: "transform" });34// → '(?:[a-z]|\\uD834[\\uDF06-\\uDF08])'35 36rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'ui', { unicodeFlag: "transform" });37// → '(?:[a-z\\u017F\\u212A]|\\uD834[\\uDF06-\\uDF08])'38```39 40_regexpu-core_ can rewrite non-ES6 regular expressions too, which is useful to demonstrate how their behavior changes once the `u` and `i` flags are added:41 42```js43// In ES5, the dot operator only matches BMP symbols:44rewritePattern('foo.bar', '', { unicodeFlag: "transform" });45// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uFFFF])bar'46 47// But with the ES2015 `u` flag, it matches astral symbols too:48rewritePattern('foo.bar', 'u', { unicodeFlag: "transform" });49// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar'50```51 52The optional `options` argument recognizes the following properties:53 54#### Stable regular expression features55 56These options can be set to `false` or `'transform'`. When using `'transform'`, the corresponding features are compiled to older syntax that can run in older browsers. When using `false` (the default), they are not compiled and they can be relied upon to compile more modern features.57 58- `unicodeFlag` - The `u` flag, enabling support for Unicode code point escapes in the form `\u{...}`.59 60 ```js61 rewritePattern('\\u{ab}', '', {62 unicodeFlag: 'transform'63 });64 // → '\\u{ab}'65 66 rewritePattern('\\u{ab}', 'u', {67 unicodeFlag: 'transform'68 });69 // → '\\xAB'70 ```71 72- `dotAllFlag` - The [`s` (`dotAll`) flag](https://github.com/mathiasbynens/es-regexp-dotall-flag).73 74 ```js75 rewritePattern('.', '', {76 dotAllFlag: 'transform'77 });78 // → '[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uFFFF]'79 80 rewritePattern('.', 's', {81 dotAllFlag: 'transform'82 });83 // → '[\\0-\\uFFFF]'84 85 rewritePattern('.', 'su', {86 dotAllFlag: 'transform'87 });88 // → '(?:[\\0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])'89 ```90 91- `unicodePropertyEscapes` - [Unicode property escapes](property-escapes.md).92 93 By default they are compiled to Unicode code point escapes of the form `\u{...}`. If the `unicodeFlag` option is set to `'transform'` they often result in larger output, although there are cases (such as `\p{Lu}`) where it actually _decreases_ the output size.94 95 ```js96 rewritePattern('\\p{Script_Extensions=Anatolian_Hieroglyphs}', 'u', {97 unicodePropertyEscapes: 'transform'98 });99 // → '[\\u{14400}-\\u{14646}]'100 101 rewritePattern('\\p{Script_Extensions=Anatolian_Hieroglyphs}', 'u', {102 unicodeFlag: 'transform',103 unicodePropertyEscapes: 'transform'104 });105 // → '(?:\\uD811[\\uDC00-\\uDE46])'106 ```107 108- `namedGroups` - [Named capture groups](https://github.com/tc39/proposal-regexp-named-groups).109 110 ```js111 rewritePattern('(?<name>.)\\k<name>', '', {112 namedGroups: 'transform'113 });114 // → '(.)\1'115 ```116 117- `unicodeSetsFlag` - [The `v` (`unicodeSets`) flag](https://github.com/tc39/proposal-regexp-set-notation)118 119 ```js120 rewritePattern('[\\p{Emoji}&&\\p{ASCII}]', 'v', {121 unicodeSetsFlag: 'transform'122 });123 // → '[#\\*0-9]'124 ```125 126 By default, patterns with the `v` flag are transformed to patterns with the `u` flag. If you want to downlevel them more you can set the `unicodeFlag: 'transform'` option.127 128 ```js129 rewritePattern('[^[a-h]&&[f-z]]', 'v', {130 unicodeSetsFlag: 'transform'131 });132 // → '[^f-h]' (to be used with /u)133 ```134 135 ```js136 rewritePattern('[^[a-h]&&[f-z]]', 'v', {137 unicodeSetsFlag: 'transform',138 unicodeFlag: 'transform'139 });140 // → '(?:(?![f-h])[\s\S])' (to be used without /u)141 ```142 143- `modifiers` - [Inline `i`/`m`/`s` modifiers](https://github.com/tc39/proposal-regexp-modifiers)144 145 ```js146 rewritePattern('(?i:[a-z])[a-z]', '', {147 modifiers: 'transform'148 });149 // → '(?:[a-zA-Z])([a-z])'150 ```151 152#### Experimental regular expression features153 154These options can be set to `false`, `'parse'` and `'transform'`. When using `'transform'`, the corresponding features are compiled to older syntax that can run in older browsers. When using `'parse'`, they are parsed and left as-is in the output pattern. When using `false` (the default), they result in a syntax error if used.155 156Once these features become stable (when the proposals are accepted as part of ECMAScript), they will be parsed by default and thus `'parse'` will behave like `false`.157 158#### Miscellaneous options159 160- `onNamedGroup`161 162 This option is a function that gets called when a named capture group is found. It receives two parameters:163 the name of the group, and its index.164 165 ```js166 rewritePattern('(?<name>.)\\k<name>', '', {167 onNamedGroup(name, index) {168 console.log(name, index);169 // → 'name', 1170 }171 });172 ```173 174- `onNewFlags`175 176 This option is a function that gets called to pass the flags that the resulting pattern must be interpreted with.177 178 ```js179 rewritePattern('abc', 'um', '', {180 unicodeFlag: 'transform',181 onNewFlags(flags) {182 console.log(flags);183 // → 'm'184 }185 })186 ```187 188### Caveats189 190- [Lookbehind assertions](https://github.com/tc39/proposal-regexp-lookbehind) cannot be transformed to older syntax.191- When using `namedGroups: 'transform'`, _regexpu-core_ only takes care of the _syntax_: you will still need a runtime wrapper around the regular expression to populate the `.groups` property of `RegExp.prototype.match()`'s result. If you are using _regexpu-core_ via Babel, it's handled automatically.192 193## For maintainers194 195### How to publish a new release196 1971. On the `main` branch, bump the version number in `package.json`:198 199 ```sh200 npm version patch -m 'Release v%s'201 ```202 203 Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).204 205 Note that this produces a Git commit + tag.206 2071. Push the release commit and tag:208 209 ```sh210 git push --follow-tags211 ```212 213 Our CI then automatically publishes the new release to npm.214 2151. Once the release has been published to npm, update [`regexpu`](https://github.com/mathiasbynens/regexpu) to make use of it, and [cut a new release of `regexpu` as well](https://github.com/mathiasbynens/regexpu#how-to-publish-a-new-release).216 217 218## Author219 220| [](https://twitter.com/mathias "Follow @mathias on Twitter") |221|---|222| [Mathias Bynens](https://mathiasbynens.be/) |223 224## License225 226_regexpu-core_ is available under the [MIT](https://mths.be/mit) license.227 