@@ -215,6 +215,40 @@ void AddDefine(metac_parser_t* self, metac_token_t* token, uint32_t nParameters)
215215 }
216216}
217217*/
218+ /**
219+ * @param self A pointer to the `metac_parser_t` instance, which holds the current state
220+ * of the parser.
221+ * @param IdentifierKeys An array of uint32_t identifier keys to match against.
222+ * The array must be terminated with a zero (`0`) to indicate its end.
223+ * For example: {0x12345678, 0x87654321, 0xabcdef00, 0}.
224+ *
225+ * @return A pointer to the current `metac_token_t` if a match is found. The parser
226+ * advances to the next token in this case. Returns `NULL` if no match is found
227+ * or if the current token is not an identifier.
228+ *
229+ * @note This function only matches tokens of type `tok_identifier`. If the current token
230+ * is not of this type, the function will return `NULL`.
231+ **/
232+ metac_token_t * MetaCParser_MatchOneOfIdentifierIds (metac_parser_t * self , uint32_t IdentifierKeys []) {
233+ metac_token_t * currentToken = MetaCParser_PeekToken (self , 1 );
234+
235+ if (currentToken && currentToken -> TokenType == tok_identifier ) {
236+ // Retrieve the current token's identifier key
237+ uint32_t currentIdentifierKey = currentToken -> IdentifierKey ;
238+
239+ // Iterate over the provided keys and check for a match
240+ for (uint32_t i = 0 ; IdentifierKeys [i ] != 0 ; i ++ ) {
241+ if (currentIdentifierKey == IdentifierKeys [i ]) {
242+ // If a match is found, advance the parser to the next token and return the current token
243+ MetaCParser_Advance (self );
244+ return currentToken ;
245+ }
246+ }
247+ }
248+ // If no match is found, return NULL
249+ return NULL ;
250+ }
251+
218252/// checks if the next token is expectedType
219253/// returns true if it is
220254/// the token remains in the queue
0 commit comments