@@ -907,15 +907,15 @@ public PreprocessorResult write(Writer out, String program,
907907 // these ones have the .* at the end, since a class name might be at the end
908908 // instead of .* which would make trouble other classes using this can lop
909909 // off the . and anything after it to produce a package name consistently.
910- final ArrayList <String > programImports = new ArrayList <String >();
910+ final ArrayList <String > programImports = new ArrayList <>();
911911
912912 // imports just from the code folder, treated differently
913913 // than the others, since the imports are auto-generated.
914- final ArrayList <String > codeFolderImports = new ArrayList <String >();
914+ final ArrayList <String > codeFolderImports = new ArrayList <>();
915915
916916 // need to reset whether or not this has a main()
917917// foundMain = false;
918- foundMethods = new HashSet <String >();
918+ foundMethods = new HashSet <>();
919919
920920 // http://processing.org/bugs/bugzilla/5.html
921921 if (!program .endsWith ("\n " )) {
@@ -924,12 +924,6 @@ public PreprocessorResult write(Writer out, String program,
924924
925925 checkForUnterminatedMultilineComment (program );
926926
927- // Removing all the Unicode characters makes detecting and reporting their
928- // preprocessor errors quite hard.
929- // if (Preferences.getBoolean("preproc.substitute_unicode")) {
930- // program = substituteUnicode(program);
931- // }
932-
933927 // For 0215, adding } as a legitimate prefix to the import (along with
934928 // newline and semicolon) for cases where a tab ends with } and an import
935929 // statement starts the next tab.
@@ -985,44 +979,6 @@ public PreprocessorResult write(Writer out, String program,
985979 }
986980
987981
988- static String substituteUnicode (String program ) {
989- // check for non-ascii chars (these will be/must be in unicode format)
990- char p [] = program .toCharArray ();
991- int unicodeCount = 0 ;
992- for (int i = 0 ; i < p .length ; i ++) {
993- if (p [i ] > 127 )
994- unicodeCount ++;
995- }
996- if (unicodeCount == 0 )
997- return program ;
998- // if non-ascii chars are in there, convert to unicode escapes
999- // add unicodeCount * 5.. replacing each unicode char
1000- // with six digit uXXXX sequence (xxxx is in hex)
1001- // (except for nbsp chars which will be a replaced with a space)
1002- int index = 0 ;
1003- char p2 [] = new char [p .length + unicodeCount * 5 ];
1004- for (int i = 0 ; i < p .length ; i ++) {
1005- if (p [i ] < 128 ) {
1006- p2 [index ++] = p [i ];
1007- } else if (p [i ] == 160 ) { // unicode for non-breaking space
1008- p2 [index ++] = ' ' ;
1009- } else {
1010- int c = p [i ];
1011- p2 [index ++] = '\\' ;
1012- p2 [index ++] = 'u' ;
1013- char str [] = Integer .toHexString (c ).toCharArray ();
1014- // add leading zeros, so that the length is 4
1015- //for (int i = 0; i < 4 - str.length; i++) p2[index++] = '0';
1016- for (int m = 0 ; m < 4 - str .length ; m ++)
1017- p2 [index ++] = '0' ;
1018- System .arraycopy (str , 0 , p2 , index , str .length );
1019- index += str .length ;
1020- }
1021- }
1022- return new String (p2 , 0 , index );
1023- }
1024-
1025-
1026982 /**
1027983 * preprocesses a pde file and writes out a java file
1028984 * @return the class name of the exported Java
0 commit comments