Changeset 426
- Timestamp:
- Jun 13, 2010 7:08:56 PM (14 years ago)
- Location:
- trunk/MagnoliaPlugin
- Files:
-
- 12 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagnoliaPlugin/src/org/magnolialang/eclipse/MagnoliaPlugin.java
r424 r426 10 10 import org.eclipse.imp.runtime.PluginBase; 11 11 import org.magnolialang.load.ProjectURIResolver; 12 import org.magnolialang.uri.*; 12 13 import org.osgi.framework.Bundle; 13 14 import org.osgi.framework.BundleContext; 14 import org. rascalmpl.uri.*;15 import org.magnolialang.uri.*; 15 16 import sglr.LegacySGLRInvoker; 16 17 import sglr.SGLRInvoker; -
trunk/MagnoliaPlugin/src/org/magnolialang/load/ModuleLoader.java
r424 r426 13 13 import org.magnolialang.env.MagnoliaEnvironment; 14 14 import org.magnolialang.parsetree.TreeImploder; 15 import org.magnolialang.uri.URIResolverRegistry; 16 15 17 import static org.magnolialang.parsetree.XaTreeAdapter.*; 16 18 import org.rascalmpl.interpreter.staticErrors.SyntaxError; 17 import org.rascalmpl.uri.URIResolverRegistry;18 19 import org.rascalmpl.values.ValueFactoryFactory; 19 20 import org.rascalmpl.values.errors.SubjectAdapter; … … 36 37 private final boolean saveParsedModules = (System.getProperty("rascal.options.saveBinaries") != null ? System.getProperty("rascal.options.saveBinaries").equals("true") : false); 37 38 private ISourceProject project; 39 private MagnoliaBuildPath buildPath; 38 40 39 41 public ModuleLoader(){ … … 48 50 this.parser = parser; 49 51 this.project = project; 52 this.buildPath = new MagnoliaBuildPath(null); 53 if(project != null) 54 this.buildPath.addPath(ProjectURIResolver.constructProjectURI(project, new Path(""))); 50 55 } 51 56 … … 138 143 if(isCons(imp, "ImportAll", 1)) { 139 144 String name = yield(getArg(imp, 0)); 140 URI uri = ProjectURIResolver.constructProjectURI(project, new Path(name).addFileExtension("mg"));145 URI uri = buildPath.find(name); 141 146 loadModule(uri, env); 142 System.out.println("import " + name);147 System.out.println("import " + uri); 143 148 } 144 149 } -
trunk/MagnoliaPlugin/src/org/magnolialang/load/ProjectURIResolver.java
r359 r426 16 16 import org.eclipse.core.runtime.CoreException; 17 17 import org.eclipse.core.runtime.IPath; 18 import org.eclipse.core.runtime.Path; 18 19 import org.eclipse.imp.model.ISourceProject; 19 20 import org.magnolialang.eclipse.MagnoliaPlugin; 21 import org.magnolialang.uri.IURIInputStreamResolver; 22 import org.magnolialang.uri.IURIOutputStreamResolver; 20 23 import org.rascalmpl.uri.BadURIException; 21 import org.rascalmpl.uri.IURIInputStreamResolver;22 import org.rascalmpl.uri.IURIOutputStreamResolver;23 24 24 25 public class ProjectURIResolver implements IURIInputStreamResolver, IURIOutputStreamResolver { … … 27 28 try{ 28 29 // making sure that spaces in 'path' are properly escaped 29 return new URI("project ://"+project.getName()+"/"+URLEncoder.encode(path.toOSString(),"UTF8"));30 return new URI("project", project.getName(), path.makeAbsolute().toString(), null); 30 31 }catch(URISyntaxException usex){ 31 32 throw new BadURIException(usex); 32 } catch (UnsupportedEncodingException e) {33 MagnoliaPlugin.getInstance().logException(e.getMessage(), e);34 return null;35 33 } 34 // } catch (UnsupportedEncodingException e) { 35 // MagnoliaPlugin.getInstance().logException(e.getMessage(), e); 36 // return null; 37 // } 36 38 } 37 39 … … 78 80 } 79 81 82 @Override 83 public long lastModified(URI uri) { 84 try { 85 return resolve(uri).getLocalTimeStamp(); 86 } catch (MalformedURLException e) { 87 return 0; 88 } catch (IOException e) { 89 return 0; 90 } 91 } 92 80 93 } -
trunk/MagnoliaPlugin/src/org/magnolialang/parsetree/XaTreeAdapter.java
r424 r426 213 213 Type type = ((IConstructor)token).getConstructorType(); 214 214 if(type == Type_Token || type == Type_Space || type == Type_Comment) { 215 result.append(((I Constructor)token).get("chars"));215 result.append(((IString)((IConstructor)token).get("chars")).getValue()); 216 216 } 217 217 else {
Note:
See TracChangeset
for help on using the changeset viewer.