From: <ce...@pr...> - 2004-01-27 14:17:02
|
Update of /cvsroot/csseditor/net.sourceforge.csseditor/src/net/sourceforge/csseditor/internal/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5892/src/net/sourceforge/csseditor/internal/text Modified Files: CssPartitionScanner.java Log Message: Fix for bug #877547 (Incorrect syntax highlighting for seemingly escaped comments) Index: CssPartitionScanner.java =================================================================== RCS file: /cvsroot/csseditor/net.sourceforge.csseditor/src/net/sourceforge/csseditor/internal/text/CssPartitionScanner.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CssPartitionScanner.java 14 Dec 2003 21:59:54 -0000 1.1.1.1 --- CssPartitionScanner.java 25 Jan 2004 09:14:55 -0000 1.2 *************** *** 1,65 **** ! /* ! * Copyright (c) 2003 Christopher Lenz and others. ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the Common Public License v1.0 ! * which accompanies this distribution, and is available at ! * http://www.eclipse.org/legal/cpl-v10.html ! * ! * Contributors: ! * Christopher Lenz - initial API and implementation ! * ! * $Id$ ! */ ! ! package net.sourceforge.csseditor.internal.text; ! ! import java.util.ArrayList; ! import java.util.List; ! ! import org.eclipse.jface.text.rules.IPredicateRule; ! import org.eclipse.jface.text.rules.IToken; ! import org.eclipse.jface.text.rules.MultiLineRule; ! import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; ! import org.eclipse.jface.text.rules.SingleLineRule; ! import org.eclipse.jface.text.rules.Token; ! ! /** ! * ! */ ! public class CssPartitionScanner extends RuleBasedPartitionScanner { ! ! // Constants --------------------------------------------------------------- ! ! public static final String CSS_COMMENT = ! "__css_comment_partition_content_type"; //$NON-NLS-1$ ! ! public static final String CSS_STRING = ! "__css_string_partition_content_type"; //$NON-NLS-1$ ! ! // Constructors ------------------------------------------------------------ ! ! /** ! * Constructor. ! */ ! public CssPartitionScanner() { ! ! IToken commentToken = new Token(CSS_COMMENT); ! IToken stringToken = new Token(CSS_STRING); ! ! List rules = new ArrayList(); ! ! rules.add(new MultiLineRule( ! "/*", "*/", commentToken, '\\')); //$NON-NLS-1$ //$NON-NLS-2$ ! ! // TODO Strings can be continued over a new line using the escape ! // character (#42613) ! rules.add(new SingleLineRule( ! "\"", "\"", stringToken, '\\')); //$NON-NLS-1$ //$NON-NLS-2$ ! rules.add(new SingleLineRule( ! "'", "'", stringToken, '\\')); //$NON-NLS-1$ //$NON-NLS-2$ ! ! setPredicateRules((IPredicateRule[]) ! rules.toArray(new IPredicateRule[rules.size()])); ! } ! ! } --- 1,65 ---- ! /* ! * Copyright (c) 2003 Christopher Lenz and others. ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the Common Public License v1.0 ! * which accompanies this distribution, and is available at ! * http://www.eclipse.org/legal/cpl-v10.html ! * ! * Contributors: ! * Christopher Lenz - initial API and implementation ! * ! * $Id$ ! */ ! ! package net.sourceforge.csseditor.internal.text; ! ! import java.util.ArrayList; ! import java.util.List; ! ! import org.eclipse.jface.text.rules.IPredicateRule; ! import org.eclipse.jface.text.rules.IToken; ! import org.eclipse.jface.text.rules.MultiLineRule; ! import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; ! import org.eclipse.jface.text.rules.SingleLineRule; ! import org.eclipse.jface.text.rules.Token; ! ! /** ! * ! */ ! public class CssPartitionScanner extends RuleBasedPartitionScanner { ! ! // Constants --------------------------------------------------------------- ! ! public static final String CSS_COMMENT = ! "__css_comment_partition_content_type"; //$NON-NLS-1$ ! ! public static final String CSS_STRING = ! "__css_string_partition_content_type"; //$NON-NLS-1$ ! ! // Constructors ------------------------------------------------------------ ! ! /** ! * Constructor. ! */ ! public CssPartitionScanner() { ! ! IToken commentToken = new Token(CSS_COMMENT); ! IToken stringToken = new Token(CSS_STRING); ! ! List rules = new ArrayList(); ! ! rules.add(new MultiLineRule( ! "/*", "*/", commentToken)); //$NON-NLS-1$ //$NON-NLS-2$ ! ! // TODO Strings can be continued over a new line using the escape ! // character (#42613) ! rules.add(new SingleLineRule( ! "\"", "\"", stringToken, '\\')); //$NON-NLS-1$ //$NON-NLS-2$ ! rules.add(new SingleLineRule( ! "'", "'", stringToken, '\\')); //$NON-NLS-1$ //$NON-NLS-2$ ! ! setPredicateRules((IPredicateRule[]) ! rules.toArray(new IPredicateRule[rules.size()])); ! } ! ! } |