From d83d37ecd5682252f85af099c3353525f1cb1394 Mon Sep 17 00:00:00 2001 From: c+1 Date: Mon, 22 May 2023 15:58:13 -0400 Subject: yay :) --- src/include/token.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/include') diff --git a/src/include/token.h b/src/include/token.h index f7a166f..e52c3a0 100644 --- a/src/include/token.h +++ b/src/include/token.h @@ -1,19 +1,27 @@ #ifndef TOKEN_H #define TOKEN_H +#define TOKEN_DEFNAME_FIRST_CHAR_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_" +#define TOKEN_DEFNAME_FIRST_CHAR_ALLOWED_CHARS_LEN 53 +#define TOKEN_DEFNAME_SPLIT_CHAR_ALLOWED_CHARS "1234567890_-" +#define TOKEN_DEFNAME_SPLIT_CHAR_ALLOWED_CHARS_LEN 12 +#define TOKEN_CHAR_IGNORE " \t\n\r" +#define TOKEN_CHAR_IGNORE_LEN 4 +#define TOKEN_CHAR_FIRST_CHAR_INT "0123456789" typedef struct TOKEN_STRUC { enum { TOKEN_KEYWORD, // keyword - TOKEN_STR_DELIM, // ' - TOKEN_STR, // 'string' + TOKEN_PRIM_STR_DELIM, // ' + TOKEN_PRIM_STR, // 'string' + TOKEN_PRIM_INT, // 'string' TOKEN_COMM_DELIM, // ` TOKEN_COMM, // `comment` TOKEN_EXPR_END, // ; TOKEN_LGROUP, // ( TOKEN_RGROUP, // ) TOKEN_DIRECTIVE_DELIM, // # - TOKEN_DIRECTIVE, // #DIRECTIVE; + TOKEN_DIRECTIVE, // #DIRECTIVE# TOKEN_FN_APPLY, // . TOKEN_LIST_DELIM, // , TOKEN_DEF_TAGS_DELIM, // : @@ -23,6 +31,7 @@ typedef struct TOKEN_STRUC { TOKEN_NAMESPACE_DELIM, // / TOKEN_ARRAY_DELIM_START, // [ TOKEN_ARRAY_DELIM_END, // ] + TOKEN_DEF_SET, // = TOKEN_EOF, // \0 } type; @@ -31,17 +40,9 @@ typedef struct TOKEN_STRUC { token_t* token_init(int type, char* val); -char TOKEN_DEFNAME_FIRST_CHAR_ALLOWED_CHARS[] = "abcdefghijklmnopqrstuvwxyz_"; // chars that can begin a var name -int TOKEN_DEFNAME_FIRST_CHAR_ALLOWED_CHARS_LEN = 27; // maximum efficiency! -char TOKEN_DEFNAME_SPLIT_CHAR_ALLOWED_CHARS[] = "1234567890_-"; // chars that can be in the rest of the var name, - // not including the ones already defined to begin - // one. -int TOKEN_DEFNAME_SPLIT_CHAR_ALLOWED_CHARS_LEN = 12; -char TOKEN_CHAR_IGNORE[] = " \t\n\r"; // characters to ignore while parsing tokens -int TOKEN_CHAR_IGNORE_LEN = 4; - int char_could_start_keyword(char* character); int char_could_split_keyword(char* character); +int char_could_start_int(char* character); int char_can_ignore(char* character); -- cgit v1.2.3