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

Bug 429361 - 'u8' token after #ifdef

Change-Id: Idc780473ca6356397f6466adff7ad0ee92a23fd0
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/23087
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2014-03-09 01:43:12 -05:00 committed by Sergey Prigogin
parent 83d0b2be3e
commit b930b2d66a
2 changed files with 23 additions and 7 deletions

View file

@ -10572,4 +10572,13 @@ public class AST2CPPTests extends AST2TestBase {
public void testParenthesizedReferenceArgument_424898() throws Exception {
parseAndCheckBindings();
}
// typedef unsigned char u8;
//
// #ifndef X
// u8 var;
// #endif
public void testU8TokenAfterIfdef_429361() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -90,10 +90,17 @@ final public class Lexer implements ITokenSequence {
private Token fLastToken;
// For the few cases where we have to lookahead more than one character
private int fMarkPhase3Offset;
private int fMarkPhase3EndOffset;
private int fMarkPhase3PrefetchedChar;
// To store the entire state. Note that we don't reuse the variables
// used for saving the phase3 because calls to markPhase3() and
// restorePhase3() can occur in between calls to saveState() and
// restoreState().
private int fMarkOffset;
private int fMarkEndOffset;
private int fMarkPrefetchedChar;
// To store the entire state.
private boolean fMarkInsideIncludeDirective;
private Token fMarkToken;
private Token fMarkLastToken;
@ -1006,18 +1013,18 @@ final public class Lexer implements ITokenSequence {
* with a long prefix.
*/
private void markPhase3() {
fMarkOffset= fOffset;
fMarkEndOffset= fEndOffset;
fMarkPrefetchedChar= fCharPhase3;
fMarkPhase3Offset= fOffset;
fMarkPhase3EndOffset= fEndOffset;
fMarkPhase3PrefetchedChar= fCharPhase3;
}
/**
* Restores a previously saved state of phase3.
*/
private void restorePhase3() {
fOffset= fMarkOffset;
fEndOffset= fMarkEndOffset;
fCharPhase3= fMarkPrefetchedChar;
fOffset= fMarkPhase3Offset;
fEndOffset= fMarkPhase3EndOffset;
fCharPhase3= fMarkPhase3PrefetchedChar;
}
/**