mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 02:05:39 +02:00
Bug 286081.
This commit is contained in:
parent
4b2dc9b25f
commit
44d46d0b79
1 changed files with 120 additions and 111 deletions
|
@ -291,8 +291,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
Keywords.addKeywordsPreprocessor(fPPKeywords);
|
Keywords.addKeywordsPreprocessor(fPPKeywords);
|
||||||
if (language == ParserLanguage.C) {
|
if (language == ParserLanguage.C) {
|
||||||
Keywords.addKeywordsC(fKeywords);
|
Keywords.addKeywordsC(fKeywords);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Keywords.addKeywordsCpp(fKeywords);
|
Keywords.addKeywordsCpp(fKeywords);
|
||||||
}
|
}
|
||||||
CharArrayIntMap additionalKeywords= configuration.getAdditionalKeywords();
|
CharArrayIntMap additionalKeywords= configuration.getAdditionalKeywords();
|
||||||
|
@ -350,15 +349,15 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
fMacroDictionary.put(__TIME__.getNameCharArray(), __TIME__);
|
fMacroDictionary.put(__TIME__.getNameCharArray(), __TIME__);
|
||||||
fMacroDictionary.put(__LINE__.getNameCharArray(), __LINE__);
|
fMacroDictionary.put(__LINE__.getNameCharArray(), __LINE__);
|
||||||
|
|
||||||
if (lang == ParserLanguage.CPP)
|
if (lang == ParserLanguage.CPP) {
|
||||||
fMacroDictionary.put(__cplusplus.getNameCharArray(), __cplusplus);
|
fMacroDictionary.put(__cplusplus.getNameCharArray(), __cplusplus);
|
||||||
else {
|
} else {
|
||||||
fMacroDictionary.put(__STDC_HOSTED__.getNameCharArray(), __STDC_HOSTED__);
|
fMacroDictionary.put(__STDC_HOSTED__.getNameCharArray(), __STDC_HOSTED__);
|
||||||
fMacroDictionary.put(__STDC_VERSION__.getNameCharArray(), __STDC_VERSION__);
|
fMacroDictionary.put(__STDC_VERSION__.getNameCharArray(), __STDC_VERSION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
IMacro[] toAdd = config.getAdditionalMacros();
|
IMacro[] toAdd = config.getAdditionalMacros();
|
||||||
if(toAdd != null) {
|
if (toAdd != null) {
|
||||||
for (final IMacro macro : toAdd) {
|
for (final IMacro macro : toAdd) {
|
||||||
addMacroDefinition(macro.getSignature(), macro.getExpansion());
|
addMacroDefinition(macro.getSignature(), macro.getExpansion());
|
||||||
}
|
}
|
||||||
|
@ -398,7 +397,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
fCurrentContext= new ScannerContext(ctx, fCurrentContext, new Lexer(buffer, fLexOptions, this, this));
|
fCurrentContext= new ScannerContext(ctx, fCurrentContext, new Lexer(buffer, fLexOptions, this, this));
|
||||||
ScannerContext preCtx= fCurrentContext;
|
ScannerContext preCtx= fCurrentContext;
|
||||||
try {
|
try {
|
||||||
while(internalFetchToken(preCtx, CHECK_NUMBERS, false).getType() != IToken.tEND_OF_INPUT) {
|
while (internalFetchToken(preCtx, CHECK_NUMBERS, false).getType() != IToken.tEND_OF_INPUT) {
|
||||||
// just eat the tokens
|
// just eat the tokens
|
||||||
}
|
}
|
||||||
final ILocationCtx locationCtx = fCurrentContext.getLocationCtx();
|
final ILocationCtx locationCtx = fCurrentContext.getLocationCtx();
|
||||||
|
@ -444,8 +443,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
fLocationMap.registerPredefinedMacro(result);
|
fLocationMap.registerPredefinedMacro(result);
|
||||||
fMacroDictionary.put(result.getNameCharArray(), result);
|
fMacroDictionary.put(result.getNameCharArray(), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
fLog.traceLog("Invalid macro definition: '" + String.valueOf(key) + "'"); //$NON-NLS-1$//$NON-NLS-2$
|
fLog.traceLog("Invalid macro definition: '" + String.valueOf(key) + "'"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -548,7 +546,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
Token t1= fetchToken();
|
Token t1= fetchToken();
|
||||||
|
|
||||||
final int tt1= t1.getType();
|
final int tt1= t1.getType();
|
||||||
switch(tt1) {
|
switch (tt1) {
|
||||||
case IToken.tCOMPLETION:
|
case IToken.tCOMPLETION:
|
||||||
fHandledCompletion= true;
|
fHandledCompletion= true;
|
||||||
break;
|
break;
|
||||||
|
@ -572,10 +570,10 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
Token t2;
|
Token t2;
|
||||||
StringBuffer buf= null;
|
StringBuffer buf= null;
|
||||||
int endOffset= 0;
|
int endOffset= 0;
|
||||||
loop: while(true) {
|
loop: while (true) {
|
||||||
t2= fetchToken();
|
t2= fetchToken();
|
||||||
final int tt2= t2.getType();
|
final int tt2= t2.getType();
|
||||||
switch(tt2) {
|
switch (tt2) {
|
||||||
case IToken.tLSTRING:
|
case IToken.tLSTRING:
|
||||||
case IToken.tSTRING:
|
case IToken.tSTRING:
|
||||||
case IToken.tUTF16STRING:
|
case IToken.tUTF16STRING:
|
||||||
|
@ -602,12 +600,12 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
char[] image= new char[buf.length() + prefix.length + 2];
|
char[] image= new char[buf.length() + prefix.length + 2];
|
||||||
int off= -1;
|
int off= -1;
|
||||||
|
|
||||||
for(char c : prefix)
|
for (char c : prefix)
|
||||||
image[++off] = c;
|
image[++off] = c;
|
||||||
|
|
||||||
image[++off]= '"';
|
image[++off]= '"';
|
||||||
buf.getChars(0, buf.length(), image, ++off);
|
buf.getChars(0, buf.length(), image, ++off);
|
||||||
image[image.length-1]= '"';
|
image[image.length - 1]= '"';
|
||||||
t1= new TokenWithImage(st.getTokenValue(), null, t1.getOffset(), endOffset, image);
|
t1= new TokenWithImage(st.getTokenValue(), null, t1.getOffset(), endOffset, image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,7 +617,6 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return t1;
|
return t1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void skipInactiveCode() throws OffsetLimitReachedException {
|
public void skipInactiveCode() throws OffsetLimitReachedException {
|
||||||
final Lexer lexer= fCurrentContext.getLexer();
|
final Lexer lexer= fCurrentContext.getLexer();
|
||||||
if (lexer != null) {
|
if (lexer != null) {
|
||||||
|
@ -640,14 +637,14 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
final char[] image= t1.getCharImage();
|
final char[] image= t1.getCharImage();
|
||||||
final int length= image.length;
|
final int length= image.length;
|
||||||
int start = 1;
|
int start = 1;
|
||||||
for(char c : image) {
|
for (char c : image) {
|
||||||
if(c == '"')
|
if (c == '"')
|
||||||
break;
|
break;
|
||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length > 1) {
|
if (length > 1) {
|
||||||
final int diff= image[length-1] == '"' ? length-start-1 : length-start;
|
final int diff= image[length - 1] == '"' ? length - start - 1 : length - start;
|
||||||
if (diff > 0) {
|
if (diff > 0) {
|
||||||
buf.append(image, start, diff);
|
buf.append(image, start, diff);
|
||||||
}
|
}
|
||||||
|
@ -656,8 +653,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
|
|
||||||
Token internalFetchToken(final ScannerContext uptoEndOfCtx, int options, boolean withinExpansion) throws OffsetLimitReachedException {
|
Token internalFetchToken(final ScannerContext uptoEndOfCtx, int options, boolean withinExpansion) throws OffsetLimitReachedException {
|
||||||
Token ppToken= fCurrentContext.currentLexerToken();
|
Token ppToken= fCurrentContext.currentLexerToken();
|
||||||
while(true) {
|
while (true) {
|
||||||
switch(ppToken.getType()) {
|
switch (ppToken.getType()) {
|
||||||
case Lexer.tBEFORE_INPUT:
|
case Lexer.tBEFORE_INPUT:
|
||||||
ppToken= fCurrentContext.nextPPToken();
|
ppToken= fCurrentContext.nextPPToken();
|
||||||
continue;
|
continue;
|
||||||
|
@ -864,17 +861,13 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
// The check for bin has to come before float, otherwise binary integers
|
// The check for bin has to come before float, otherwise binary integers
|
||||||
// with float components get flagged as BAD_FLOATING_POINT
|
// with float components get flagged as BAD_FLOATING_POINT
|
||||||
handleProblem(IProblem.SCANNER_BAD_BINARY_FORMAT, image, number.getOffset(), number.getEndOffset());
|
handleProblem(IProblem.SCANNER_BAD_BINARY_FORMAT, image, number.getOffset(), number.getEndOffset());
|
||||||
}
|
} else if (isFloat) {
|
||||||
else if (isFloat) {
|
|
||||||
handleProblem(IProblem.SCANNER_BAD_FLOATING_POINT, image, number.getOffset(), number.getEndOffset());
|
handleProblem(IProblem.SCANNER_BAD_FLOATING_POINT, image, number.getOffset(), number.getEndOffset());
|
||||||
}
|
} else if (isHex) {
|
||||||
else if (isHex) {
|
|
||||||
handleProblem(IProblem.SCANNER_BAD_HEX_FORMAT, image, number.getOffset(), number.getEndOffset());
|
handleProblem(IProblem.SCANNER_BAD_HEX_FORMAT, image, number.getOffset(), number.getEndOffset());
|
||||||
}
|
} else if (isOctal) {
|
||||||
else if (isOctal) {
|
|
||||||
handleProblem(IProblem.SCANNER_BAD_OCTAL_FORMAT, image, number.getOffset(), number.getEndOffset());
|
handleProblem(IProblem.SCANNER_BAD_OCTAL_FORMAT, image, number.getOffset(), number.getEndOffset());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
handleProblem(IProblem.SCANNER_BAD_DECIMAL_FORMAT, image, number.getOffset(), number.getEndOffset());
|
handleProblem(IProblem.SCANNER_BAD_DECIMAL_FORMAT, image, number.getOffset(), number.getEndOffset());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -901,9 +894,16 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're not include_next, then we are looking for the first occurrence of
|
// If we're not include_next, then we are looking for the first occurrence of
|
||||||
// the file, otherwise, we ignore all the paths before the current directory
|
// the file, otherwise, we ignore all the paths before the current directory.
|
||||||
IncludeSearchPathElement searchAfter= includeNext ? fCurrentContext.getFoundOnPath() : null;
|
IncludeSearchPathElement searchAfter= null;
|
||||||
|
if (includeNext) {
|
||||||
|
searchAfter = fCurrentContext.getFoundOnPath();
|
||||||
|
if (searchAfter == null) {
|
||||||
|
searchAfter = findFileInIncludePath(currentFile, includeDirective);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (IncludeSearchPathElement path : fIncludeSearchPath) {
|
for (IncludeSearchPathElement path : fIncludeSearchPath) {
|
||||||
if (searchAfter != null) {
|
if (searchAfter != null) {
|
||||||
if (searchAfter.equals(path)) {
|
if (searchAfter.equals(path)) {
|
||||||
|
@ -928,6 +928,16 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IncludeSearchPathElement findFileInIncludePath(String file, String includeDirective) {
|
||||||
|
for (IncludeSearchPathElement path : fIncludeSearchPath) {
|
||||||
|
String fileLocation = path.getLocation(includeDirective);
|
||||||
|
if (file.equals(fileLocation)) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buffer = new StringBuffer("Scanner @ file:"); //$NON-NLS-1$
|
StringBuffer buffer = new StringBuffer("Scanner @ file:"); //$NON-NLS-1$
|
||||||
|
@ -937,22 +947,19 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addMacroDefinition(IIndexMacro macro) {
|
private void addMacroDefinition(IIndexMacro macro) {
|
||||||
try {
|
try {
|
||||||
final char[] expansionImage = macro.getExpansionImage();
|
final char[] expansionImage = macro.getExpansionImage();
|
||||||
if (expansionImage == null) {
|
if (expansionImage == null) {
|
||||||
// this is an undef
|
// this is an undef
|
||||||
fMacroDictionary.remove(macro.getNameCharArray());
|
fMacroDictionary.remove(macro.getNameCharArray());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
PreprocessorMacro result= MacroDefinitionParser.parseMacroDefinition(macro.getNameCharArray(), macro.getParameterList(), expansionImage);
|
PreprocessorMacro result= MacroDefinitionParser.parseMacroDefinition(macro.getNameCharArray(), macro.getParameterList(), expansionImage);
|
||||||
final IASTFileLocation loc= macro.getFileLocation();
|
final IASTFileLocation loc= macro.getFileLocation();
|
||||||
fLocationMap.registerMacroFromIndex(result, loc, -1);
|
fLocationMap.registerMacroFromIndex(result, loc, -1);
|
||||||
fMacroDictionary.put(result.getNameCharArray(), result);
|
fMacroDictionary.put(result.getNameCharArray(), result);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
fLog.traceLog("Invalid macro definition: '" + macro.getName() + "'"); //$NON-NLS-1$//$NON-NLS-2$
|
fLog.traceLog("Invalid macro definition: '" + macro.getName() + "'"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1103,7 +1110,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
char[] headerName= null;
|
char[] headerName= null;
|
||||||
boolean userInclude= true;
|
boolean userInclude= true;
|
||||||
|
|
||||||
switch(header.getType()) {
|
switch (header.getType()) {
|
||||||
case Lexer.tSYSTEM_HEADER_NAME:
|
case Lexer.tSYSTEM_HEADER_NAME:
|
||||||
userInclude= false;
|
userInclude= false;
|
||||||
headerName = extractHeaderName(header.getCharImage(), '<', '>', nameOffsets);
|
headerName = extractHeaderName(header.getCharImage(), '<', '>', nameOffsets);
|
||||||
|
@ -1123,7 +1130,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
condEndOffset= nameOffsets[1]= getTokensWithinPPDirective(false, tl, false);
|
condEndOffset= nameOffsets[1]= getTokensWithinPPDirective(false, tl, false);
|
||||||
Token t= tl.first();
|
Token t= tl.first();
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
switch(t.getType()) {
|
switch (t.getType()) {
|
||||||
case IToken.tSTRING:
|
case IToken.tSTRING:
|
||||||
headerName = extractHeaderName(t.getCharImage(), '"', '"', new int[]{0,0});
|
headerName = extractHeaderName(t.getCharImage(), '"', '"', new int[]{0,0});
|
||||||
break;
|
break;
|
||||||
|
@ -1152,7 +1159,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
condEndOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
condEndOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (headerName == null || headerName.length==0) {
|
if (headerName == null || headerName.length == 0) {
|
||||||
if (active) {
|
if (active) {
|
||||||
handleProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE,
|
handleProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE,
|
||||||
lexer.getInputChars(poundOffset, condEndOffset), poundOffset, condEndOffset);
|
lexer.getInputChars(poundOffset, condEndOffset), poundOffset, condEndOffset);
|
||||||
|
@ -1166,18 +1173,19 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
|
|
||||||
if (!active) {
|
if (!active) {
|
||||||
// test if the include is inactive just because it was included before (bug 167100)
|
// test if the include is inactive just because it was included before (bug 167100)
|
||||||
final IncludeResolution resolved= findInclusion(new String(headerName), userInclude, include_next, getCurrentFilename(), createPathTester);
|
final IncludeResolution resolved= findInclusion(new String(headerName), userInclude, include_next,
|
||||||
|
getCurrentFilename(), createPathTester);
|
||||||
if (resolved != null && fCodeReaderFactory.hasFileBeenIncludedInCurrentTranslationUnit(resolved.fLocation)) {
|
if (resolved != null && fCodeReaderFactory.hasFileBeenIncludedInCurrentTranslationUnit(resolved.fLocation)) {
|
||||||
path= resolved.fLocation;
|
path= resolved.fLocation;
|
||||||
isHeuristic= resolved.fHeuristic;
|
isHeuristic= resolved.fHeuristic;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
final IncludeFileContent fi= findInclusion(new String(headerName), userInclude, include_next,
|
||||||
final IncludeFileContent fi= findInclusion(new String(headerName), userInclude, include_next, getCurrentFilename(), createCodeReaderTester);
|
getCurrentFilename(), createCodeReaderTester);
|
||||||
if (fi != null) {
|
if (fi != null) {
|
||||||
path= fi.getFileLocation();
|
path= fi.getFileLocation();
|
||||||
isHeuristic= fi.isFoundByHeuristics();
|
isHeuristic= fi.isFoundByHeuristics();
|
||||||
switch(fi.getKind()) {
|
switch (fi.getKind()) {
|
||||||
case FOUND_IN_INDEX:
|
case FOUND_IN_INDEX:
|
||||||
processInclusionFromIndex(poundOffset, path, fi);
|
processInclusionFromIndex(poundOffset, path, fi);
|
||||||
break;
|
break;
|
||||||
|
@ -1186,8 +1194,10 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
if (reader != null && !isCircularInclusion(path)) {
|
if (reader != null && !isCircularInclusion(path)) {
|
||||||
reported= true;
|
reported= true;
|
||||||
fAllIncludedFiles.add(path);
|
fAllIncludedFiles.add(path);
|
||||||
ILocationCtx ctx= fLocationMap.pushInclusion(poundOffset, nameOffsets[0], nameOffsets[1], condEndOffset, reader.buffer, path, headerName, userInclude, isHeuristic, fi.isSource());
|
ILocationCtx ctx= fLocationMap.pushInclusion(poundOffset, nameOffsets[0], nameOffsets[1],
|
||||||
ScannerContext fctx= new ScannerContext(ctx, fCurrentContext, new Lexer(reader.buffer, fLexOptions, this, this));
|
condEndOffset, reader.buffer, path, headerName, userInclude, isHeuristic, fi.isSource());
|
||||||
|
ScannerContext fctx= new ScannerContext(ctx, fCurrentContext, new Lexer(reader.buffer,
|
||||||
|
fLexOptions, this, this));
|
||||||
fctx.setFoundOnPath(fi.getFoundOnPath());
|
fctx.setFoundOnPath(fi.getFoundOnPath());
|
||||||
fCurrentContext= fctx;
|
fCurrentContext= fctx;
|
||||||
}
|
}
|
||||||
|
@ -1196,9 +1206,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
case SKIP_FILE:
|
case SKIP_FILE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
final int len = headerName.length + 2;
|
||||||
final int len = headerName.length+2;
|
|
||||||
StringBuilder name= new StringBuilder(len);
|
StringBuilder name= new StringBuilder(len);
|
||||||
name.append(userInclude ? '"' : '<');
|
name.append(userInclude ? '"' : '<');
|
||||||
name.append(headerName);
|
name.append(headerName);
|
||||||
|
@ -1227,7 +1236,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
char[] headerName;
|
char[] headerName;
|
||||||
int start= 0;
|
int start= 0;
|
||||||
int length= image.length;
|
int length= image.length;
|
||||||
if (length > 0 && image[length-1] == endDelim) {
|
if (length > 0 && image[length - 1] == endDelim) {
|
||||||
length--;
|
length--;
|
||||||
offsets[1]--;
|
offsets[1]--;
|
||||||
if (length > 0 && image[0] == startDelim) {
|
if (length > 0 && image[0] == startDelim) {
|
||||||
|
@ -1410,9 +1419,9 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
if (isCondition)
|
if (isCondition)
|
||||||
options |= PROTECT_DEFINED;
|
options |= PROTECT_DEFINED;
|
||||||
|
|
||||||
loop: while(true) {
|
loop: while (true) {
|
||||||
Token t= internalFetchToken(scannerCtx, options, withinExpansion);
|
Token t= internalFetchToken(scannerCtx, options, withinExpansion);
|
||||||
switch(t.getType()) {
|
switch (t.getType()) {
|
||||||
case IToken.tEND_OF_INPUT:
|
case IToken.tEND_OF_INPUT:
|
||||||
case IToken.tCOMPLETION:
|
case IToken.tCOMPLETION:
|
||||||
scannerCtx.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE); // make sure the exception is thrown.
|
scannerCtx.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE); // make sure the exception is thrown.
|
||||||
|
@ -1445,7 +1454,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private CodeState skipBranch(final Lexer lexer, boolean withinExpansion) throws OffsetLimitReachedException {
|
private CodeState skipBranch(final Lexer lexer, boolean withinExpansion) throws OffsetLimitReachedException {
|
||||||
while(true) {
|
while (true) {
|
||||||
final Token pound = lexer.nextDirective();
|
final Token pound = lexer.nextDirective();
|
||||||
int tt = pound.getType();
|
int tt = pound.getType();
|
||||||
if (tt != IToken.tPOUND) {
|
if (tt != IToken.tPOUND) {
|
||||||
|
@ -1520,7 +1529,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
if (macro instanceof FunctionStyleMacro) {
|
if (macro instanceof FunctionStyleMacro) {
|
||||||
Token t= lexer.currentToken();
|
Token t= lexer.currentToken();
|
||||||
if (!stopAtNewline) {
|
if (!stopAtNewline) {
|
||||||
while(t.getType() == Lexer.tNEWLINE) {
|
while (t.getType() == Lexer.tNEWLINE) {
|
||||||
t= lexer.nextToken();
|
t= lexer.nextToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue