Herb C Reference
Loading...
Searching...
No Matches
token_matchers.h File Reference
#include "parser.h"
#include "token.h"
#include <stdarg.h>
#include <stdbool.h>

Go to the source code of this file.

Macros

#define TOKEN_SENTINEL   99999999
 
#define token_is_any_of(parser, ...)   (token_matches_any((parser)->current_token->type, __VA_ARGS__, TOKEN_SENTINEL))
 
#define token_is_none_of(parser, ...)   (!token_matches_any((parser)->current_token->type, __VA_ARGS__, TOKEN_SENTINEL))
 

Functions

bool token_is (parser_T *parser, token_type_T expected_type)
 
bool token_is_not (parser_T *parser, token_type_T type)
 
bool token_matches_any (token_type_T current_token, token_type_T first_token,...)
 

Macro Definition Documentation

◆ TOKEN_SENTINEL

#define TOKEN_SENTINEL   99999999

◆ token_is_any_of

#define token_is_any_of (   parser,
  ... 
)    (token_matches_any((parser)->current_token->type, __VA_ARGS__, TOKEN_SENTINEL))

◆ token_is_none_of

#define token_is_none_of (   parser,
  ... 
)    (!token_matches_any((parser)->current_token->type, __VA_ARGS__, TOKEN_SENTINEL))

Function Documentation

◆ token_is()

bool token_is ( parser_T parser,
token_type_T  expected_type 
)

◆ token_is_not()

bool token_is_not ( parser_T parser,
token_type_T  type 
)

◆ token_matches_any()

bool token_matches_any ( token_type_T  current_token,
token_type_T  first_token,
  ... 
)