X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaHeuristicScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaHeuristicScanner.java index 6bea251..0ca33ab 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaHeuristicScanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaHeuristicScanner.java @@ -13,6 +13,7 @@ package net.sourceforge.phpdt.internal.ui.text; import java.util.Arrays; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; +import net.sourceforge.phpeclipse.phpeditor.php.PHPDocumentPartitioner; import org.eclipse.jface.text.Assert; import org.eclipse.jface.text.BadLocationException; @@ -327,8 +328,10 @@ public class JavaHeuristicScanner implements Symbols { * the document to scan. */ public JavaHeuristicScanner(IDocument document) { +// this(document, IPHPPartitions.PHP_PARTITIONING, +// IDocument.DEFAULT_CONTENT_TYPE); this(document, IPHPPartitions.PHP_PARTITIONING, - IDocument.DEFAULT_CONTENT_TYPE); + PHPDocumentPartitioner.PHP_SCRIPT_CODE); } /** @@ -380,7 +383,25 @@ public class JavaHeuristicScanner implements Symbols { case QUESTIONMARK: return TokenQUESTIONMARK; case EQUAL: + try { + if (fDocument.getChar(fPos) == '>') { + fPos++; + return TokenOTHER; + } + } catch (BadLocationException e) { + } return TokenEQUAL; + case '<': + try { + if (fDocument.get(fPos, 4).equalsIgnoreCase("?php")) { + fPos += 4; + return TokenEOF; + } else if (fDocument.getChar(fPos) == '?') { + fPos++; + return TokenEOF; + } + } catch (BadLocationException e) { + } } // else @@ -451,6 +472,18 @@ public class JavaHeuristicScanner implements Symbols { return TokenQUESTIONMARK; case EQUAL: return TokenEQUAL; + case '>': + try { + switch (fDocument.getChar(fPos)) { + case '=': + fPos--; + return TokenOTHER; + case '?': + fPos--; + return TokenEOF; + } + } catch (BadLocationException e) { + } } // else @@ -752,6 +785,15 @@ public class JavaHeuristicScanner implements Symbols { while (fPos < bound) { fChar = fDocument.getChar(fPos); + // omit closing tag + if (fChar == '?') { + if (fPos < fDocument.getLength() - 1) { + if (fDocument.get(fPos - 1, 2).equalsIgnoreCase("?>")) { + fPos++; + return NOT_FOUND; + } + } + } if (condition.stop(fChar, fPos, true)) return fPos; @@ -841,6 +883,22 @@ public class JavaHeuristicScanner implements Symbols { while (fPos > bound) { fChar = fDocument.getChar(fPos); + // omit opening tag + if (fChar == 'p' || fChar == 'P') { + if (fPos >= 4) { + if (fDocument.get(fPos - 4, 5).equalsIgnoreCase("= 1) { + if (fDocument.get(fPos - 1, 2).equalsIgnoreCase("