Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[error reporting] Correct bugs reported on Epoch #1038

Merged
merged 3 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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