Function rcl_lexer_lookahead2_expect
Defined in File lexer_lookahead.h
Function Documentation
-
rcl_ret_t rcl_lexer_lookahead2_expect(rcl_lexer_lookahead2_t *buffer, rcl_lexeme_t type, const char **lexeme_text, size_t *lexeme_text_length)
Require the next lexeme to be a certain type and advance analysis.
This method is a shortcut to peeking and accepting a lexeme. It should be used by a parser when there is only one valid lexeme that could come next.
Attribute
Adherence
Allocates Memory
Yes [1]
Thread-Safe
No
Uses Atomics
No
Lock-Free
Yes
See also
See also
- Parameters:
buffer – [in] the lookahead2 buffer being used to analyze a string.
type – [in] the type the next lexeme must be.
lexeme_text – [out] pointer to where lexeme begins in string.
lexeme_text_length – [out] length of lexeme_text.
- Returns:
RCL_RET_OK if the next lexeme was the expected one, or
- Returns:
RCL_RET_WRONG_LEXEME if the next lexeme was not the expected one, or
- Returns:
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
- Returns:
RCL_RET_ERROR if an unspecified error occurs.