mirror of
https://github.com/processing/processing4.git
synced 2026-01-30 11:51:54 +01:00
Refactor within PdePreprocessor to allow for override of edits.
In response to https://github.com/processing/processing4/issues/11, allow client code to override preprocessing edit behabior by providing a subclass of PdeParseTreeListener. This does make the construction for PdePreprocessor.java a little bit messier but a builder may help and moving dependent types within enclosing classes can hopefully keep things coherent.
This commit is contained in:
@@ -39,7 +39,13 @@ public class ProcessingTestUtil {
|
||||
throws SketchException {
|
||||
final String program = read(resource);
|
||||
final StringWriter out = new StringWriter();
|
||||
PreprocessorResult result = new PdePreprocessor(name, 4, true).write(out, program);
|
||||
|
||||
PdePreprocessor preprocessor = PdePreprocessor.builderFor(name)
|
||||
.setTabSize(4)
|
||||
.setIsTesting(true)
|
||||
.build();
|
||||
|
||||
PreprocessorResult result = preprocessor.write(out, program);
|
||||
|
||||
if (result.getPreprocessIssues().size() > 0) {
|
||||
throw new PdePreprocessIssueException(result.getPreprocessIssues().get(0));
|
||||
|
||||
Reference in New Issue
Block a user