mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
This commit is contained in:
@@ -257,11 +257,27 @@ public class PdeEmitter implements PdeTokenTypes {
|
||||
print(thenPath);
|
||||
|
||||
// optional "else" clause: an SLIST or an EXPR
|
||||
// what could be simpler?
|
||||
final AST elsePath = thenPath.getNextSibling();
|
||||
if (elsePath != null) {
|
||||
out.print("else");
|
||||
dumpHiddenBefore(getBestPrintableNode(elsePath, true));
|
||||
print(elsePath);
|
||||
final AST bestPrintableNode = getBestPrintableNode(elsePath, true);
|
||||
dumpHiddenBefore(bestPrintableNode);
|
||||
final CommonHiddenStreamToken hiddenBefore =
|
||||
((CommonASTWithHiddenTokens) elsePath).getHiddenBefore();
|
||||
if (elsePath.getType() == PdeTokenTypes.SLIST && elsePath.getNumberOfChildren() == 0 &&
|
||||
hiddenBefore == null) {
|
||||
out.print("{");
|
||||
final CommonHiddenStreamToken hiddenAfter =
|
||||
((CommonASTWithHiddenTokens) elsePath).getHiddenAfter();
|
||||
if (hiddenAfter == null) {
|
||||
out.print("}");
|
||||
} else {
|
||||
dumpHiddenTokens(hiddenAfter);
|
||||
}
|
||||
} else {
|
||||
print(elsePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ public class PdePreprocessor implements PdeTokenTypes {
|
||||
// Because the meanings of < and > are overloaded to support
|
||||
// type arguments and type parameters, we have to treat them
|
||||
// as copyable to hidden text (or else the following syntax,
|
||||
// such as (); and what not gets lost under certain circumstances
|
||||
// such as (); and what not gets lost under certain circumstances)
|
||||
// -- jdf
|
||||
filter.copy(PdeRecognizer.LT);
|
||||
filter.copy(PdeRecognizer.GT);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import processing.core.*;
|
||||
import processing.xml.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.Image;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class bug400g extends PApplet {
|
||||
|
||||
////
|
||||
public void setup(){
|
||||
size(100,100);
|
||||
|
||||
if(true){
|
||||
}
|
||||
else{ // Syntax error on token "else", } expected
|
||||
}
|
||||
}
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "--bgcolor=null", "bug400g" });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
////
|
||||
void setup(){
|
||||
size(100,100);
|
||||
|
||||
if(true){
|
||||
}
|
||||
else{ // Syntax error on token "else", } expected
|
||||
}
|
||||
}
|
||||
@@ -275,4 +275,8 @@ public class ParserTests {
|
||||
expectGood("bug315g");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug400g() {
|
||||
expectGood("bug400g");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user