<commit_before>/**
 * Cheddar, IO.sprintf(<format>, [args ...])
 *
 * Format specification:
 * %[flag][width][.precision]specifier]
 *
 * flag:
 *  -      left justification
 *  +      requires sign to show
 *  #      preceedes value with 0x 0o or 0b
 *  0      prepends width with 0s rather than spaces
 * width:
 *  0-9+   specifies width
 *  *      specifies width from argument
 * precision:
 *  0-9+   specifies width
 *  *      specifies width from argument
 * specifier:
 *  d      decimal
 *  i      integer
 *  x      hexadecimal
 *  X      heXadecimal (uppercase X)
 *  x      binary
 *  X      Binary (uppercase B)
 *  o      octal
 *  O      Octal (uppercase O)
 *  r      array
 *  s      string
 *  c      char, first char of string
 **/

export default function(cheddar) {

    const FORMAT_REGEX =
        /%(-?\+?#?0?)(\d+|\*)?(\.\d+|\.\*)?([dixXrs])/gi;

    // Format of method:
    // [type, cast]
    // cast:
    //  V - object
    //  C - object's cast methods
    // **must** return JS string
    const FORMAT = {
        NUMBER: 'dixXbBoO',
        BASE: 'xXbBoO',
        SPECIFIER: {
            r: [cheddar.array,  (V, C) => C.get("String")(V).value],
            d: [cheddar.number, (V, C) => C.get("String")(V).value],
            i: [cheddar.number, (V, C) => C.get("String")(V).value],
            x: [cheddar.number, (V, C) => V.value.toString(16)],
            X: [cheddar.number, (V, C) => V.value.toString(16).toUpperCase()],<commit_msg>fix [IO]: include all the flags in regex for IO.sprintf<commit_after>/**
 * Cheddar, IO.sprintf(<format>, [args ...])
 *
 * Format specification:
 * %[flag][width][.precision]specifier]
 *
 * flag:
 *  -      left justification
 *  +      requires sign to show
 *  #      preceedes value with 0x 0o or 0b
 *  0      prepends width with 0s rather than spaces
 * width:
 *  0-9+   specifies width
 *  *      specifies width from argument
 * precision:
 *  0-9+   specifies width
 *  *      specifies width from argument
 * specifier:
 *  d      decimal
 *  i      integer
 *  x      hexadecimal
 *  X      heXadecimal (uppercase X)
 *  x      binary
 *  X      Binary (uppercase B)
 *  o      octal
 *  O      Octal (uppercase O)
 *  r      array
 *  s      string
 *  c      char, first char of string
 **/

export default function(cheddar) {

    const FORMAT_REGEX =
        /%(-?\+?#?0?)(\d+|\*)?(\.\d+|\.\*)?([dixXbBoOrsc])/gi;

    // Format of method:
    // [type, cast]
    // cast:
    //  V - object
    //  C - object's cast methods
    // **must** return JS string
    const FORMAT = {
        NUMBER: 'dixXbBoO',
        BASE: 'xXbBoO',
        SPECIFIER: {
            r: [cheddar.array,  (V, C) => C.get("String")(V).value],
            d: [cheddar.number, (V, C) => C.get("String")(V).value],
            i: [cheddar.number, (V, C) => C.get("String")(V).value],
            x: [cheddar.number, (V, C) => V.value.toString(16)],
            X: [cheddar.number, (V, C) => V.value.toString(16).toUpperCase()],
{'fraction_non_alphanumeric': 0.16638823922485801, 'fraction_numerical': 0.009355162044771133, 'mean_word_length': 1.943952802359882, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3717721', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1065, 'n_words': 272}