Logo Search packages:      
Sourcecode: jasmin-sable version File versions  Download package

static void java_cup::Main::parse_args ( String  argv[]  )  [inline, static, protected]

Parse command line options and arguments to set various user-option flags and variables.

Parameters:
argv the command line arguments to be parsed.

Definition at line 271 of file Main.java.

References expect_conflicts, include_non_terms, lr_values, no_summary, opt_compact_red, opt_do_debug, opt_dump_grammar, opt_dump_states, opt_dump_tables, opt_show_timing, print_progress, suppress_scanner, sym_interface, and usage().

Referenced by main().

    {
      int len = argv.length;
      int i;

      /* parse the options */
      for (i=0; i<len; i++)
      {
        /* try to get the various options */
        if (argv[i].equals("-package"))
          {
            /* must have an arg */
            if (++i >= len || argv[i].startsWith("-") || 
                        argv[i].endsWith(".cup")) 
            usage("-package must have a name argument");

            /* record the name */
            emit.package_name = argv[i];
          }
        else if (argv[i].equals("-parser"))
          {
            /* must have an arg */
            if (++i >= len || argv[i].startsWith("-") || 
                        argv[i].endsWith(".cup")) 
            usage("-parser must have a name argument");

            /* record the name */
            emit.parser_class_name = argv[i];
          }
        else if (argv[i].equals("-symbols"))
          {
            /* must have an arg */
            if (++i >= len || argv[i].startsWith("-") || 
                        argv[i].endsWith(".cup")) 
            usage("-symbols must have a name argument");

            /* record the name */
            emit.symbol_const_class_name = argv[i];
          }
        else if (argv[i].equals("-nonterms"))
          {
            include_non_terms = true;
          }
        else if (argv[i].equals("-expect"))
          {
            /* must have an arg */
            if (++i >= len || argv[i].startsWith("-") || 
                        argv[i].endsWith(".cup")) 
            usage("-expect must have a name argument");

            /* record the number */
            try {
              expect_conflicts = Integer.parseInt(argv[i]);
            } catch (NumberFormatException e) {
            usage("-expect must be followed by a decimal integer");
            }
          }
        else if (argv[i].equals("-compact_red"))  opt_compact_red = true;
        else if (argv[i].equals("-nosummary"))    no_summary = true;
        else if (argv[i].equals("-nowarn"))       emit.nowarn = true;
        else if (argv[i].equals("-dump_states"))  opt_dump_states = true;
        else if (argv[i].equals("-dump_tables"))  opt_dump_tables = true; 
        else if (argv[i].equals("-progress"))     print_progress = true;
        else if (argv[i].equals("-dump_grammar")) opt_dump_grammar = true;
        else if (argv[i].equals("-dump")) 
              opt_dump_states = opt_dump_tables = opt_dump_grammar = true; 
        else if (argv[i].equals("-time"))         opt_show_timing = true; 
        else if (argv[i].equals("-debug"))        opt_do_debug = true;
        /* frankf 6/18/96 */
        else if (argv[i].equals("-nopositions"))  lr_values = false;
        /* CSA 12/21/97 */
        else if (argv[i].equals("-interface"))    sym_interface = true;
        /* CSA 23-Jul-1999 */
        else if (argv[i].equals("-noscanner"))    suppress_scanner = true;
        /* CSA 23-Jul-1999 */
        else if (argv[i].equals("-version")) {
            System.out.println(version.title_str);
            System.exit(1);
        }
        else
          {
            usage("Unrecognized option \"" + argv[i] + "\"");
          }
      }
    }


Generated by  Doxygen 1.6.0   Back to index