rcl
master
C API providing common ROS client library functionality.
|
#include <stddef.h>
#include "rcl/allocator.h"
#include "rcl/macros.h"
#include "rcl/types.h"
#include "rcl/visibility_control.h"
Go to the source code of this file.
Typedefs | |
typedef enum rcl_lexeme_t | rcl_lexeme_t |
Type of lexeme found by lexical analysis. More... | |
Enumerations | |
enum | rcl_lexeme_t { RCL_LEXEME_NONE = 0, RCL_LEXEME_EOF = 1, RCL_LEXEME_TILDE_SLASH = 2, RCL_LEXEME_URL_SERVICE = 3, RCL_LEXEME_URL_TOPIC = 4, RCL_LEXEME_COLON = 5, RCL_LEXEME_NODE = 6, RCL_LEXEME_NS = 7, RCL_LEXEME_SEPARATOR = 8, RCL_LEXEME_BR1 = 9, RCL_LEXEME_BR2 = 10, RCL_LEXEME_BR3 = 11, RCL_LEXEME_BR4 = 12, RCL_LEXEME_BR5 = 13, RCL_LEXEME_BR6 = 14, RCL_LEXEME_BR7 = 15, RCL_LEXEME_BR8 = 16, RCL_LEXEME_BR9 = 17, RCL_LEXEME_TOKEN = 18, RCL_LEXEME_FORWARD_SLASH = 19, RCL_LEXEME_WILD_ONE = 20, RCL_LEXEME_WILD_MULTI = 21 } |
Type of lexeme found by lexical analysis. More... | |
Functions | |
rcl_ret_t | rcl_lexer_analyze (const char *text, rcl_allocator_t allocator, rcl_lexeme_t *lexeme, size_t *length) |
Do lexical analysis on a string. More... | |
typedef enum rcl_lexeme_t rcl_lexeme_t |
Type of lexeme found by lexical analysis.
enum rcl_lexeme_t |
Type of lexeme found by lexical analysis.
rcl_ret_t rcl_lexer_analyze | ( | const char * | text, |
rcl_allocator_t | allocator, | ||
rcl_lexeme_t * | lexeme, | ||
size_t * | length | ||
) |
Do lexical analysis on a string.
This function analyzes a string to see if it starts with a valid lexeme. If the string does not begin with a valid lexeme then lexeme will be RCL_LEXEME_NONE, and the length will be set to include the character that made it impossible. If the first character is '\0' then lexeme will be RCL_LEXEME_EOF.
Attribute | Adherence — |
---|---|
Allocates Memory | Yes [1] |
Thread-Safe | Yes |
Uses Atomics | No |
Lock-Free | Yes |
[1] Only allocates if an argument is invalid or an internal bug is detected.
[in] | text | The string to analyze. |
[in] | allocator | An allocator to use if an error occurs. |
[out] | lexeme | The type of lexeme found in the string. |
[out] | length | The length of text in the string that constitutes the found lexeme. |
RCL_RET_OK
if analysis is successful regardless whether a valid lexeme is found, or RCL_RET_INVALID_ARGUMENT
if any function arguments are invalid, or RCL_RET_BAD_ALLOC
if allocating memory failed, or RCL_RET_ERROR
if an internal bug is detected.