|
Porytiles
|
Represents a parsed C function definition. More...
#include <function_definition.hpp>
Public Member Functions | |
| FunctionDefinition (std::string name, std::vector< Token > body_tokens, SourcePosition position) | |
| Constructs a FunctionDefinition. | |
| const std::string & | name () const |
| Returns the function name. | |
| const std::vector< Token > & | body_tokens () const |
| Returns the function body tokens. | |
| const SourcePosition & | position () const |
| Returns the source position of the function name. | |
Represents a parsed C function definition.
FunctionDefinition captures the name and body tokens of a C function definition like:
Rather than parsing the function body into an AST, we capture the raw tokens between the braces. This allows for targeted pattern matching within the body (e.g., finding TILE_OFFSET_4BPP calls) without implementing a full C parser.
Definition at line 30 of file function_definition.hpp.
|
inline |
Constructs a FunctionDefinition.
| name | The function name |
| body_tokens | All tokens between the opening and closing braces (exclusive of braces) |
| position | The source position of the function name |
Definition at line 39 of file function_definition.hpp.
|
inline |
Returns the function body tokens.
Returns all tokens that appeared between the opening and closing braces of the function body. The braces themselves are not included. This allows callers to perform targeted pattern matching for specific constructs like macro invocations.
Definition at line 64 of file function_definition.hpp.
|
inline |
Returns the function name.
Definition at line 49 of file function_definition.hpp.
|
inline |
Returns the source position of the function name.
Definition at line 74 of file function_definition.hpp.