Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJohn Camelon2004-03-29 15:56:02 -0500
committerJohn Camelon2004-03-29 15:56:02 -0500
commit13b3c997492faba1687285cf3e9f5d9ec4152059 (patch)
tree2b19789fb76baf32d0e3e5d6bc45f5d76b20df24 /core
parentd6b510d2008f64c058e2355ec7f8af766853bb6c (diff)
downloadorg.eclipse.cdt-13b3c997492faba1687285cf3e9f5d9ec4152059.tar.gz
org.eclipse.cdt-13b3c997492faba1687285cf3e9f5d9ec4152059.tar.xz
org.eclipse.cdt-13b3c997492faba1687285cf3e9f5d9ec4152059.zip
Fixed Bug 56517 - Preprocessor skipping doesn't ignore the contents of string literals.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/ChangeLog3
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java17
-rw-r--r--core/org.eclipse.cdt.core/parser/ChangeLog-parser3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Scanner.java6
4 files changed, 25 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog
index 2b0907af29..bd316582bc 100644
--- a/core/org.eclipse.cdt.core.tests/ChangeLog
+++ b/core/org.eclipse.cdt.core.tests/ChangeLog
@@ -1,3 +1,6 @@
+2004-03-29 John Camelon
+ Added ScannerTestCase::testBug56517().
+
2004-03-28 John Camelon
Removed ScannerTestCase::testGerman() until we can figure out how to make it portable.
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java
index 3c079eed4f..d62f7e243b 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ScannerTestCase.java
@@ -1579,4 +1579,21 @@ public class ScannerTestCase extends BaseScannerTest
validateEOF();
}
+
+ public void testBug56517() throws Exception
+ {
+ Writer writer = new StringWriter();
+ writer.write( "#if 0 \n");
+ writer.write( "char * x = \"#boo\";\n" );
+ writer.write( "#endif\n");
+ initializeScanner( writer.toString() );
+ validateEOF();
+// validateToken( IToken.t_char);
+// validateToken( IToken.tSTAR);
+// validateIdentifier( "x");
+// validateToken( IToken.tASSIGN );
+// validateString( "#boo");
+// validateToken(IToken.tSEMI);
+// validateEOF();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog-parser b/core/org.eclipse.cdt.core/parser/ChangeLog-parser
index 54f3aaf767..6908786fb9 100644
--- a/core/org.eclipse.cdt.core/parser/ChangeLog-parser
+++ b/core/org.eclipse.cdt.core/parser/ChangeLog-parser
@@ -1,3 +1,6 @@
+2004-03-29 John Camelon
+ Fixed Bug 56517 - Preprocessor skipping doesn't ignore the contents of string literals.
+
2004-03-28 John Camelon
Remove warnings.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Scanner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Scanner.java
index 466d961b75..e95ecb7c63 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Scanner.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Scanner.java
@@ -1215,9 +1215,8 @@ public class Scanner implements IScanner {
scannerExtension.handlePreprocessorDirective( token, getRestOfPreprocessorLine() );
else
{
- StringBuffer buffer = new StringBuffer( "#"); //$NON-NLS-1$
- buffer.append( token );
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true );
+ if( passOnToClient )
+ handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, token, beginningOffset, false, true );
}
return null;
}
@@ -1510,7 +1509,6 @@ public class Scanner implements IScanner {
while (c != NOCHAR) {
if ( ! passOnToClient ) {
-
while (c != NOCHAR && c != '#' )
{
c = getChar();

Back to the top