From f60aad128c86e5294328a1384b95d7cda3202bcf Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Wed, 20 Jul 2011 14:57:50 +0200 Subject: [PATCH] Bug 352544 - the end of certain string definitions (e.g. R"(") is not correctly identified --- .../cdt/ui/tests/text/CPartitionerTest.java | 19 ++++++++++++++++++- .../ui/text/FastCPartitionScanner.java | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java index 33a4fc9e475..656a833102b 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CPartitionerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * 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 @@ -1296,6 +1296,23 @@ public class CPartitionerTest extends TestCase { } } + public void testRawString_Bug352544() { + try { + + fDocument.replace(0, fDocument.getLength(), "BAR\"(\";"); + ITypedRegion[] result= fDocument.computePartitioning(0, fDocument.getLength()); + TypedRegion[] expectation= { + new TypedRegion(0, 3, IDocument.DEFAULT_CONTENT_TYPE), + new TypedRegion(3, 3, ICPartitions.C_STRING), + new TypedRegion(6, 1, IDocument.DEFAULT_CONTENT_TYPE), + }; + checkPartitioning(expectation, result); + + } catch (BadLocationException x) { + assertTrue(false); + } + } + public void testEditingRawString1() { try { 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 57b18b608ba..ea242474479 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * 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 @@ -388,7 +388,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa consume(); break; default: - if ('a' <= ch && ch <= 'z' || 'A' <= ch && 'Z' <= ch || ch =='_') { + if ('a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch =='_') { fLast = IDENT; fTokenOffset++; } else if ('0' <= ch && ch <= '9' && fLast == IDENT) {