Add src/theme/xbm/parse.c

This commit is contained in:
Johan Malm 2020-06-23 07:17:07 +01:00
parent d80a7b518f
commit f86394a997
7 changed files with 125 additions and 13 deletions

View file

@ -31,8 +31,9 @@ static void get_identifier_token()
switch (current_buffer_position[0]) {
case '\0':
return;
case 'a'...'z':
case 'A'...'Z':
case 'a' ... 'z':
case 'A' ... 'Z':
case '0' ... '9':
case '_':
case '#':
get_identifier_token();
@ -53,9 +54,9 @@ static void get_number_token()
switch (current_buffer_position[0]) {
case '\0':
return;
case '0'...'9':
case 'a'...'f':
case 'A'...'F':
case '0' ... '9':
case 'a' ... 'f':
case 'A' ... 'F':
case 'x':
get_number_token();
break;
@ -71,7 +72,7 @@ static void get_special_char_token()
current_buffer_position++;
}
struct token *tokenize(char *buffer)
struct token *xbm_tokenize(char *buffer)
{
current_buffer_position = buffer;
@ -79,14 +80,14 @@ struct token *tokenize(char *buffer)
switch (current_buffer_position[0]) {
case '\0':
goto out;
case 'a'...'z':
case 'A'...'Z':
case 'a' ... 'z':
case 'A' ... 'Z':
case '_':
case '#':
add_token(TOKEN_IDENT);
get_identifier_token();
continue;
case '0'...'9':
case '0' ... '9':
add_token(TOKEN_INT);
get_number_token();
continue;