Skip to content

Commit

Permalink
Merge pull request #1038 from lf-lang/error-reporting-imports
Browse files Browse the repository at this point in the history
[error reporting] Fixed buggy error reporting in Epoch.
  • Loading branch information
lhstrh authored Mar 14, 2022
2 parents 19b510c + c07194c commit 5be0825
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion org.lflang/src/org/lflang/generator/c/CGenerator.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -3469,7 +3469,7 @@ class CGenerator extends GeneratorBase {
// The third match is a character position within the line.
// The fourth match will be the error message.
static final Pattern compileErrorPattern = Pattern.compile(
"^(file:/(?<path>.*)):(?<line>[0-9]+):(?<column>[0-9]+):(?<message>.*)$"
"^(file:(?<path>.*)):(?<line>[0-9]+):(?<column>[0-9]+):(?<message>.*)$"
);

/** Given a line of text from the output of a compiler, return
Expand Down
13 changes: 12 additions & 1 deletion org.lflang/src/org/lflang/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,18 @@ public static IResource getIResource(Resource r) throws IOException {
* Get the specified path as an Eclipse IResource or null if it is not found.
*/
public static IResource getIResource(Path path) {
return getIResource(path.toUri());
IResource ret = getIResource(path.toUri());
if (ret != null) return ret;
try {
// Handle a bug that not everyone can reproduce in which a path originating in the Ecore model is a relative
// path prefixed with a segment named "resource".
return ResourcesPlugin.getWorkspace().getRoot().findMember(org.eclipse.core.runtime.Path.fromOSString(
path.subpath(1, path.getNameCount()).toString()
));
} catch (IllegalStateException e) {
// We are outside of Eclipse.
}
return null;
}

/**
Expand Down

0 comments on commit 5be0825

Please sign in to comment.