Function rcl_lexer_analyze
Defined in File lexer.h
Function Documentation
-
rcl_ret_t rcl_lexer_analyze(const char *text, 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. It will never be longer than the length of the string. If the first character is ‘\0’ then lexeme will be RCL_LEXEME_EOF.
Attribute
Adherence
Allocates Memory
No
Thread-Safe
Yes
Uses Atomics
No
Lock-Free
Yes
- Parameters:
text – [in] The string to analyze.
lexeme – [out] The type of lexeme found in the string.
length – [out] The length of text in the string that constitutes the found lexeme.
- Returns:
RCL_RET_OK if analysis is successful regardless whether a valid lexeme is found, or
- Returns:
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
- Returns:
RCL_RET_ERROR if an internal bug is detected.