This file is indexed.

/usr/bin/pegjs is in node-pegjs 0.7.0-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env /usr/bin/nodejs

var util = require("util");
var fs   = require("fs");
var PEG  = require("pegjs");

/* Helpers */

function printVersion() {
  util.puts("PEG.js " + PEG.VERSION);
}

function printHelp() {
  util.puts("Usage: pegjs [options] [--] [<input_file>] [<output_file>]");
  util.puts("");
  util.puts("Generates a parser from the PEG grammar specified in the <input_file> and");
  util.puts("writes it to the <output_file>.");
  util.puts("");
  util.puts("If the <output_file> is omitted, its name is generated by changing the");
  util.puts("<input_file> extension to \".js\". If both <input_file> and <output_file> are");
  util.puts("omitted, standard input and output are used.");
  util.puts("");
  util.puts("Options:");
  util.puts("  -e, --export-var <variable>  name of the variable where the parser object");
  util.puts("                               will be stored (default: \"module.exports\")");
  util.puts("      --cache                  make generated parser cache results");
  util.puts("      --track-line-and-column  make generated parser track line and column");
  util.puts("  -v, --version                print version information and exit");
  util.puts("  -h, --help                   print help and exit");
}

function exitSuccess() {
  process.exit(0);
}

function exitFailure() {
  process.exit(1);
}

function abort(message) {
  util.error(message);
  exitFailure();
}

/* Arguments */

var args = process.argv.slice(2); // Trim "node" and the script path.

function isOption(arg) {
  return /^-/.test(arg);
}

function nextArg() {
  args.shift();
}

/* Files */

function readStream(inputStream, callback) {
  var input = "";
  inputStream.on("data", function(data) { input += data; });
  inputStream.on("end", function() { callback(input); });
}

/* Main */

/* This makes the generated parser a CommonJS module by default. */
var exportVar = "module.exports";
var options = {
  cache:              false,
  trackLineAndColumn: false
};

while (args.length > 0 && isOption(args[0])) {
  switch (args[0]) {
    case "-e":
    case "--export-var":
      nextArg();
      if (args.length === 0) {
        abort("Missing parameter of the -e/--export-var option.");
      }
      exportVar = args[0];
      break;

    case "--cache":
      options.cache = true;
      break;

    case "--track-line-and-column":
      options.trackLineAndColumn = true;
      break;

    case "-v":
    case "--version":
      printVersion();
      exitSuccess();
      break;

    case "-h":
    case "--help":
      printHelp();
      exitSuccess();
      break;

    case "--":
      nextArg();
      break;

    default:
      abort("Unknown option: " + args[0] + ".");
  }
  nextArg();
}

switch (args.length) {
  case 0:
    process.stdin.resume();
    var inputStream = process.stdin;
    var outputStream = process.stdout;
    break;

  case 1:
  case 2:
    var inputFile = args[0];
    var inputStream = fs.createReadStream(inputFile);
    inputStream.on("error", function() {
      abort("Can't read from file \"" + inputFile + "\".");
    });

    var outputFile = args.length == 1
      ? args[0].replace(/\.[^.]*$/, ".js")
      : args[1];
    var outputStream = fs.createWriteStream(outputFile);
    outputStream.on("error", function() {
      abort("Can't write to file \"" + outputFile + "\".");
    });

    break;

  default:
    abort("Too many arguments.");
}

readStream(inputStream, function(input) {
  try {
    var parser = PEG.buildParser(input, options);
  } catch (e) {
    if (e.line !== undefined && e.column !== undefined) {
      abort(e.line + ":" + e.column + ": " + e.message);
    } else {
      abort(e.message);
    }
  }

  outputStream.write(exportVar + " = " + parser.toSource() + ";\n");
  if (outputStream !== process.stdout) {
    outputStream.end();
  }
});