1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 352544 - the end of certain string definitions (e.g. R"(") is not correctly identified

This commit is contained in:
Anton Leherbauer 2011-07-20 14:57:50 +02:00
parent 9840061bd6
commit f60aad128c
2 changed files with 20 additions and 3 deletions

View file

@ -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 {

View file

@ -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) {