Function rcl_lexer_lookahead2_init

Function Documentation

rcl_ret_t rcl_lexer_lookahead2_init(rcl_lexer_lookahead2_t *buffer, const char *text, rcl_allocator_t allocator)

Initialize an rcl_lexer_lookahead2_t instance.

The lookahead2 buffer borrows a reference to the provided text. The text must not be freed before the buffer is finalized. The lookahead2 buffer only needs to be finalized if this function does not return RCL_RET_OK.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • buffer[in] A buffer that is zero initialized.

  • text[in] The string to analyze.

  • allocator[in] An allocator to use if an error occurs.

Returns:

RCL_RET_OK if the buffer is successfully initialized, or

Returns:

RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or

Returns:

RCL_RET_BAD_ALLOC if allocating memory failed, or

Returns:

RCL_RET_ERROR if an unspecified error occurrs.