Bug 12506 fixed: In SciNotes, miscolorization when returned values list was broken 31/11231/2
Calixte DENIZET [Fri, 5 Apr 2013 15:33:32 +0000 (17:33 +0200)]
Change-Id: I3fd73a0ac6a56c188038feb28798065c722c39d1

scilab/CHANGES_5.5.X
scilab/modules/scinotes/src/java/jflex/function.jflex
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/FunctionScanner.java

index 5dfe367..defca00 100644 (file)
@@ -94,3 +94,5 @@ Bug fixes
 * Bug #12473 fixed - Problems with "é" in french help page of mkdir.
 
 * Bug #12475 fixed - csvRead() does not support double quoted fields.
+
+* Bug #12506 fixed - In SciNotes, miscolorization when returned values list was broken.
index ed0490a..02118f4 100644 (file)
@@ -28,6 +28,7 @@ import javax.swing.text.Element;
 
     private ScilabDocument doc;
     private String id;
+    private boolean inRETS;
 
     public FunctionScanner(ScilabDocument doc) {
         this.doc = doc;
@@ -67,7 +68,12 @@ import javax.swing.text.Element;
                 elem = elem.getElement(elem.getElementIndex(end + 1));
                 end = elem.getEndOffset();
                 yyreset(new ScilabDocumentReader(doc, elem.getStartOffset(), end));
-                yybegin(ARGS);
+               if (inRETS) {
+                  inRETS = false;
+                  yybegin(RETS);
+               } else {
+                   yybegin(ARGS);
+               }
             }
         } catch (IOException e) {
             return ScilabDocument.ScilabLeafElement.NOTHING;
@@ -218,6 +224,11 @@ endfun = {white}* "endfunction" {spec}
                                    yybegin(FUNNAME);
                                  }
 
