1 package kawa.lang; 2 import java.io.*; 3 import gnu.mapping.*; 4 import gnu.bytecode.ClassType; 5 import gnu.expr.*; 6 import gnu.text.SourceMessages; 7 8 12 13 public class CompileFile 14 { 15 public static final Compilation read (String name, SourceMessages messages) 16 throws java.io.IOException , gnu.text.SyntaxException 17 { 18 try 19 { 20 InPort fstream = InPort.openFile(name); 21 Compilation result = read(fstream, messages); 22 fstream.close(); 23 return result; 24 } 25 catch (java.io.FileNotFoundException e) 26 { 27 throw new WrappedException("compile-file: file not found: " + name, e); 28 } 29 catch (java.io.IOException e) 30 { 31 throw new WrappedException("compile-file: read-error: " + name, e); 32 } 33 } 34 35 public static final Compilation read (InPort port, SourceMessages messages) 36 throws java.io.IOException , gnu.text.SyntaxException 37 { 38 return Language.getDefaultLanguage().parse(port, messages, 0); 39 } 40 } 41 | Popular Tags |