summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-08-25 23:18:15 (EDT)
committerSergey Prigogin2013-08-26 16:35:57 (EDT)
commit4fdb74888110d1c808604cf16f5bf15409611932 (patch)
tree3a65a1138526a4a188b1a412a7d36de4e9891745
parent404b6d728364041407b2b6cdb8f0ae9092cc828a (diff)
downloadorg.eclipse.cdt-4fdb74888110d1c808604cf16f5bf15409611932.zip
org.eclipse.cdt-4fdb74888110d1c808604cf16f5bf15409611932.tar.gz
org.eclipse.cdt-4fdb74888110d1c808604cf16f5bf15409611932.tar.bz2
Bug 394048 - parser confusion about octal double refs/changes/39/15839/2
Change-Id: I4184acdeb4909022a2e2b30830530bd33a4897f3 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/15839 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java11
2 files changed, 13 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
index b88622d..816f687 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
@@ -7461,4 +7461,9 @@ public class AST2Tests extends AST2TestBase {
public void testFunctionReturningFunctionPointer_413204() throws Exception {
parseAndCheckBindings(getAboveComment(), CPP);
}
+
+ // double d = 00.9;
+ public void testOctalFloatingPointLiteral_394048() throws Exception {
+ parseAndCheckBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java
index f619735..2ebdb5a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java
@@ -976,12 +976,17 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
++pos;
break;
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7':
- isOctal = true;
+ if (!isFloat)
+ isOctal = true;
++pos;
break;
case '8': case '9':
- handleProblem(IProblem.SCANNER_BAD_OCTAL_FORMAT, image, number.getOffset(), number.getEndOffset());
- return;
+ if (!isFloat) {
+ handleProblem(IProblem.SCANNER_BAD_OCTAL_FORMAT, image, number.getOffset(), number.getEndOffset());
+ return;
+ }
+ ++pos;
+ break;
}
}
}