From 672be4fd1dda5600a764f31e866ef06ad3352f86 Mon Sep 17 00:00:00 2001 From: axelcl Date: Sun, 9 Oct 2005 12:35:22 +0000 Subject: [PATCH] Prepared better HEREDOC support; see comment for bug #1319276 --- .../internal/ui/text/FastJavaPartitionScanner.java | 11 +++++++++-- .../phpeditor/php/PHPPartitionScanner.java | 6 ++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/FastJavaPartitionScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/FastJavaPartitionScanner.java index fe962fb..08d9af2 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/FastJavaPartitionScanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/FastJavaPartitionScanner.java @@ -37,7 +37,7 @@ public class FastJavaPartitionScanner implements IPartitionTokenScanner, IPHPPar private static final int STRING_SQ = 5; - // private static final int CHARACTER= 4; + private static final int STRING_HEREDOC = 6; // beginning of prefixes and postfixes private static final int NONE = 0; @@ -54,6 +54,8 @@ public class FastJavaPartitionScanner implements IPartitionTokenScanner, IPHPPar private static final int CARRIAGE_RETURN = 6; // postfix for STRING_DQ, CHARACTER and SINGLE_LINE_COMMENT +// private static final int HEREDOC = 7; + /** The scanner. */ private final BufferedDocumentScanner fScanner = new BufferedDocumentScanner(1000); // faster implementation @@ -85,7 +87,8 @@ public class FastJavaPartitionScanner implements IPartitionTokenScanner, IPHPPar new Token(PHP_MULTILINE_COMMENT), new Token(PHP_PHPDOC_COMMENT), new Token(PHP_STRING_DQ), - new Token(PHP_STRING_SQ) }; + new Token(PHP_STRING_SQ), + new Token(PHP_STRING_HEREDOC)}; public FastJavaPartitionScanner(boolean emulate) { fEmulate = emulate; @@ -528,6 +531,10 @@ public class FastJavaPartitionScanner implements IPartitionTokenScanner, IPHPPar else if (contentType.equals(PHP_STRING_SQ)) return STRING_SQ; + + else if (contentType.equals(PHP_STRING_HEREDOC)) + return STRING_HEREDOC; + // else if (contentType.equals(JAVA_CHARACTER)) // return CHARACTER; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPPartitionScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPPartitionScanner.java index 390bba8..9b6420e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPPartitionScanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPPartitionScanner.java @@ -8,7 +8,7 @@ Contributors: Igor Malinin - initial contribution - $Id: PHPPartitionScanner.java,v 1.31 2005-10-09 11:24:07 axelcl Exp $ + $Id: PHPPartitionScanner.java,v 1.32 2005-10-09 12:35:01 axelcl Exp $ **********************************************************************/ package net.sourceforge.phpeclipse.phpeditor.php; @@ -335,7 +335,7 @@ public class PHPPartitionScanner implements IPartitionTokenScanner { if (position >= end) { return false; } - if (pos==heredocIdent.length) { + if (pos == heredocIdent.length) { return true; } ch = document.getChar(position++); // ignore escaped character @@ -344,8 +344,6 @@ public class PHPPartitionScanner implements IPartitionTokenScanner { } pos++; } - } else if (ch == '"') { - return true; } } } catch (BadLocationException e) { -- 1.7.1