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

Bug 278118 - Code formatter is confused by some arithmetic expressions

This commit is contained in:
Anton Leherbauer 2009-05-28 08:22:59 +00:00
parent b24cf5d723
commit 8d86fb4a8f
3 changed files with 31 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2009 Wind River Systems, Inc. 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
@ -2133,7 +2133,7 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
private int visit(IASTLiteralExpression node) {
if (node.getKind() == IASTLiteralExpression.lk_string_literal) {
// handle concatentation of string literals
// handle concatenation of string literals
int token;
boolean needSpace= false;
final int line= scribe.line;

View file

@ -314,7 +314,10 @@ public class SimpleScanner {
if (!hex) {
if (c == '*') {
return newToken(Token.tDOTSTAR);
if (floatingPoint && digits == 0) {
// encountered .*
return newToken(Token.tDOTSTAR);
}
} else if (c == '.') {
if (floatingPoint && digits == 0) {
// encountered ..

View file

@ -1203,4 +1203,29 @@ public class CodeFormatterTest extends BaseUITestCase {
assertFormatterResult(original, expected);
}
//void f() {
// Canvas1->MoveTo((50 + (24* 20 ) +xoff) *Scale,(200+yoff)*ScaleY);
// Canvas1->LineTo((67+(24*20) +xoff)*Scale,(200+yoff)*ScaleY);
// Canvas1->MoveTo((50+(24*20) +xoff)*Scale,((200+yoff)*ScaleY)-1);
// Canvas1->LineTo((67+(24*20) +xoff)*Scale,((200+yoff)*ScaleY)-1);
// Canvas1->MoveTo((50+(24*20) +xoff)*Scale,((200+yoff)*ScaleY)+1);
// Canvas1->LineTo((67+(24*20) +xoff)*Scale,((200+yoff)*ScaleY)+1);
//}
//void f() {
// Canvas1->MoveTo((50 + (24 * 20) + xoff) * Scale, (200 + yoff) * ScaleY);
// Canvas1->LineTo((67 + (24 * 20) + xoff) * Scale, (200 + yoff) * ScaleY);
// Canvas1->MoveTo((50 + (24 * 20) + xoff) * Scale, ((200 + yoff) * ScaleY)
// - 1);
// Canvas1->LineTo((67 + (24 * 20) + xoff) * Scale, ((200 + yoff) * ScaleY)
// - 1);
// Canvas1->MoveTo((50 + (24 * 20) + xoff) * Scale, ((200 + yoff) * ScaleY)
// + 1);
// Canvas1->LineTo((67 + (24 * 20) + xoff) * Scale, ((200 + yoff) * ScaleY)
// + 1);
//}
public void testScannerErrorWithIntegerFollowedByStar_Bug278118() throws Exception {
assertFormatterResult();
}
}