+++ /dev/null
-/*
- * Created on 28.04.2003
- *
- */
-package net.sourceforge.phpeclipse.phpeditor.php;
-
-import net.sourceforge.phpdt.internal.ui.text.*;
-
-import org.eclipse.jface.text.IDocument;
-
-/**
- * @author slanger
- * @version $Revision: 1.4 $
- */
-public class PHPPartition extends Partition
-{
- private boolean fShortTagsEnabled = true;
-
- /**
- * @param document
- * @param delim
- * @param contentType
- * @param parentPartition
- */
- public PHPPartition(IDocument document, String parentPartition)
- {
- super(
- document,
- new char[] { '<', '>' },
- IPHPPartitions.PHP_PARTITIONING,
- parentPartition);
- }
-
-
-
- /* (non-Javadoc)
- * @see net.sourceforge.phpeclipse.phpeditor.php.Partition#allowedPartition(java.lang.String)
- */
- protected boolean allowedPartition(String type)
- {
- if(type.equals(IPHPPartitions.PHP_PHPDOC_COMMENT))
- return true;
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see net.sourceforge.phpeclipse.phpeditor.php.Partition#scan()
- */
- protected boolean scan()
- {
- int ch;
- if(fShortTagsEnabled && checkPattern("<?", true))
- {
- scanToEnd();
- }
- else if(checkPattern("<?php", false))
- {
- scanToEnd();
- }
- else
- return false;
-
- return true;
- }
-
- private void scanToEnd()
- {
- if(isEnd())
- return;
-
- while(!checkPattern("?>", true))
- {
- int offset = getOffset();
- if(checkPattern("/*", true))
- {
- unread(2);
- return;
- }
- }
- }
-}