mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
78f863bc01
commit
76ddab24aa
9 changed files with 167 additions and 172 deletions
|
@ -266,18 +266,16 @@ public class MacroDefinitionParser {
|
|||
break loop;
|
||||
case IToken.tIDENTIFIER:
|
||||
if (paramList != null) {
|
||||
// convert the parameters to special tokens
|
||||
// Convert the parameters to special tokens.
|
||||
final char[] image = candidate.getCharImage();
|
||||
int idx= CharArrayUtils.indexOf(image, paramList);
|
||||
if (idx >= 0) {
|
||||
candidate= new TokenParameterReference(CPreprocessor.tMACRO_PARAMETER, idx, lexer.getSource(), candidate.getOffset(), candidate.getEndOffset(), paramList[idx]);
|
||||
needParam= false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (needParam) {
|
||||
log.handleProblem(IProblem.PREPROCESSOR_MACRO_PASTING_ERROR, name, fExpansionOffset, candidate.getEndOffset());
|
||||
}
|
||||
else if (CharArrayUtils.equals(Keywords.cVA_ARGS, image)) {
|
||||
} else if (CharArrayUtils.equals(Keywords.cVA_ARGS, image)) {
|
||||
log.handleProblem(IProblem.PREPROCESSOR_INVALID_VA_ARGS, null, fExpansionOffset, candidate.getEndOffset());
|
||||
}
|
||||
needParam= false;
|
||||
|
|
|
@ -271,7 +271,7 @@ public class MacroExpander {
|
|||
try {
|
||||
lastConsumed= parseArguments(input, (FunctionStyleMacro) macro, forbidden, argInputs, tracker);
|
||||
} catch (AbortMacroExpansionException e) {
|
||||
// ignore this macro expansion
|
||||
// Ignore this macro expansion.
|
||||
for (TokenSource argInput : argInputs) {
|
||||
executeScopeMarkers(argInput, forbidden);
|
||||
if (tracker != null) {
|
||||
|
@ -514,7 +514,7 @@ public class MacroExpander {
|
|||
continue loop;
|
||||
|
||||
case IToken.tLPAREN:
|
||||
// the first one sets nesting to zero.
|
||||
// The first one sets nesting to zero.
|
||||
if (++nesting == 0) {
|
||||
continue;
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ public class MacroExpander {
|
|||
case IToken.tCOMMA:
|
||||
assert nesting >= 0;
|
||||
if (nesting == 0) {
|
||||
if (idx < argCount-1) { // next argument
|
||||
if (idx < argCount - 1) { // Next argument.
|
||||
isFirstOfArg= true;
|
||||
spaceMarkers.clear();
|
||||
idx++;
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
* mixing with 12*3 instructions on 3 integers than you can with 3 instructions
|
||||
* on 1 byte), but shoehorning those bytes into integers efficiently is messy.
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,7 +56,6 @@ public class Token implements IToken, Cloneable {
|
|||
return fNextToken;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
final public void setType(int kind) {
|
||||
fKind= kind;
|
||||
|
|
|
@ -17,7 +17,8 @@ class TokenList {
|
|||
final Token removeFirst() {
|
||||
final Token first= fFirst;
|
||||
if (first == fLast) {
|
||||
fFirst= fLast= null;
|
||||
fFirst= null;
|
||||
fLast= null;
|
||||
return first;
|
||||
}
|
||||
fFirst= (Token) first.getNext();
|
||||
|
@ -26,9 +27,9 @@ class TokenList {
|
|||
|
||||
public final void append(Token t) {
|
||||
if (fFirst == null) {
|
||||
fFirst= fLast= t;
|
||||
}
|
||||
else {
|
||||
fFirst= t;
|
||||
fLast= t;
|
||||
} else {
|
||||
fLast.setNext(t);
|
||||
fLast= t;
|
||||
}
|
||||
|
@ -40,13 +41,13 @@ class TokenList {
|
|||
if (t != null) {
|
||||
if (fFirst == null) {
|
||||
fFirst= tl.fFirst;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fLast.setNext(tl.fFirst);
|
||||
}
|
||||
fLast= tl.fLast;
|
||||
}
|
||||
tl.fFirst= tl.fLast= null;
|
||||
tl.fFirst= null;
|
||||
tl.fLast= null;
|
||||
}
|
||||
|
||||
public final void appendAllButLast(TokenList tl) {
|
||||
|
@ -110,8 +111,7 @@ class TokenList {
|
|||
fLast= null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
final Token r= (Token) l.getNext();
|
||||
if (r != null) {
|
||||
l.setNext(r.getNext());
|
||||
|
@ -124,16 +124,17 @@ class TokenList {
|
|||
|
||||
void cutAfter(Token l) {
|
||||
if (l == null) {
|
||||
fFirst= fLast= null;
|
||||
}
|
||||
else {
|
||||
fFirst= null;
|
||||
fLast= null;
|
||||
} else {
|
||||
l.setNext(null);
|
||||
fLast= l;
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
fFirst= fLast= null;
|
||||
fFirst= null;
|
||||
fLast= null;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
|
|
|
@ -147,7 +147,6 @@ public class TokenUtil {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the last token in the given token list.
|
||||
* @throws NullPointerException if the argument is null
|
||||
|
@ -159,5 +158,4 @@ public class TokenUtil {
|
|||
} while ((tokenList = tokenList.getNext()) != null);
|
||||
return last;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue