diff --git a/java/src/processing/mode/java/preproc/PdeParseTreeListener.java b/java/src/processing/mode/java/preproc/PdeParseTreeListener.java index 70918cc5e..1fd351f01 100644 --- a/java/src/processing/mode/java/preproc/PdeParseTreeListener.java +++ b/java/src/processing/mode/java/preproc/PdeParseTreeListener.java @@ -317,6 +317,10 @@ public class PdeParseTreeListener extends ProcessingBaseListener { footerResult = prepareFooter(rewriter, length); } + public void exitPackageDeclaration(ProcessingParser.PackageDeclarationContext ctx) { + delete(ctx.start, ctx.stop); + } + /** * Endpoint for ANTLR to call when finished parsing a method invocatino. * diff --git a/java/src/processing/mode/java/preproc/Processing.g4 b/java/src/processing/mode/java/preproc/Processing.g4 index 2b822f9d9..6d3e51d38 100644 --- a/java/src/processing/mode/java/preproc/Processing.g4 +++ b/java/src/processing/mode/java/preproc/Processing.g4 @@ -4,7 +4,7 @@ * - changes main entry point to reflect sketch types 'static' | 'active' * - adds support for type converter functions like "int()" * - adds pseudo primitive type "color" - * - adds HTML hex notation with hash symbol: #ff5522 + * - adds HTML hex notation with hash symbol: #ff5522 */ grammar Processing; @@ -47,8 +47,8 @@ variableDeclaratorId // https://github.com/processing/processing/issues/93 // prevent from types being used as variable names warnTypeAsVariableName - : primitiveType ('[' ']')* { - notifyErrorListeners("Type names are not allowed as variable names: "+$primitiveType.text); + : primitiveType ('[' ']')* { + notifyErrorListeners("Type names are not allowed as variable names: "+$primitiveType.text); } ; @@ -127,4 +127,3 @@ LINE_COMMENT ; CHAR_LITERAL: '\'' (~['\\\r\n] | EscapeSequence)* '\''; // A bit nasty but let JDT tackle invalid chars -