mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Patch for David Daoust - Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=67622.<BR>
Also added 2 JUnit tests to verify.
This commit is contained in:
parent
2b26b06747
commit
6f1acede84
4 changed files with 18 additions and 3 deletions
|
@ -1942,4 +1942,9 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
||||||
writer.write("}\n"); //$NON-NLS-1$
|
writer.write("}\n"); //$NON-NLS-1$
|
||||||
parse( writer.toString() );
|
parse( writer.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug67622() throws Exception
|
||||||
|
{
|
||||||
|
parse( "const char * x = __FILE__;"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2247,7 +2247,11 @@ public class QuickParseASTTests extends BaseASTTest
|
||||||
|
|
||||||
public void testBadIdentifier() throws Exception
|
public void testBadIdentifier() throws Exception
|
||||||
{
|
{
|
||||||
parse( "class 0302 { private: int stinks; };", true, false ); //$NON-NLS-1$
|
parse( "class 0302 { private: int stinks; };", true, false ); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug67622() throws Exception
|
||||||
|
{
|
||||||
|
parse( "const char * x = __FILE__;"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -276,7 +276,12 @@ public final class Scanner implements IScanner, IScannerData {
|
||||||
addDefinition( __FILE__,
|
addDefinition( __FILE__,
|
||||||
new DynamicMacroDescriptor( __FILE__, new DynamicMacroEvaluator() {
|
new DynamicMacroDescriptor( __FILE__, new DynamicMacroEvaluator() {
|
||||||
public String execute() {
|
public String execute() {
|
||||||
return contextStack.getMostRelevantFileContext().getContextName();
|
String fName = contextStack.getMostRelevantFileContext().getContextName();
|
||||||
|
StringBuffer buff = new StringBuffer(fName.length() + 2);
|
||||||
|
buff.append('"');
|
||||||
|
buff.append(fName);
|
||||||
|
buff.append('"');
|
||||||
|
return buff.toString();
|
||||||
}
|
}
|
||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class ScannerContextInclusion implements IScannerContext
|
||||||
*/
|
*/
|
||||||
public void ungetChar(int undo) {
|
public void ungetChar(int undo) {
|
||||||
--offset;
|
--offset;
|
||||||
|
if (undo == '\n') line--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue