You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
The current error recovery of the FormattingWriter doesn’t work very well. I think one approach that might work better would be that FormattingWriter always throws an exception when it encounters an unexpected token, and FormattingVisitor handles it:
sharedactualvoidvisitStatement(Statementthat) {
try {
valuecontext = fWriter.openContext();
that.visitChildren(this);
if (existsmainEndToken = that.mainEndToken) {
writeSemicolon(fWriter, mainEndToken, context);
} else {
// complex statements like loops, ifs, etc. don’t end in a semicolonfWriter.closeContext(context);
}
} catch (UnexpectedTokenExceptionute) {
if (existsmainEndToken = that.mainEndToken) {
fWriter.writeRecoveryToken {
mainEndToken;
// other options as in writeToken
};
} else {
throwute;
}
}
}
where writeRecoveryToken writes out all unexpected tokens until it finds the recovery token (here, the semicolon). This is mostly what FormattingWriter currently does, but I think the fact that it tries to do it for any token makes it unstable.
The current error recovery of the
FormattingWriter
doesn’t work very well. I think one approach that might work better would be thatFormattingWriter
always throws an exception when it encounters an unexpected token, andFormattingVisitor
handles it:where
writeRecoveryToken
writes out all unexpected tokens until it finds the recovery token (here, the semicolon). This is mostly whatFormattingWriter
currently does, but I think the fact that it tries to do it for any token makes it unstable.Needs more investigation though.
CC eclipse-archived/ceylon-ide-eclipse#1536.
The text was updated successfully, but these errors were encountered: