From 92a74d69df2f0395fdaba598638a2446ebad183c Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Wed, 9 Mar 2011 14:43:02 +0000 Subject: [PATCH] Bug 339316: Empty IASTTranslationUnit.getRawSignature(). --- .../cdt/internal/core/parser/scanner/CPreprocessor.java | 6 +++--- .../cdt/internal/core/parser/scanner/ScannerContext.java | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) 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 aed8d8aedc5..8cb705ff165 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 @@ -92,7 +92,6 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable { private static final int PROTECT_DEFINED = 0x02; private static final int STOP_AT_NL = 0x04; private static final int CHECK_NUMBERS = 0x08; - private static final Token END_OF_INPUT = new Token(IToken.tEND_OF_INPUT, null, 0, 0); private interface IIncludeFileTester { T checkFile(String path, boolean isHeuristicMatch, IncludeSearchPathElement onPath); @@ -135,7 +134,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable { t= lexer.currentToken(); } if (fStopAtNewline && t.getType() == Lexer.tNEWLINE) - return END_OF_INPUT; + return new Token(IToken.tEND_OF_INPUT, null, 0, 0); return t; } @@ -145,7 +144,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable { public Token currentToken() { Token t= fCurrentContext.currentLexerToken(); if (fStopAtNewline && t.getType() == Lexer.tNEWLINE) - return END_OF_INPUT; + return new Token(IToken.tEND_OF_INPUT, null, 0, 0); return t; } @@ -573,6 +572,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable { case IToken.tEND_OF_INPUT: if (fContentAssistLimit < 0) { + fPrefetchedTokens= t1; throw new EndOfFileException(t1.getOffset()); } int useType= fHandledCompletion ? IToken.tEOC : IToken.tCOMPLETION; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerContext.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerContext.java index 6a642e2a7b4..b83fff9b4a9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerContext.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerContext.java @@ -20,8 +20,6 @@ import org.eclipse.cdt.core.parser.OffsetLimitReachedException; * @since 5.0 */ final class ScannerContext { - private static final Token END_TOKEN = new Token(IToken.tEND_OF_INPUT, null, 0, 0); - enum BranchKind {eIf, eElif, eElse, eEnd} enum CodeState {eActive, eParseInactive, eSkipInactive} final static class Conditional { @@ -231,7 +229,7 @@ final class ScannerContext { if (fLexer != null) { return fLexer.currentToken(); } - return END_TOKEN; + return new Token(IToken.tEND_OF_INPUT, null, 0, 0); } /** @@ -245,7 +243,7 @@ final class ScannerContext { if (fLexer != null) { return fLexer.nextToken(); } - return END_TOKEN; + return new Token(IToken.tEND_OF_INPUT, null, 0, 0); } /**