@Override
	public ExitStatus parse(List<File> files)
	{
		classes.clear();
		LexLocation.resetLocations();
		int perrs = 0;
		int pwarn = 0;
		long duration = 0;

		for (File file : files)
		{
			ClassReader reader = null;

			try
			{
				if (file.getName().endsWith(".lib"))
				{
					FileInputStream fis = new FileInputStream(file);
					GZIPInputStream gis = new GZIPInputStream(fis);
					ObjectInputStream ois = new ObjectInputStream(gis);

					ClassListInterpreter loaded = null;
					long begin = System.currentTimeMillis();

					try
					{
						loaded = new ClassListInterpreter((ClassList) ois.readObject());
					} catch (Exception e)
					{
						println(file + " is not a valid VDM++ library");
						perrs++;
						continue;
					} finally
					{
						ois.close();
					}

					long end = System.currentTimeMillis();
					loaded.setLoaded();
					classes.addAll(loaded);
					classes.remap();

					infoln("Loaded " + plural(loaded.size(), "class", "es")
							+ " from " + file + " in " + (double) (end - begin)
							/ 1000 + " secs");
				} else
				{
					long before = System.currentTimeMillis();
					LexTokenReader ltr = new LexTokenReader(file, Settings.dialect, filecharset);
					reader = new ClassReader(ltr);
					classes.addAll(reader.readClasses());
					long after = System.currentTimeMillis();
					duration += after - before;
				}
			} catch (InternalException e)
			{
				println(e.toString());
				perrs++;
			} catch (Throwable e)
			{
				println(e.toString());
				perrs++;
			}

			if (reader != null && reader.getErrorCount() > 0)
			{
				perrs += reader.getErrorCount();
				reader.printErrors(Console.out);
			}

			if (reader != null && reader.getWarningCount() > 0)
			{
				pwarn += reader.getWarningCount();
				reader.printWarnings(Console.out);
			}
		}

		int n = classes.notLoaded();

		if (n > 0)
		{
			info("Parsed " + plural(n, "class", "es") + " in "
					+ (double) duration / 1000 + " secs. ");
			info(perrs == 0 ? "No syntax errors" : "Found "
					+ plural(perrs, "syntax error", "s"));
			infoln(pwarn == 0 ? "" : " and " + (warnings ? "" : "suppressed ")
					+ plural(pwarn, "warning", "s"));
		}

		return perrs == 0 ? ExitStatus.EXIT_OK : ExitStatus.EXIT_ERRORS;
	}
@ Override public ExitStatus parse ( List < File > files ) { classes . clear ( ) ; LexLocation . resetLocations ( ) ; int perrs = 0 ; int pwarn = 0 ; long duration = 0 ; for ( File file : files ) { ClassReader reader = null ; try { if ( file . getName ( ) . endsWith ( ".lib" ) ) { FileInputStream fis = new FileInputStream ( file ) ; GZIPInputStream gis = new GZIPInputStream ( fis ) ; ObjectInputStream ois = new ObjectInputStream ( gis ) ; ClassListInterpreter loaded = null ; long begin = System . currentTimeMillis ( ) ; try { loaded = new ClassListInterpreter ( ( ClassList ) ois . readObject ( ) ) ; } catch ( Exception e ) { println ( file + " is not a valid VDM++ library" ) ; perrs ++ ; continue ; } finally { ois . close ( ) ; } long end = System . currentTimeMillis ( ) ; loaded . setLoaded ( ) ; classes . addAll ( loaded ) ; classes . remap ( ) ; infoln ( "Loaded " + plural ( loaded . size ( ) , "class" , "es" ) + " from " + file + " in " + ( double ) ( end - begin ) / 1000 + " secs" ) ; } else { long before = System . currentTimeMillis ( ) ; LexTokenReader ltr = new LexTokenReader ( file , Settings . dialect , filecharset ) ; reader = new ClassReader ( ltr ) ; classes . addAll ( reader . readClasses ( ) ) ; long after = System . currentTimeMillis ( ) ; duration += after - before ; } } catch ( InternalException e ) { println ( e . toString ( ) ) ; perrs ++ ; } catch ( Throwable e ) { println ( e . toString ( ) ) ; perrs ++ ; } if ( reader != null && reader . getErrorCount ( ) > 0 ) { perrs += reader . getErrorCount ( ) ; reader . printErrors ( Console . out ) ; } if ( reader != null && reader . getWarningCount ( ) > 0 ) { pwarn += reader . getWarningCount ( ) ; reader . printWarnings ( Console . out ) ; } } int n = classes . notLoaded ( ) ; if ( n > 0 ) { info ( "Parsed " + plural ( n , "class" , "es" ) + " in " + ( double ) duration / 1000 + " secs. " ) ; info ( perrs == 0 ? "No syntax errors" : "Found " + plural ( perrs , "syntax error" , "s" ) ) ; infoln ( pwarn == 0 ? "" : " and " + ( warnings ? "" : "suppressed " ) + plural ( pwarn , "warning" , "s" ) ) ; } return perrs == 0 ? ExitStatus . EXIT_OK : ExitStatus . EXIT_ERRORS ; }
@see VDMJ#parse(java.util.List)