bug fix 1403993, scanner wrongly detected XML comment end, when closing > was still...
[phpeclipse.git] / net.sourceforge.phpeclipse.xml.ui / src / net / sourceforge / phpeclipse / xml / ui / internal / text / XMLPartitionScanner.java
index 4434faa..fd44b54 100644 (file)
@@ -8,7 +8,7 @@
  * Contributors:
  *     Igor Malinin - initial contribution
  *
- * $Id: XMLPartitionScanner.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLPartitionScanner.java,v 1.4 2006-01-15 12:24:16 bananeweizen Exp $
  */
 
 package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -26,8 +26,8 @@ import org.eclipse.jface.text.rules.Token;
 
 
 /**
- * 
- * 
+ *
+ *
  * @author Igor Malinin
  */
 public class XMLPartitionScanner implements IPartitionTokenScanner {
@@ -147,6 +147,9 @@ public class XMLPartitionScanner implements IPartitionTokenScanner {
                                        length = 0;
                                        return nextToken();
                                }
+                               break;
+                   default:
+                       unread();
                }
 
 loop:
@@ -222,6 +225,8 @@ loop:
                                                        return getToken(XML_ATTRIBUTE);
                                        }
                                }
+                       default:
+                         unread();
                }
 
                while (true) {
@@ -303,7 +308,7 @@ loop:
                                                        }
 
                                                        unread();
-                                                       break loop;
+                                                       continue loop;
                                        }
                        }
                }
@@ -490,28 +495,48 @@ loop:
                this.position = offset;
                this.length = 0;
 
-               this.state = STATE_DEFAULT;
+               this.state = STATE_DEFAULT;
        }
 
        /*
+          * @see org.eclipse.jface.text.rules.IPartitionTokenScanner
+          */
+//       public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) {
+//         state = STATE_DEFAULT;
+//         if (partitionOffset > -1) {
+//           int delta = offset - partitionOffset;
+//           if (delta > 0) {
+//             setRange(document, partitionOffset, length + delta);
+//             return;
+//           }
+//         }
+//         setRange(document, partitionOffset, length);
+//       }
+       /*
         * @see org.eclipse.jface.text.rules.IPartitionTokenScanner
         */
        public void setPartialRange(
                IDocument document, int offset, int length,
                String contentType, int partitionOffset
        ) {
+//       boolean flag = false;
                this.document = document;
                this.end = offset + length;
 
                // NB! Undocumented value: -1
                if (partitionOffset >= 0) {
                        offset = partitionOffset;
+//                     flag = true;
                }
 
                this.offset = offset;
                this.position = offset;
                this.length = 0;
 
+//             if (flag) {
+//               state = STATE_DEFAULT;
+//               return;
+//             }
                if (contentType == XML_ATTRIBUTE) {
                        state = STATE_TAG;
                        return;