@@ -215,39 +215,6 @@ 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- }
251218
252219/// checks if the next token is expectedType
253220/// returns true if it is
@@ -604,6 +571,39 @@ metac_token_t* MetaCParser_NextToken(metac_parser_t* self)
604571#undef PeekMatch
605572#undef NextToken
606573
574+ /**
575+ * @param self A pointer to the `metac_parser_t` instance, which holds the current state
576+ * of the parser.
577+ * @param IdentifierKeys An array of uint32_t identifier keys to match against.
578+ * The array must be terminated with a zero (`0`) to indicate its end.
579+ * For example: {0x12345678, 0x87654321, 0xabcdef00, 0}.
580+ *
581+ * @return A pointer to the current `metac_token_t` if a match is found. The parser
582+ * advances to the next token in this case. Returns `NULL` if no match is found
583+ * or if the current token is not an identifier.
584+ *
585+ * @note This function only matches tokens of type `tok_identifier`. If the current token
586+ * is not of this type, the function will return `NULL`.
587+ **/
588+ metac_token_t * MetaCParser_MatchOneOfIdentifierKeys (metac_parser_t * self , uint32_t IdentifierKeys []) {
589+ metac_token_t * currentToken = MetaCParser_PeekToken (self , 1 );
590+
591+ if (currentToken && currentToken -> TokenType == tok_identifier ) {
592+ uint32_t currentIdentifierKey = currentToken -> IdentifierKey ;
593+
594+ // Iterate over the provided keys and check for a match
595+ for (uint32_t i = 0 ; IdentifierKeys [i ] != 0 ; i ++ ) {
596+ if (currentIdentifierKey == IdentifierKeys [i ]) {
597+ // If a match is found, advance the parser to the next token and return the current token
598+ MetaCParser_Advance (self );
599+ return currentToken ;
600+ }
601+ }
602+ }
603+ // If no match is found, return NULL
604+ return NULL ;
605+ }
606+
607607uint32_t MetaCParser_HowMuchLookahead (metac_parser_t * self )
608608{
609609 return (self -> Lexer -> TokenCount - self -> CurrentTokenIndex );
0 commit comments