- All Superinterfaces:
Macro
A FunctionMacro represents a C preprocessor function-like macro, which has
the from #define f(X1,X2,...) .... The name of the macro is
f, the X1,X2, etc., are the formal
parameters, and the ... is a sequence of replacement tokens. The
replacement tokens may include the formal parameters.
The last formal parameter in the formal parameter list may actually be an ELLIPSIS ("..."). In this case the number of formal parameters includes the ELLIPSIS as one of the formal parameters.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface dev.civl.abc.token.IF.Macro
Macro.ReplacementUnit -
Method Summary
Modifier and TypeMethodDescriptionorg.antlr.runtime.TokengetFormal(int index) Gets the index-th formal parameter.intReturns the number of formal parameters, including the ELLIPSIS parameter if present.getReplacementUnit(int index) booleanIs this a variadic macro?Methods inherited from interface dev.civl.abc.token.IF.Macro
getBodyNode, getDefinitionNode, getFile, getName, getNumReplacements
-
Method Details
-
getNumFormals
int getNumFormals()Returns the number of formal parameters, including the ELLIPSIS parameter if present.- Returns:
- the number of formal parameters
-
isVariadic
boolean isVariadic()Is this a variadic macro?- Returns:
trueif there is at least one formal, and the last formal is an ellipsis ("...")
-
getFormal
org.antlr.runtime.Token getFormal(int index) Gets the index-th formal parameter. This may be ELLIPSIS ("...").- Parameters:
index- an integer in the range [0,numFormals-1]- Returns:
- the index-th formal parameter token
-
getReplacementUnit
Description copied from interface:Macro- Specified by:
getReplacementUnitin interfaceMacro- Parameters:
index- integer in range [0,numReplacements-1]- Returns:
- the
index-th replacement in the macro definition body
-