<commit_before>// Accepts a grid definition in the human-readable format. Converts it to the internal format,
// appends it to a list of grids and returns the resulting list.
//
// Note that this function only returns a new list, it does not modify the source list.
//
// add-grid($grid-definition, $append-to-list)
// - $grid-definition : <definition>  See documentation for syntax:
//                                    https://github.com/Team-Sass/Singularity/wiki/Creating-Grids
// - $append-to-list  : [list]        A list to append to.
//                                    Defaults to $grids if none is specified.
@function add-grid($grid-definition, $append-to-list: $grids) {
  $parsed:      parse-add($grid-definition); // Converts the definiton to a temporary format:
                                             // either `((grid))` or `((<grid>) (<breakpoint>))`
  $grid:        nth($parsed, 1); // E. g. `(<grid>)`.
  $breakpoint:  nth($parsed, 2); // Either `(<breakpoint>)` or false.
  $list-length: length($append-to-list);
  
  // Check whether the definition will be the first one in the list
  // and whether it has no breakpoint specified.
  @if $breakpoint == false and $list-length == 0 {
    // Returns the first item of the list, e. g. `(<grid>)`
    @return $grid;
  }
  @else {
    // Appends to a comma-separated list of definitions in the internal format
    // and returns it, e. g. `(<grid>), (<grid> <breakpoint>), (<grid> <breakpoint>)`<commit_msg>Fixed a slight typo: missing brackets in a comment<commit_after>// Accepts a grid definition in the human-readable format. Converts it to the internal format,
// appends it to a list of grids and returns the resulting list.
//
// Note that this function only returns a new list, it does not modify the source list.
//
// add-grid($grid-definition, $append-to-list)
// - $grid-definition : <definition>  See documentation for syntax:
//                                    https://github.com/Team-Sass/Singularity/wiki/Creating-Grids
// - $append-to-list  : [list]        A list to append to.
//                                    Defaults to $grids if none is specified.
@function add-grid($grid-definition, $append-to-list: $grids) {
  $parsed:      parse-add($grid-definition); // Converts the definiton to a temporary format:
                                             // either `((<grid>))` or `((<grid>) (<breakpoint>))`
  $grid:        nth($parsed, 1); // E. g. `(<grid>)`.
  $breakpoint:  nth($parsed, 2); // Either `(<breakpoint>)` or false.
  $list-length: length($append-to-list);
  
  // Check whether the definition will be the first one in the list
  // and whether it has no breakpoint specified.
  @if $breakpoint == false and $list-length == 0 {
    // Returns the first item of the list, e. g. `(<grid>)`
    @return $grid;
  }
  @else {
    // Appends to a comma-separated list of definitions in the internal format
    // and returns it, e. g. `(<grid>), (<grid> <breakpoint>), (<grid> <breakpoint>)`
{'fraction_non_alphanumeric': 0.14161946017994, 'fraction_numerical': 0.001999333555481506, 'mean_word_length': 2.3692480359147026, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '515306', 'n_tokens_mistral': 899, 'n_tokens_neox': 866, 'n_words': 323}