/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.editors.tmlscript;
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.MultiLineRule;
import org.eclipse.jface.text.rules.Token;
import de.innovationgate.eclipse.editors.helpers.CharacterScannerWrapper;
public class TMLScriptMultiLineCommentRule extends MultiLineRule{
public TMLScriptMultiLineCommentRule() {
super("/*", "*/", new Token(TMLScriptPartitionScanner.MCOMMENT), '\\', true);
}
@Override
protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
if (super.sequenceDetected(scanner, sequence, eofAllowed)) {
CharacterScannerWrapper scannerWrapper = new CharacterScannerWrapper(scanner);
char c = (char)scannerWrapper.read();
int i = 0;
while(scannerWrapper.getColumn()!=0){
scannerWrapper.unread();
scannerWrapper.unread();
c =(char) scannerWrapper.read();
if(c=='"' || c=='\''){
i++;
}
}
scannerWrapper.reset();
if(i%2==0){
return true;
}
}
return false;
}
}