+  {break}                       {
+                                  inRETS = true;
+                                  return ScilabDocument.ScilabLeafElement.BROKEN;
+                                }
+
   .                              |
   {eol}                          {
                                    return ScilabDocument.ScilabLeafElement.NOTHING;
index f4e4e72..ed1f7e7 100644 (file)
@@ -1,4 +1,4 @@
-/* The following code was generated by JFlex 1.4.3 on 22/03/13 10:37 */
+/* The following code was generated by JFlex 1.4.3 on 05/04/13 17:28 */
 
 //CHECKSTYLE:OFF
 
@@ -15,7 +15,7 @@ import javax.swing.text.Element;
 /**
  * This class is a scanner generated by
  * <a href="http://www.jflex.de/">JFlex</a> 1.4.3
- * on 22/03/13 10:37 from the specification file
+ * on 05/04/13 17:28 from the specification file
  * <tt>function.jflex</tt>
  */
 public final class FunctionScanner {
@@ -67,12 +67,12 @@ public final class FunctionScanner {
 
     private static final String ZZ_ACTION_PACKED_0 =
         "\7\0\4\1\1\2\1\3\1\4\1\5\1\1\1\6" +
-        "\1\7\1\1\1\10\1\1\1\11\1\12\1\4\1\13" +
-        "\1\4\2\1\1\14\1\1\2\15\11\0\1\16\10\0" +
-        "\1\17\14\0\1\20\3\0\1\21";
+        "\1\7\1\1\1\10\1\1\1\11\1\12\1\4\1\1" +
+        "\1\13\1\4\2\1\1\14\1\1\2\15\12\0\1\16" +
+        "\10\0\1\17\2\0\1\20\15\0\1\21\3\0\1\22";
 
     private static int [] zzUnpackAction() {
-        int [] result = new int[68];
+        int [] result = new int[74];
         int offset = 0;
         offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
         return result;
@@ -162,6 +162,7 @@ public final class FunctionScanner {
 
     private ScilabDocument doc;
     private String id;
+    private boolean inRETS;
 
     public FunctionScanner(ScilabDocument doc) {
         this.doc = doc;
@@ -201,7 +202,12 @@ public final class FunctionScanner {
                 elem = elem.getElement(elem.getElementIndex(end + 1));
                 end = elem.getEndOffset();
                 yyreset(new ScilabDocumentReader(doc, elem.getStartOffset(), end));
-                yybegin(ARGS);
+                if (inRETS) {
+                    inRETS = false;
+                    yybegin(RETS);
+                } else {
+                    yybegin(ARGS);
+                }
             }
         } catch (IOException e) {
             return ScilabDocument.ScilabLeafElement.NOTHING;
@@ -635,7 +641,6 @@ public final class FunctionScanner {
                                     case 0:
                                     case 2:
                                     case 3:
-                                    case 4:
                                     case 6:
                                     case 8:
                                     case 9:
@@ -650,18 +655,22 @@ public final class FunctionScanner {
                                         zzIsFinal = true;
                                         zzState = 23;
                                         break zzForNext;
+                                    case 4:
+                                        zzIsFinal = true;
+                                        zzState = 24;
+                                        break zzForNext;
                                     case 22:
                                         zzIsFinal = true;
                                         zzNoLookAhead = true;
-                                        zzState = 25;
+                                        zzState = 26;
                                         break zzForNext;
                                     case 23:
                                         zzIsFinal = true;
-                                        zzState = 26;
+                                        zzState = 27;
                                         break zzForNext;
                                     default:
                                         zzIsFinal = true;
-                                        zzState = 24;
+                                        zzState = 25;
                                         break zzForNext;
                                 }
 
@@ -687,19 +696,19 @@ public final class FunctionScanner {
                                     case 22:
                                         zzIsFinal = true;
                                         zzNoLookAhead = true;
-                                        zzState = 25;
+                                        zzState = 26;
                                         break zzForNext;
                                     case 4:
                                         zzIsFinal = true;
-                                        zzState = 27;
+                                        zzState = 28;
                                         break zzForNext;
                                     case 9:
                                         zzIsFinal = true;
-                                        zzState = 29;
+                                        zzState = 30;
                                         break zzForNext;
                                     default:
                                         zzIsFinal = true;
-                                        zzState = 28;
+                                        zzState = 29;
                                         break zzForNext;
                                 }
 
@@ -707,24 +716,24 @@ public final class FunctionScanner {
                                 switch (zzInput) {
                                     case 4:
                                         zzIsFinal = true;
-                                        zzState = 31;
+                                        zzState = 32;
                                         break zzForNext;
                                     default:
                                         zzIsFinal = true;
-                                        zzState = 30;
+                                        zzState = 31;
                                         break zzForNext;
                                 }
 
                             case 8:
                                 switch (zzInput) {
                                     case 1:
-                                        zzState = 32;
+                                        zzState = 33;
                                         break zzForNext;
                                     case 11:
-                                        zzState = 33;
+                                        zzState = 34;
                                         break zzForNext;
                                     case 19:
-                                        zzState = 34;
+                                        zzState = 35;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
@@ -733,7 +742,7 @@ public final class FunctionScanner {
                             case 9:
                                 switch (zzInput) {
                                     case 12:
-                                        zzState = 35;
+                                        zzState = 36;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
@@ -742,7 +751,7 @@ public final class FunctionScanner {
                             case 10:
                                 switch (zzInput) {
                                     case 13:
-                                        zzState = 36;
+                                        zzState = 37;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
@@ -783,7 +792,7 @@ public final class FunctionScanner {
                             case 15:
                                 switch (zzInput) {
                                     case 3:
-                                        zzState = 37;
+                                        zzState = 38;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
@@ -806,7 +815,7 @@ public final class FunctionScanner {
                                         zzState = 22;
                                         break zzForNext;
                                     case 1:
-                                        zzState = 38;
+                                        zzState = 39;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
@@ -815,7 +824,7 @@ public final class FunctionScanner {
                             case 20:
                                 switch (zzInput) {
                                     case 3:
-                                        zzState = 39;
+                                        zzState = 40;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
@@ -851,6 +860,15 @@ public final class FunctionScanner {
 
                             case 24:
                                 switch (zzInput) {
+                                    case 4:
+                                        zzState = 41;
+                                        break zzForNext;
+                                    default:
+                                        break zzForAction;
+                                }
+
+                            case 25:
+                                switch (zzInput) {
                                     case 6:
                                     case 7:
                                     case 11:
@@ -868,29 +886,29 @@ public final class FunctionScanner {
                                         break zzForAction;
                                 }
 
-                            case 26:
+                            case 27:
                                 switch (zzInput) {
                                     case 1:
-                                        zzState = 40;
+                                        zzState = 42;
                                         break zzForNext;
                                     case 8:
                                         zzIsFinal = true;
-                                        zzState = 41;
+                                        zzState = 43;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 27:
+                            case 28:
                                 switch (zzInput) {
                                     case 4:
-                                        zzState = 42;
+                                        zzState = 44;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 28:
+                            case 29:
                                 switch (zzInput) {
                                     case 6:
                                     case 7:
@@ -909,7 +927,7 @@ public final class FunctionScanner {
                                         break zzForAction;
                                 }
 
-                            case 29:
+                            case 30:
                                 switch (zzInput) {
                                     case 2:
                                         zzIsFinal = true;
@@ -919,86 +937,86 @@ public final class FunctionScanner {
                                     case 1:
                                     case 10:
                                     case 22:
-                                        zzState = 43;
+                                        zzState = 45;
                                         break zzForNext;
                                     case 3:
-                                        zzState = 44;
+                                        zzState = 46;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 30:
+                            case 31:
                                 switch (zzInput) {
                                     case 4:
-                                        zzState = 46;
+                                        zzState = 48;
                                         break zzForNext;
                                     default:
-                                        zzState = 45;
+                                        zzState = 47;
                                         break zzForNext;
                                 }
 
-                            case 31:
+                            case 32:
                                 switch (zzInput) {
                                     case 4:
-                                        zzState = 42;
+                                        zzState = 44;
                                         break zzForNext;
                                     default:
-                                        zzState = 45;
+                                        zzState = 47;
                                         break zzForNext;
                                 }
 
-                            case 32:
+                            case 33:
                                 switch (zzInput) {
                                     case 1:
                                         break zzForNext;
                                     case 11:
-                                        zzState = 33;
+                                        zzState = 34;
                                         break zzForNext;
                                     case 19:
-                                        zzState = 34;
+                                        zzState = 35;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 33:
+                            case 34:
                                 switch (zzInput) {
                                     case 12:
-                                        zzState = 35;
+                                        zzState = 36;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 34:
+                            case 35:
                                 switch (zzInput) {
                                     case 13:
-                                        zzState = 36;
+                                        zzState = 37;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 35:
+                            case 36:
                                 switch (zzInput) {
                                     case 13:
-                                        zzState = 47;
+                                        zzState = 49;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 36:
+                            case 37:
                                 switch (zzInput) {
                                     case 20:
-                                        zzState = 48;
+                                        zzState = 50;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 37:
+                            case 38:
                                 switch (zzInput) {
                                     case 2:
                                         zzIsFinal = true;
@@ -1009,7 +1027,7 @@ public final class FunctionScanner {
                                         break zzForNext;
                                 }
 
-                            case 38:
+                            case 39:
                                 switch (zzInput) {
                                     case 21:
                                         zzIsFinal = true;
@@ -1022,7 +1040,7 @@ public final class FunctionScanner {
                                         break zzForAction;
                                 }
 
-                            case 39:
+                            case 40:
                                 switch (zzInput) {
                                     case 2:
                                         zzIsFinal = true;
@@ -1033,19 +1051,38 @@ public final class FunctionScanner {
                                         break zzForNext;
                                 }
 
-                            case 40:
+                            case 41:
+                                switch (zzInput) {
+                                    case 4:
+                                        break zzForNext;
+                                    case 1:
+                                        zzState = 51;
+                                        break zzForNext;
+                                    case 2:
+                                        zzIsFinal = true;
+                                        zzNoLookAhead = true;
+                                        zzState = 52;
+                                        break zzForNext;
+                                    case 3:
+                                        zzState = 53;
+                                        break zzForNext;
+                                    default:
+                                        break zzForAction;
+                                }
+
+                            case 42:
                                 switch (zzInput) {
                                     case 1:
                                         break zzForNext;
                                     case 8:
                                         zzIsFinal = true;
-                                        zzState = 41;
+                                        zzState = 43;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 41:
+                            case 43:
                                 switch (zzInput) {
                                     case 1:
                                         zzIsFinal = true;
@@ -1054,26 +1091,26 @@ public final class FunctionScanner {
                                         break zzForAction;
                                 }
 
-                            case 42:
+                            case 44:
                                 switch (zzInput) {
                                     case 4:
                                         break zzForNext;
                                     case 1:
-                                        zzState = 49;
+                                        zzState = 54;
                                         break zzForNext;
                                     case 2:
                                         zzIsFinal = true;
                                         zzNoLookAhead = true;
-                                        zzState = 50;
+                                        zzState = 55;
                                         break zzForNext;
                                     case 3:
-                                        zzState = 51;
+                                        zzState = 56;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 43:
+                            case 45:
                                 switch (zzInput) {
                                     case 2:
                                         zzIsFinal = true;
@@ -1085,167 +1122,203 @@ public final class FunctionScanner {
                                     case 22:
                                         break zzForNext;
                                     case 3:
-                                        zzState = 44;
+                                        zzState = 46;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 44:
+                            case 46:
                                 switch (zzInput) {
                                     case 3:
-                                        zzState = 39;
+                                        zzState = 40;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 45:
+                            case 47:
                                 switch (zzInput) {
                                     case 4:
-                                        zzState = 46;
+                                        zzState = 48;
                                         break zzForNext;
                                     default:
                                         break zzForNext;
                                 }
 
-                            case 46:
+                            case 48:
                                 switch (zzInput) {
                                     case 4:
-                                        zzState = 42;
+                                        zzState = 44;
                                         break zzForNext;
                                     default:
-                                        zzState = 45;
+                                        zzState = 47;
                                         break zzForNext;
                                 }
 
-                            case 47:
+                            case 49:
                                 switch (zzInput) {
                                     case 14:
-                                        zzState = 52;
+                                        zzState = 57;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 48:
+                            case 50:
                                 switch (zzInput) {
                                     case 11:
+                                        zzState = 58;
+                                        break zzForNext;
+                                    default:
+                                        break zzForAction;
+                                }
+
+                            case 51:
+                                switch (zzInput) {
+                                    case 1:
+                                        break zzForNext;
+                                    case 2:
+                                        zzIsFinal = true;
+                                        zzNoLookAhead = true;
+                                        zzState = 52;
+                                        break zzForNext;
+                                    case 3:
                                         zzState = 53;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 49:
+                            case 53:
+                                switch (zzInput) {
+                                    case 3:
+                                        zzState = 59;
+                                        break zzForNext;
+                                    default:
+                                        break zzForAction;
+                                }
+
+                            case 54:
                                 switch (zzInput) {
                                     case 1:
                                         break zzForNext;
                                     case 2:
                                         zzIsFinal = true;
                                         zzNoLookAhead = true;
-                                        zzState = 50;
+                                        zzState = 55;
                                         break zzForNext;
                                     case 3:
-                                        zzState = 51;
+                                        zzState = 56;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 51:
+                            case 56:
                                 switch (zzInput) {
                                     case 3:
-                                        zzState = 54;
+                                        zzState = 60;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 52:
+                            case 57:
                                 switch (zzInput) {
                                     case 15:
-                                        zzState = 55;
+                                        zzState = 61;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 53:
+                            case 58:
                                 switch (zzInput) {
                                     case 12:
-                                        zzState = 56;
+                                        zzState = 62;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 54:
+                            case 59:
                                 switch (zzInput) {
                                     case 2:
                                         zzIsFinal = true;
                                         zzNoLookAhead = true;
-                                        zzState = 50;
+                                        zzState = 52;
                                         break zzForNext;
                                     default:
                                         break zzForNext;
                                 }
 
-                            case 55:
+                            case 60:
+                                switch (zzInput) {
+                                    case 2:
+                                        zzIsFinal = true;
+                                        zzNoLookAhead = true;
+                                        zzState = 55;
+                                        break zzForNext;
+                                    default:
+                                        break zzForNext;
+                                }
+
+                            case 61:
                                 switch (zzInput) {
                                     case 16:
-                                        zzState = 57;
+                                        zzState = 63;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 56:
+                            case 62:
                                 switch (zzInput) {
                                     case 13:
-                                        zzState = 58;
+                                        zzState = 64;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 57:
+                            case 63:
                                 switch (zzInput) {
                                     case 17:
-                                        zzState = 59;
+                                        zzState = 65;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 58:
+                            case 64:
                                 switch (zzInput) {
                                     case 14:
-                                        zzState = 60;
+                                        zzState = 66;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 59:
+                            case 65:
                                 switch (zzInput) {
                                     case 13:
-                                        zzState = 61;
+                                        zzState = 67;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 60:
+                            case 66:
                                 switch (zzInput) {
                                     case 15:
-                                        zzState = 62;
+                                        zzState = 68;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 61:
+                            case 67:
                                 switch (zzInput) {
                                     case 18:
                                         zzIsFinal = true;
@@ -1254,22 +1327,22 @@ public final class FunctionScanner {
                                         break zzForNext;
                                     case 1:
                                         zzIsFinal = true;
-                                        zzState = 63;
+                                        zzState = 69;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 62:
+                            case 68:
                                 switch (zzInput) {
                                     case 16:
-                                        zzState = 64;
+                                        zzState = 70;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 63:
+                            case 69:
                                 switch (zzInput) {
                                     case 1:
                                         zzIsFinal = true;
@@ -1278,25 +1351,25 @@ public final class FunctionScanner {
                                         break zzForAction;
                                 }
 
-                            case 64:
+                            case 70:
                                 switch (zzInput) {
                                     case 17:
-                                        zzState = 65;
+                                        zzState = 71;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 65:
+                            case 71:
                                 switch (zzInput) {
                                     case 13:
-                                        zzState = 66;
+                                        zzState = 72;
                                         break zzForNext;
                                     default:
                                         break zzForAction;
                                 }
 
-                            case 66:
+                            case 72:
                                 switch (zzInput) {
                                     case 6:
                                     case 7:
@@ -1313,7 +1386,7 @@ public final class FunctionScanner {
                                     default:
                                         zzIsFinal = true;
                                         zzNoLookAhead = true;
-                                        zzState = 67;
+                                        zzState = 73;
                                         break zzForNext;
                                 }
 
@@ -1339,94 +1412,100 @@ public final class FunctionScanner {
             zzMarkedPos = zzMarkedPosL;
 
             switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
-                case 8 : {
+                case 5 : {
+                    functionName = id;
                     return ScilabDocument.ScilabLeafElement.FUN;
                 }
-                case 18:
-                    break;
-                case 13: {
-                    return 0;
-                }
                 case 19:
                     break;
-                case 11: {
-                    returnValues.add(yytext());
-                }
-                case 20:
-                    break;
                 case 15: {
+                    inRETS = true;
                     return ScilabDocument.ScilabLeafElement.BROKEN;
                 }
-                case 21:
+                case 20:
                     break;
                 case 9: {
                     functionName = yytext();
                 }
+                case 21:
+                    break;
+                case 13: {
+                    return 0;
+                }
                 case 22:
                     break;
-                case 17: {
-                    return ScilabDocument.ScilabLeafElement.ENDFUN;
+                case 6: {
+                    returnValues.add(id);
+                    yybegin(FUNNAME);
                 }
                 case 23:
                     break;
-                case 12: {
-                    argsValues.add(yytext());
+                case 1: {
+                    return ScilabDocument.ScilabLeafElement.NOTHING;
                 }
                 case 24:
                     break;
-                case 3: {
-                    yybegin(RETS);
+                case 16: {
+                    return ScilabDocument.ScilabLeafElement.BROKEN;
                 }
                 case 25:
                     break;
-                case 6: {
-                    returnValues.add(id);
-                    yybegin(FUNNAME);
+                case 12: {
+                    argsValues.add(yytext());
                 }
                 case 26:
                     break;
-                case 10: {
-                    yybegin(ARGS);
+                case 2: {
+                    id = yytext();
+                    yybegin(TYPEID);
                 }
                 case 27:
                     break;
-                case 16: {
-                    yybegin(FUNCTION);
+                case 10: {
+                    yybegin(ARGS);
                 }
                 case 28:
                     break;
-                case 7: {
-                    functionName = id;
-                    yybegin(ARGS);
+                case 18: {
+                    return ScilabDocument.ScilabLeafElement.ENDFUN;
                 }
                 case 29:
                     break;
-                case 14: {
-                    yybegin(FUNNAME);
+                case 3: {
+                    yybegin(RETS);
                 }
                 case 30:
                     break;
-                case 2: {
-                    id = yytext();
-                    yybegin(TYPEID);
+                case 8: {
+                    return ScilabDocument.ScilabLeafElement.FUN;
                 }
                 case 31:
                     break;
-                case 5: {
+                case 7: {
                     functionName = id;
-                    return ScilabDocument.ScilabLeafElement.FUN;
+                    yybegin(ARGS);
                 }
                 case 32:
                     break;
-                case 1: {
-                    return ScilabDocument.ScilabLeafElement.NOTHING;
+                case 17: {
+                    yybegin(FUNCTION);
                 }
                 case 33:
                     break;
-                case 4: {
+                case 11: {
+                    returnValues.add(yytext());
                 }
                 case 34:
                     break;
+                case 14: {
+                    yybegin(FUNNAME);
+                }
+                case 35:
+                    break;
+                case 4: {
+                }
+                case 36:
+                    break;
                 default:
                     if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
                         zzAtEOF = true;