<commit_before>var s = "";

(function(){
  if(WScript.arguments.length !== 1){
    WScript.echo("Command Line Argument Error");
    WScript.exit(1);
  }
})();

s = (function(filename){
  var str = "";
  var fso = new ActiveXObject("Scripting.FileSystemObject");
  var InputStream = fso.OpenTextFile(filename);
  if(InputStream.AtEndOfStream === false){
    str = InputStream.ReadAll();
    // WScript.echo(str);
  }
  InputStream.Close();
  return str;
})(WScript.arguments.Item(0));

// WScript.echo(s);

s = (function(InputStr,StartStr,EndStr){
  var mode = 0;
  var InputArray = InputStr.split("\r\n");
  var max = InputArray.length;
  var OutputArray = [];
  for(var i = 0; i < max; i++){
    switch(mode){
      case 0:
        if(InputArray[i].search(StartStr) !== -1){
          mode = 1;
        }
        break;
      case 1:
        if(InputArray[i].search(EndStr) !== -1){
          mode = 2;
        }else{
          if(InputArray[i].search("#") !== -1){
            OutputArray.push( InputArray[i] );
          }
        }
        break;
      case 2:
      default:
        break;
    }
  }
  return OutputArray.join("\r\n");
})(s,"StartComment","EndComment");

WScript.echo(s);
<commit_msg>マクロ定義部分だけ抽出<commit_after>var s = "";

// R}hC𒲂ׂB
// ҂̃R}hCȂΈُI
(function(){
  if(WScript.arguments.length !== 1){
    WScript.echo("Command Line Argument Error");
    WScript.exit(1);
  }
})();

// Ŏw肳ꂽt@CǂݎāAg̕߂lŕԂB
s = (function(filename){
  var str = "";
  var fso = new ActiveXObject("Scripting.FileSystemObject");
  var InputStream = fso.OpenTextFile(filename);
  if(InputStream.AtEndOfStream === false){
    str = InputStream.ReadAll();
    // WScript.echo(str);
  }
  InputStream.Close();
  return str;
})(WScript.arguments.Item(0));

// WScript.echo(s);

// Ŏw肳ꂽ񂩂A
// AOň͂ꂽs𒊏oāA߂lŕԂB
s = (function(InputStr,StartStr,EndStr){
  var mode = 0;
  var OutputArray = [];
  var InputArray = InputStr.split("\r\n");
  var max = InputArray.length;
  for(var i = 0; i < max; i++){
    switch(mode){
      case 0:
        if(InputArray[i].search(StartStr) !== -1){
          mode = 1;
        }
        break;
      case 1:
        if(InputArray[i].search(EndStr) !== -1){
          mode = 2;
        }else{
          OutputArray.push( InputArray[i] );
        }
        break;
      case 2:
      default:
        break;
    }
  }
  return OutputArray.join("\r\n");
})(s,"StartComment","EndComment");

// WScript.echo(s);

// }N`̋LqꂽsA}N`݂̂𒊏o
s = (function(InputStr){
  var re = /^\s*#\s*define\s+/; // }N`̐K\p^[
  var OutputArray = [];
  var InputArray = InputStr.split("\r\n");
  var max = InputArray.length;
  for(var i = 0; i < max; i++){
    if(InputArray[i].search(re) !== -1){
      OutputArray.push( InputArray[i].replace(re, "") );
    }
  }
  return OutputArray.join("\r\n");
})(s);

WScript.echo(s);

{'fraction_non_alphanumeric': 0.19367448471926083, 'fraction_numerical': 0.010305614783226724, 'mean_word_length': 2.5997442455242967, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 3, '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': '1264405', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1089, 'n_words': 188}