/// <exception cref="System.IO.IOException"/>
        private static void GeneratePrefixDefs(string infile, string outfile)
        {
            IList <UnitPrefix> prefixes = UnitPrefix.LoadPrefixes(infile);
            PrintWriter        pw       = IOUtils.GetPrintWriter(outfile);

            pw.Println("SI_PREFIX_MAP = {");
            IList <string> items = new List <string>();

            foreach (UnitPrefix prefix in prefixes)
            {
                if ("SI".Equals(prefix.system))
                {
                    items.Add("\"" + prefix.name + "\": " + prefix.GetName().ToUpper());
                }
            }
            pw.Println(StringUtils.Join(items, ",\n"));
            pw.Println("}");
            pw.Println("$SiPrefixes = CreateRegex(Keys(SI_PREFIX_MAP))");
            pw.Println();
            pw.Println("SI_SYM_PREFIX_MAP = {");
            items.Clear();
            foreach (UnitPrefix prefix_1 in prefixes)
            {
                if ("SI".Equals(prefix_1.system))
                {
                    items.Add("\"" + prefix_1.symbol + "\": " + prefix_1.GetName().ToUpper());
                }
            }
            pw.Println(StringUtils.Join(items, ",\n"));
            pw.Println("}");
            pw.Println("$SiSymPrefixes = CreateRegex(Keys(SI_SYM_PREFIX_MAP))");
            pw.Close();
        }
 private void InitEnv()
 {
     env = TokenSequencePattern.GetNewEnv();
     env.SetDefaultTokensAnnotationKey(typeof(CoreAnnotations.NumerizedTokensAnnotation));
     // Do case insensitive matching
     env.SetDefaultStringMatchFlags(Pattern.CaseInsensitive | Pattern.UnicodeCase);
     env.SetDefaultStringPatternFlags(Pattern.CaseInsensitive | Pattern.UnicodeCase);
     try
     {
         Units.RegisterUnits(env, options.unitsFilename);
     }
     catch (IOException ex)
     {
         throw new Exception("Error loading units from " + options.unitsFilename, ex);
     }
     try
     {
         UnitPrefix.RegisterPrefixes(env, options.prefixFilename);
     }
     catch (IOException ex)
     {
         throw new Exception("Error loading prefixes from " + options.prefixFilename, ex);
     }
     env.Bind("options", options);
     env.Bind("numcomptype", typeof(CoreAnnotations.NumericCompositeTypeAnnotation));
     env.Bind("numcompvalue", typeof(CoreAnnotations.NumericCompositeValueAnnotation));
 }