From e96f1e5bd1cf8a3fcbce21ba7a2dd7b1a3484cf3 Mon Sep 17 00:00:00 2001 From: jdf Date: Mon, 15 Mar 2010 20:01:12 +0000 Subject: [PATCH] Fix http://dev.processing.org/bugs/show_bug.cgi?id=6 Funny bug. The grammar accepted any initial chunk of an active or static program as the whole thing, because it wasn't saying that the EOF had to come next! --- app/grammars/pde.g | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/grammars/pde.g b/app/grammars/pde.g index 2ef7277c3..93cb92e9f 100644 --- a/app/grammars/pde.g +++ b/app/grammars/pde.g @@ -46,10 +46,10 @@ pdeProgram // imports (and they must have at least one) : ( "public" "class" | "import" ) => javaProgram { pp.setProgramType(PdePreprocessor.ProgramType.JAVA); } - | ((statement)*) => staticProgram - { pp.setProgramType(PdePreprocessor.ProgramType.STATIC); } - | activeProgram + | (activeProgram) => activeProgram { pp.setProgramType(PdePreprocessor.ProgramType.ACTIVE); } + | staticProgram + { pp.setProgramType(PdePreprocessor.ProgramType.STATIC); } ; @@ -59,11 +59,11 @@ javaProgram ; activeProgram - : (possiblyEmptyField)+ + : (possiblyEmptyField)+ EOF! ; staticProgram - : (statement)* + : (statement)* EOF! ; // copy of the java.g rule with WEBCOLOR_LITERAL added