MCPcopy Create free account
hub / github.com/IBM/Project_CodeNet / main

Function main

tools/tokenizer/antlr4tojson.c:306–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306int
307main(int argc, char *argv[])
308{
309 extern char *optarg;
310 extern int opterr;
311 extern int optind;
312 int option;
313 char const *opt_str = "1dhm:o:rsvw";
314 char usage_str[80];
315 char *outfile = 0;
316 int first_time = 1;
317 char *line = NULL;
318 size_t len;
319
320 sprintf(usage_str, "usage: %%s [ -%s ] [ FILES ]\n", opt_str);
321
322 /* Process arguments: */
323 while ((option = getopt(argc, argv, opt_str)) != EOF) {
324 switch (option) {
325
326 case '1':
327 continuous_files = 1;
328 break;
329
330 case 'd':
331 debug = verbose = 1;
332 break;
333
334 case 'h':
335fputs(
336"A converter for the ANTLR4 token output format.\n\n", stderr);
337 fprintf(stderr, usage_str, basename(argv[0]));
338fputs(
339"\nCommand line options are:\n"
340"-d : print debug info to stderr; implies -v.\n"
341"-h : print just this text to stderr and stop.\n"
342"-m<mode> : output mode either plain, csv, json (default), or jsonl.\n"
343"-o<file> : name for output file (instead of stdout).\n"
344"-s : enable a special start token specifying the filename.\n"
345"-1 : treat all filename arguments as a continuous single input.\n"
346"-v : print action summary to stderr.\n"
347"-w : suppress all warning messages.\n",
348 stderr);
349 return 0;
350
351 case 'm':
352 if (!strcmp(optarg, "csv"))
353 mode = CSV;
354 else if (!strcmp(optarg, "json"))
355 mode = JSON;
356 else if (!strcmp(optarg, "jsonl"))
357 mode = JSONL;
358 else if (!strcmp(optarg, "raw"))
359 mode = RAW;
360 else {
361 if (!nowarn)
362 fprintf(stderr, "(W): Invalid mode %s (using csv).\n", optarg);
363 mode = CSV;

Callers

nothing calls this directly

Calls 2

precompileFunction · 0.70
getFunction · 0.70

Tested by

no test coverage detected