We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What should the api be ?
#define X(T) XX(HF_##T) enum { #define XX(T) T X(UNKNOWN) = -1, X(NULL) = 0, X(LABEL), X(COMMAND), X(ARGUMENT) #undef XX }; char hf_type_str[] = { #define XX(T) # T X(NULL), X(LABEL), X(COMMAND), X(ARGUMENT) #undef XX }; #undef X typedef struct hf_token hf_token_t; struct hf_token { int type; const char *data; }; typedef struct hf_lexer hf_lexer_t; struct hf_lexer { const char *src; int lineno; int offset; hf_token_t current; }; int hf_lexer_scan (hf_lexer_t *self);
usage:
int main (void) { hf_lexer_t lexer = { .src = "/path/to/hackfile", .lineno = 1, .offset = 1 }; while (hf_lexer_scan(&lexer)) { printf("type=%s data=%s\n", hf_type_str[lexer.current.type], lexer.current.data); } return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What should the api be ?
usage:
The text was updated successfully, but these errors were encountered: