Allow ill advised but legal overridding of size, smooth, etc.

This commit is contained in:
A Pottinger
2020-11-21 12:34:07 -08:00
parent d30d34c00b
commit 17aa235c6b
2 changed files with 15 additions and 27 deletions

View File

@@ -630,17 +630,7 @@ public class PdeParseTreeListener extends ProcessingBaseListener {
}
if (argsContext.getChildCount() > 7) {
pdeParseTreeErrorListenerMaybe.ifPresent((listener) -> {
Token token = ctx.getStart();
int line = token.getLine();
int charOffset = token.getCharPositionInLine();
listener.onError(new PdePreprocessIssue(
line,
charOffset,
PreprocessIssueMessageSimplifier.getLocalStr("editor.status.bad.size")
));
});
thisRequiresRewrite = false; // Uesr may have overloaded size.
}
}
@@ -670,7 +660,12 @@ public class PdeParseTreeListener extends ProcessingBaseListener {
}
ParseTree argsContext = ctx.getChild(2);
if (argsContext.getChildCount() == 0 || argsContext.getChildCount() > 3) {
return; // User override of pixel density.
}
pixelDensity = argsContext.getChild(0).getText();
delete(ctx.start, ctx.stop);
insertAfter(ctx.stop, "/* pixelDensity commented out by preprocessor */");
pixelDensityRequiresRewrite = true;
@@ -682,6 +677,11 @@ public class PdeParseTreeListener extends ProcessingBaseListener {
return;
}
ParseTree argsContext = ctx.getChild(2);
if (argsContext.getChildCount() > 0) {
return; // User override of noSmooth.
}
delete(ctx.start, ctx.stop);
insertAfter(ctx.stop, "/* noSmooth commented out by preprocessor */");
noSmoothRequiresRewrite = true;
@@ -694,26 +694,16 @@ public class PdeParseTreeListener extends ProcessingBaseListener {
}
ParseTree argsContext = ctx.getChild(2);
if (argsContext.getChildCount() > 2) {
return; // User may have overloaded smooth;
}
if (argsContext.getChildCount() > 0) {
smoothParam = argsContext.getChild(0).getText();
} else {
smoothParam = "";
}
if (argsContext.getChildCount() > 2) {
pdeParseTreeErrorListenerMaybe.ifPresent((listener) -> {
Token token = ctx.getStart();
int line = token.getLine();
int charOffset = token.getCharPositionInLine();
listener.onError(new PdePreprocessIssue(
line,
charOffset,
PreprocessIssueMessageSimplifier.getLocalStr("editor.status.bad.smooth")
));
});
}
delete(ctx.start, ctx.stop);
insertAfter(ctx.stop, "/* smooth commented out by preprocessor */");
smoothRequiresRewrite = true;