From 697521bcd16f25dc1a608dc79f48d7e83abd5d8b Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Sun, 20 Mar 2005 22:45:16 +0000 Subject: [PATCH] 2005-03-20 Alain Magloire Fix for 77978. * src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java * src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java * src/org/eclipse/cdt/internal/ui/text/CCommentAutoIndenStrategy.java * src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java * src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java * src/org/eclipse/cdt/internal/ui/text/CTextTools.java * src/org/eclipse/cdt/internal/ui/text/FastCPartionScanner.java * src/org/eclipse/cdt/internal/ui/text/ICPartitions.java --- core/org.eclipse.cdt.ui/ChangeLog | 11 ++ .../ui/actions/AddBlockCommentAction.java | 42 +---- .../internal/ui/text/CAutoIndentStrategy.java | 7 +- .../ui/text/CCommentAutoIndentStrategy.java | 4 +- .../internal/ui/text/CPartitionScanner.java | 14 +- .../ui/text/CSourceViewerConfiguration.java | 41 +++-- .../cdt/internal/ui/text/CTextTools.java | 7 +- .../ui/text/FastCPartitionScanner.java | 168 ++++-------------- .../cdt/internal/ui/text/ICPartitions.java | 24 ++- 9 files changed, 113 insertions(+), 205 deletions(-) diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 5ec62d0119d..007982e3866 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,14 @@ +2005-03-20 Alain Magloire + Fix for 77978. + * src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java + * src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java + * src/org/eclipse/cdt/internal/ui/text/CCommentAutoIndenStrategy.java + * src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java + * src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java + * src/org/eclipse/cdt/internal/ui/text/CTextTools.java + * src/org/eclipse/cdt/internal/ui/text/FastCPartionScanner.java + * src/org/eclipse/cdt/internal/ui/text/ICPartitions.java + 2005-03-18 David Inglis Fixed problem with error tick in CView not updateing properly. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java index dde4a3c61c9..145947e81d6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java @@ -109,44 +109,20 @@ public class AddBlockCommentAction extends BlockCommentAction { int partEndOffset= partition.getOffset() + partition.getLength(); int tokenLength= getCommentStart().length(); - /*boolean wasJavadoc= false; // true if the previous partition is javadoc - - if (partType == IJavaPartitions.JAVA_DOC) { - - wasJavadoc= true; - - } else*/ - if (partType == ICPartitions.C_MULTILINE_COMMENT) { - + if (partType == ICPartitions.C_MULTILINE_COMMENT) { // already in a comment - remove ending mark - edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$ - + edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$ } // advance to next partition partition= docExtension.getPartition(IDocumentExtension3.DEFAULT_PARTITIONING, partEndOffset, false); partType= partition.getType(); - // start of next partition -// if (wasJavadoc) { -// -// // if previous was javadoc, and the current one is not, then add block comment start -// if (partType == IDocument.DEFAULT_CONTENT_TYPE -// || isSpecialPartition(partType)) { -// edits.add(factory.createEdit(partition.getOffset(), 0, getCommentStart())); -// } -// -// } else { // !wasJavadoc - - /*if (partType == IJavaPartitions.JAVA_DOC) { - // if next is javadoc, end block comment before - edits.add(factory.createEdit(partition.getOffset(), 0, getCommentEnd())); - } else*/ if (partType == ICPartitions.C_MULTILINE_COMMENT) { - // already in a comment - remove startToken - edits.add(factory.createEdit(partition.getOffset(), getCommentStart().length(), "")); //$NON-NLS-1$ - } -// } - + // start of next partition + if (partType == ICPartitions.C_MULTILINE_COMMENT) { + // already in a comment - remove startToken + edits.add(factory.createEdit(partition.getOffset(), getCommentStart().length(), "")); //$NON-NLS-1$ + } return partition; } @@ -180,8 +156,8 @@ public class AddBlockCommentAction extends BlockCommentAction { * @return true if partType is special, false otherwise */ private boolean isSpecialPartition(String partType) { - return /*partType == IJavaPartitions.JAVA_CHARACTER - || */partType == ICPartitions.C_STRING + return partType == ICPartitions.C_CHARACTER + || partType == ICPartitions.C_STRING || partType == ICPartitions.C_SINGLE_LINE_COMMENT; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java index f2049ae1b5c..75366081431 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java @@ -6,7 +6,7 @@ package org.eclipse.cdt.internal.ui.text; */ import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DefaultAutoIndentStrategy; +import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.IDocument; @@ -16,7 +16,7 @@ import org.eclipse.cdt.ui.CUIPlugin; /** * Auto indent strategy sensitive to brackets. */ -public class CAutoIndentStrategy extends DefaultAutoIndentStrategy { +public class CAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy { public CAutoIndentStrategy() { @@ -114,9 +114,8 @@ public class CAutoIndentStrategy extends DefaultAutoIndentStrategy { int end= start + d.getLineLength(line) - 1; int whiteend= findEndOfWhiteSpace(d, start, end); return d.get(start, whiteend - start); - } else { - return ""; //$NON-NLS-1$ } + return ""; //$NON-NLS-1$ } private int getStringEnd(IDocument d, int pos, int end, char ch) throws BadLocationException { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCommentAutoIndentStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCommentAutoIndentStrategy.java index 2c857e9fa96..9b422b81eb1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCommentAutoIndentStrategy.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCommentAutoIndentStrategy.java @@ -6,7 +6,7 @@ package org.eclipse.cdt.internal.ui.text; */ import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DefaultAutoIndentStrategy; +import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; @@ -14,7 +14,7 @@ import org.eclipse.jface.text.IRegion; /** * Auto indent strategy for java doc comments */ -public class CCommentAutoIndentStrategy extends DefaultAutoIndentStrategy { +public class CCommentAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy { public CCommentAutoIndentStrategy() { } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java index e449a4f4b84..d0a51cba414 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java @@ -21,7 +21,9 @@ import org.eclipse.jface.text.rules.WordRule; /** - * This scanner recognizes comments + * This scanner is not actually use in the code it was relace by + * FastCPartitionScanner which was faster. We keep this around + * as a reference. */ public class CPartitionScanner extends RuleBasedPartitionScanner implements ICPartitions { @@ -85,6 +87,7 @@ public class CPartitionScanner extends RuleBasedPartitionScanner implements ICPa IToken comment= new Token(C_MULTILINE_COMMENT); IToken single_comment= new Token(C_SINGLE_LINE_COMMENT); IToken string= new Token(C_STRING); + IToken character = new Token(C_CHARACTER); IToken skip= new Token(SKIP); @@ -97,12 +100,13 @@ public class CPartitionScanner extends RuleBasedPartitionScanner implements ICPa // Add rule for single line comments. - rules.add(new EndOfLineRule("//", single_comment)); //$NON-NLS-1$ + rules.add(new EndOfLineRule("//", single_comment, '\\', true)); //$NON-NLS-1$ - // Add rule for strings and character constants. - rules.add(new SingleLineRule("\"", "\"", string, '\\')); //$NON-NLS-1$ //$NON-NLS-2$ - rules.add(new SingleLineRule("'", "'", skip, '\\')); //$NON-NLS-1$ //$NON-NLS-2$ + // Add rule for string constants. + rules.add(new SingleLineRule("\"", "\"", string, '\\', false, true)); //$NON-NLS-1$ //$NON-NLS-2$ + // Add rule for character constants + rules.add(new SingleLineRule("'", "'", character, '\\')); //$NON-NLS-1$ //$NON-NLS-2$ // Add special case word rule. EmptyCommentRule wordRule= new EmptyCommentRule(comment); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java index df117fc6d39..2f4a7462af3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java @@ -19,7 +19,7 @@ import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.DefaultInformationControl; -import org.eclipse.jface.text.IAutoIndentStrategy; +import org.eclipse.jface.text.IAutoEditStrategy; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlCreator; @@ -121,6 +121,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration { return fEditor; } + /** * Creates outline presenter. * @param editor Editor. @@ -171,14 +172,18 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration { reconciler.setDamager(dr, ICPartitions.C_SINGLE_LINE_COMMENT); reconciler.setRepairer(dr, ICPartitions.C_SINGLE_LINE_COMMENT); - dr= new DefaultDamagerRepairer(getStringScanner()); - reconciler.setDamager(dr, ICPartitions.C_STRING); - reconciler.setRepairer(dr, ICPartitions.C_STRING); - dr= new DefaultDamagerRepairer(getMultilineCommentScanner()); reconciler.setDamager(dr, ICPartitions.C_MULTILINE_COMMENT); reconciler.setRepairer(dr, ICPartitions.C_MULTILINE_COMMENT); + dr= new DefaultDamagerRepairer(getStringScanner()); + reconciler.setDamager(dr, ICPartitions.C_STRING); + reconciler.setRepairer(dr, ICPartitions.C_STRING); + + dr= new DefaultDamagerRepairer(getStringScanner()); + reconciler.setDamager(dr, ICPartitions.C_CHARACTER); + reconciler.setRepairer(dr, ICPartitions.C_CHARACTER); + return reconciler; } @@ -232,18 +237,16 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration { return null; } - - /** - * @see SourceViewerConfiguration#getAutoIndentStrategy(ISourceViewer, String) + /* + * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) */ - public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) { + public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) { if(ICPartitions.C_MULTILINE_COMMENT.equals(contentType)) { - return new CCommentAutoIndentStrategy(); + return new IAutoEditStrategy[] {new CCommentAutoIndentStrategy()}; } - return new CAutoIndentStrategy(); + return new IAutoEditStrategy[] {new CAutoIndentStrategy()}; } - /** * @see SourceViewerConfiguration#getDoubleClickStrategy(ISourceViewer, String) */ @@ -384,10 +387,12 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration { * @see SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer) */ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { - return new String[] { IDocument.DEFAULT_CONTENT_TYPE, - ICPartitions.C_MULTILINE_COMMENT, - ICPartitions.C_SINGLE_LINE_COMMENT, - ICPartitions.C_STRING }; + return new String[] { + IDocument.DEFAULT_CONTENT_TYPE, + ICPartitions.C_MULTILINE_COMMENT, + ICPartitions.C_SINGLE_LINE_COMMENT, + ICPartitions.C_STRING, + ICPartitions.C_CHARACTER}; } /** @@ -428,6 +433,10 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration { }; } + /* + * @see SourceViewerConfiguration#getInformationPresenter(ISourceViewer) + * @since 2.0 + */ public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) { return super.getInformationPresenter(sourceViewer); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CTextTools.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CTextTools.java index 5f9f215dc3e..0a500f9a4b7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CTextTools.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CTextTools.java @@ -14,7 +14,7 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentExtension3; import org.eclipse.jface.text.IDocumentPartitioner; -import org.eclipse.jface.text.rules.DefaultPartitioner; +import org.eclipse.jface.text.rules.FastPartitioner; import org.eclipse.jface.text.rules.IPartitionTokenScanner; import org.eclipse.jface.text.rules.RuleBasedScanner; import org.eclipse.jface.util.IPropertyChangeListener; @@ -172,10 +172,11 @@ public class CTextTools { String[] types= new String[] { ICPartitions.C_MULTILINE_COMMENT, ICPartitions.C_SINGLE_LINE_COMMENT, - ICPartitions.C_STRING + ICPartitions.C_STRING, + ICPartitions.C_CHARACTER }; - return new DefaultPartitioner(getPartitionScanner(), types); + return new FastPartitioner(getPartitionScanner(), types); } /** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java index b013aa35658..38bf435bc61 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java @@ -29,10 +29,11 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio // beginning of prefixes and postfixes private static final int NONE= 0; private static final int BACKSLASH= 1; // postfix for STRING and CHARACTER - private static final int SLASH= 2; // prefix for SINGLE_LINE or MULTI_LINE or JAVADOC - private static final int SLASH_STAR= 3; // prefix for MULTI_LINE_COMMENT or JAVADOC - private static final int STAR= 4; // postfix for MULTI_LINE_COMMENT or JAVADOC + private static final int SLASH= 2; // prefix for SINGLE_LINE or MULTI_LINE + private static final int SLASH_STAR= 3; // prefix for MULTI_LINE_COMMENT + private static final int STAR= 4; // postfix for MULTI_LINE_COMMENT private static final int CARRIAGE_RETURN=5; // postfix for STRING, CHARACTER and SINGLE_LINE_COMMENT + private static final int ESCAPED_CR=6; // for win32 system where termination string is \r\n save the backslash /** The scanner. */ // private final BufferedRuleBasedScanner fScanner= new BufferedRuleBasedScanner(1000); @@ -50,16 +51,11 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio /** The amount of characters already read on first call to nextToken(). */ private int fPrefixLength; - // emulate CPartitionScanner - private static final boolean fgEmulate= false; - private int fCOffset; - private int fCLength; - private final IToken[] fTokens= new IToken[] { new Token(null), new Token(C_SINGLE_LINE_COMMENT), new Token(C_MULTILINE_COMMENT), - new Token(SKIP), + new Token(C_CHARACTER), new Token(C_STRING) }; @@ -67,17 +63,6 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio * @see org.eclipse.jface.text.rules.ITokenScanner#nextToken() */ public IToken nextToken() { - - // emulate CPartitionScanner - if (fgEmulate) { - if (fCOffset != -1 && fTokenOffset + fTokenLength != fCOffset + fCLength) { - fTokenOffset += fTokenLength; - return fTokens[CCODE]; - } - fCOffset= -1; - fCLength= 0; - } - fTokenOffset += fTokenLength; fTokenLength= fPrefixLength; @@ -97,109 +82,27 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio return Token.EOF; case '\r': - // emulate CPartitionScanner - if (!fgEmulate && fLast != CARRIAGE_RETURN) { - fLast= CARRIAGE_RETURN; - fTokenLength++; - continue; - - } - - switch (fState) { - case SINGLE_LINE_COMMENT: - case CHARACTER: - case STRING: - if (fTokenLength > 0) { - IToken token= fTokens[fState]; - - // emulate CPartitionScanner - if (fgEmulate) { - fTokenLength++; - fLast= NONE; - fPrefixLength= 0; - } else { - fLast= CARRIAGE_RETURN; - fPrefixLength= 1; - } - - fState= CCODE; - return token; - - } - consume(); - continue; - - default: - consume(); - continue; - } + fLast= (fLast == BACKSLASH) ? ESCAPED_CR : CARRIAGE_RETURN; + fTokenLength++; + continue; case '\n': switch (fState) { case SINGLE_LINE_COMMENT: case CHARACTER: - case STRING: + //case STRING: // assert(fTokenLength > 0); - return postFix(fState); + boolean escapedLine = (fLast == BACKSLASH || fLast == ESCAPED_CR); + if (!escapedLine) { + return postFix(fState); + } + // FALLTHROUGH default: consume(); continue; } - default: - if (!fgEmulate && fLast == CARRIAGE_RETURN) { - switch (fState) { - case SINGLE_LINE_COMMENT: - case CHARACTER: - case STRING: - - int last; - int newState; - switch (ch) { - case '/': - last= SLASH; - newState= CCODE; - break; - - case '*': - last= STAR; - newState= CCODE; - break; - - case '\'': - last= NONE; - newState= CHARACTER; - break; - - case '"': - last= NONE; - newState= STRING; - break; - - case '\r': - last= CARRIAGE_RETURN; - newState= CCODE; - break; - - case '\\': - last= BACKSLASH; - newState= CCODE; - break; - - default: - last= NONE; - newState= CCODE; - break; - } - - fLast= NONE; // ignore fLast - return preFix(fState, newState, last, 1); - - default: - break; - } - } } // states @@ -237,8 +140,9 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio case '\'': fLast= NONE; // ignore fLast - if (fTokenLength > 0) + if (fTokenLength > 0) { return preFix(CCODE, CHARACTER, NONE, 1); + } preFix(CCODE, CHARACTER, NONE, 1); fTokenOffset += fTokenLength; fTokenLength= fPrefixLength; @@ -246,13 +150,15 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio case '"': fLast= NONE; // ignore fLast - if (fTokenLength > 0) + if (fTokenLength > 0 ) { return preFix(CCODE, STRING, NONE, 1); + } preFix(CCODE, STRING, NONE, 1); fTokenOffset += fTokenLength; fTokenLength= fPrefixLength; + consume(); break; - + default: consume(); break; @@ -260,7 +166,15 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio break; case SINGLE_LINE_COMMENT: - consume(); + switch (ch) { + case '\\': + fLast= (fLast == BACKSLASH) ? NONE : BACKSLASH; + fTokenLength++; + break; + default: + consume(); + break; + } break; case MULTI_LINE_COMMENT: @@ -362,18 +276,6 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio } private final IToken preFix(int state, int newState, int last, int prefixLength) { - // emulate CPartitionScanner - if (fgEmulate && state == CCODE && (fTokenLength - getLastLength(fLast) > 0)) { - fTokenLength -= getLastLength(fLast); - fCOffset= fTokenOffset; - fCLength= fTokenLength; - fTokenLength= 1; - fState= newState; - fPrefixLength= prefixLength; - fLast= last; - return fTokens[state]; - - } fTokenLength -= getLastLength(fLast); fLast= last; fPrefixLength= prefixLength; @@ -396,7 +298,7 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio else if (contentType.equals(C_STRING)) return STRING; - else if (contentType.equals(SKIP)) + else if (contentType.equals(C_CHARACTER)) return CHARACTER; else @@ -421,11 +323,6 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio fState= getState(contentType); } - // emulate CPartitionScanner - if (fgEmulate) { - fCOffset= -1; - fCLength= 0; - } } /* @@ -440,11 +337,6 @@ public class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitio fLast= NONE; fState= CCODE; - // emulate CPartitionScanner - if (fgEmulate) { - fCOffset= -1; - fCLength= 0; - } } /* diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/ICPartitions.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/ICPartitions.java index 3b0407fe762..d9bbbbd0463 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/ICPartitions.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/ICPartitions.java @@ -18,9 +18,25 @@ package org.eclipse.cdt.internal.ui.text; */ public interface ICPartitions { - public final static String SKIP= "__skip"; //$NON-NLS-1$ - public final static String C_MULTILINE_COMMENT= "c_multi_line_comment"; //$NON-NLS-1$ - public final static String C_SINGLE_LINE_COMMENT= "c_single_line_comment"; //$NON-NLS-1$ - public final static String C_STRING= "c_string"; //$NON-NLS-1$ + String SKIP= "__skip"; //$NON-NLS-1$ + /** + * The identifier multi-line (JLS2: TraditionalComment) comment partition content type. + */ + String C_MULTILINE_COMMENT= "c_multi_line_comment"; //$NON-NLS-1$ + + /** + * The identifier of the single-line (JLS2: EndOfLineComment) end comment partition content type. + */ + String C_SINGLE_LINE_COMMENT= "c_single_line_comment"; //$NON-NLS-1$ + + /** + * The identifier of the C string partition content type. + */ + String C_STRING= "c_string"; //$NON-NLS-1$ + + /** + * The identifier of the C character partition content type. + */ + String C_CHARACTER= "c_character"; //$NON-NLS-1$ }