aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/event_tap.c4
-rw-r--r--src/hashtable.h16
-rw-r--r--src/hotkey.c22
-rw-r--r--src/hotload.c22
-rw-r--r--src/locale.c12
-rw-r--r--src/parse.c52
-rw-r--r--src/skhd.c22
-rw-r--r--src/tokenize.c44
8 files changed, 97 insertions, 97 deletions
diff --git a/src/event_tap.c b/src/event_tap.c
index 5f44ff4..daaa027 100644
--- a/src/event_tap.c
+++ b/src/event_tap.c
@@ -16,7 +16,7 @@ bool event_tap_begin(struct event_tap *event_tap, event_tap_callback *callback)
event_tap);
bool result = event_tap_enabled(event_tap);
- if(result) {
+ if (result) {
event_tap->runloop_source = CFMachPortCreateRunLoopSource(kCFAllocatorDefault,
event_tap->handle,
0);
@@ -28,7 +28,7 @@ bool event_tap_begin(struct event_tap *event_tap, event_tap_callback *callback)
void event_tap_end(struct event_tap *event_tap)
{
- if(event_tap_enabled(event_tap)) {
+ if (event_tap_enabled(event_tap)) {
CGEventTapEnable(event_tap->handle, false);
CFMachPortInvalidate(event_tap->handle);
CFRunLoopRemoveSource(CFRunLoopGetMain(), event_tap->runloop_source, kCFRunLoopCommonModes);
diff --git a/src/hashtable.h b/src/hashtable.h
index 3977b96..48ffaad 100644
--- a/src/hashtable.h
+++ b/src/hashtable.h
@@ -47,8 +47,8 @@ static struct bucket **
table_get_bucket(struct table *table, void *key)
{
struct bucket **bucket = table->buckets + (table->hash(key) % table->capacity);
- while(*bucket) {
- if(table->compare((*bucket)->key, key)) {
+ while (*bucket) {
+ if (table->compare((*bucket)->key, key)) {
break;
}
bucket = &(*bucket)->next;
@@ -68,9 +68,9 @@ void table_init(struct table *table, int capacity, table_hash_func hash, table_c
void table_free(struct table *table)
{
- for(int i = 0; i < table->capacity; ++i) {
+ for (int i = 0; i < table->capacity; ++i) {
struct bucket *next, *bucket = table->buckets[i];
- while(bucket) {
+ while (bucket) {
next = bucket->next;
free(bucket);
bucket = next;
@@ -88,7 +88,7 @@ void *table_find(struct table *table, void *key)
void table_add(struct table *table, void *key, void *value)
{
struct bucket **bucket = table_get_bucket(table, key);
- if(*bucket) {
+ if (*bucket) {
(*bucket)->value = value;
} else {
*bucket = table_new_bucket(key, value);
@@ -100,7 +100,7 @@ void *table_remove(struct table *table, void *key)
{
void *result = NULL;
struct bucket *next, **bucket = table_get_bucket(table, key);
- if(*bucket) {
+ if (*bucket) {
result = (*bucket)->value;
next = (*bucket)->next;
free(*bucket);
@@ -122,9 +122,9 @@ void *table_reset(struct table *table, int *count)
values = malloc(sizeof(void *) * table->count);
item = 0;
- for(index = 0; index < capacity; ++index) {
+ for (index = 0; index < capacity; ++index) {
struct bucket *next, **bucket = table->buckets + index;
- while(*bucket) {
+ while (*bucket) {
values[item++] = (*bucket)->value;
next = (*bucket)->next;
free(*bucket);
diff --git a/src/hotkey.c b/src/hotkey.c
index 74c70f5..d9ebde6 100644
--- a/src/hotkey.c
+++ b/src/hotkey.c
@@ -66,13 +66,13 @@ fork_and_exec(char *command)
{
local_persist char arg[] = "-c";
local_persist char *shell = NULL;
- if(!shell) {
+ if (!shell) {
char *env_shell = getenv("SHELL");
shell = env_shell ? env_shell : "/bin/bash";
}
int cpid = fork();
- if(cpid == 0) {
+ if (cpid == 0) {
char *exec[] = { shell, arg, command, NULL};
int status_code = execvp(exec[0], exec);
exit(status_code);
@@ -85,8 +85,8 @@ bool find_and_exec_hotkey(struct hotkey *eventkey, struct table *hotkey_map)
{
bool result = false;
struct hotkey *hotkey;
- if((hotkey = table_find(hotkey_map, eventkey))) {
- if(fork_and_exec(hotkey->command)) {
+ if ((hotkey = table_find(hotkey_map, eventkey))) {
+ if (fork_and_exec(hotkey->command)) {
result = has_flags(hotkey, Hotkey_Flag_Passthrough) ? false : true;
}
}
@@ -97,13 +97,13 @@ void free_hotkeys(struct table *hotkey_map)
{
int count;
void **hotkeys = table_reset(hotkey_map, &count);
- for(int index = 0; index < count; ++index) {
+ for (int index = 0; index < count; ++index) {
struct hotkey *hotkey = (struct hotkey *) hotkeys[index];
free(hotkey->command);
free(hotkey);
}
- if(count) {
+ if (count) {
free(hotkeys);
}
}
@@ -115,13 +115,13 @@ cgevent_lrmod_flag_to_hotkey_lrmod_flag(CGEventFlags flags, struct hotkey *event
enum osx_event_mask lmask = cgevent_lrmod_flag[mod + LMOD_OFFS];
enum osx_event_mask rmask = cgevent_lrmod_flag[mod + RMOD_OFFS];
- if((flags & mask) == mask) {
+ if ((flags & mask) == mask) {
bool left = (flags & lmask) == lmask;
bool right = (flags & rmask) == rmask;
- if(left) add_flags(eventkey, hotkey_lrmod_flag[mod + LMOD_OFFS]);
- if(right) add_flags(eventkey, hotkey_lrmod_flag[mod + RMOD_OFFS]);
- if(!left && !right) add_flags(eventkey, hotkey_lrmod_flag[mod]);
+ if (left) add_flags(eventkey, hotkey_lrmod_flag[mod + LMOD_OFFS]);
+ if (right) add_flags(eventkey, hotkey_lrmod_flag[mod + RMOD_OFFS]);
+ if (!left && !right) add_flags(eventkey, hotkey_lrmod_flag[mod]);
}
}
@@ -132,7 +132,7 @@ void cgeventflags_to_hotkeyflags(CGEventFlags flags, struct hotkey *eventkey)
cgevent_lrmod_flag_to_hotkey_lrmod_flag(flags, eventkey, LRMOD_CTRL);
cgevent_lrmod_flag_to_hotkey_lrmod_flag(flags, eventkey, LRMOD_SHIFT);
- if((flags & Event_Mask_Fn) == Event_Mask_Fn) {
+ if ((flags & Event_Mask_Fn) == Event_Mask_Fn) {
add_flags(eventkey, Hotkey_Flag_Fn);
}
}
diff --git a/src/hotload.c b/src/hotload.c
index 81fc589..8677cc2 100644
--- a/src/hotload.c
+++ b/src/hotload.c
@@ -44,14 +44,14 @@ internal struct watched_file *
hotloader_watched_file(struct hotloader *hotloader, char *absolutepath)
{
struct watched_file *result = NULL;
- for(unsigned index = 0; result == NULL && index < hotloader->watch_count; ++index) {
+ for (unsigned index = 0; result == NULL && index < hotloader->watch_count; ++index) {
struct watched_file *watch_info = hotloader->watch_list + index;
char *directory = file_directory(absolutepath);
char *filename = file_name(absolutepath);
- if(strcmp(watch_info->directory, directory) == 0) {
- if(strcmp(watch_info->filename, filename) == 0) {
+ if (strcmp(watch_info->directory, directory) == 0) {
+ if (strcmp(watch_info->filename, filename) == 0) {
result = watch_info;
}
}
@@ -70,9 +70,9 @@ internal FSEVENT_CALLBACK(hotloader_handler)
char **files = (char **) paths;
struct watched_file *watch_info;
- for(unsigned index = 0; index < count; ++index) {
+ for (unsigned index = 0; index < count; ++index) {
char *absolutepath = files[index];
- if((watch_info = hotloader_watched_file(hotloader, absolutepath))) {
+ if ((watch_info = hotloader_watched_file(hotloader, absolutepath))) {
hotloader->callback(absolutepath, watch_info->directory, watch_info->filename);
}
}
@@ -80,7 +80,7 @@ internal FSEVENT_CALLBACK(hotloader_handler)
void hotloader_add_file(struct hotloader *hotloader, const char *file)
{
- if(!hotloader->enabled) {
+ if (!hotloader->enabled) {
struct watched_file watch_info;
watch_info.directory = file_directory(file);
watch_info.filename = file_name(file);
@@ -91,13 +91,13 @@ void hotloader_add_file(struct hotloader *hotloader, const char *file)
bool hotloader_begin(struct hotloader *hotloader, hotloader_callback *callback)
{
- if((hotloader->enabled) ||
- (!hotloader->watch_count)) {
+ if ((hotloader->enabled) ||
+ (!hotloader->watch_count)) {
return false;
}
CFStringRef string_refs[hotloader->watch_count];
- for(unsigned index = 0; index < hotloader->watch_count; ++index) {
+ for (unsigned index = 0; index < hotloader->watch_count; ++index) {
string_refs[index] = CFStringCreateWithCString(kCFAllocatorDefault,
hotloader->watch_list[index].directory,
kCFStringEncodingUTF8);
@@ -124,13 +124,13 @@ bool hotloader_begin(struct hotloader *hotloader, hotloader_callback *callback)
void hotloader_end(struct hotloader *hotloader)
{
- if(hotloader->enabled) {
+ if (hotloader->enabled) {
FSEventStreamStop(hotloader->stream);
FSEventStreamInvalidate(hotloader->stream);
FSEventStreamRelease(hotloader->stream);
CFIndex count = CFArrayGetCount(hotloader->path);
- for(unsigned index = 0; index < count; ++index) {
+ for (unsigned index = 0; index < count; ++index) {
CFStringRef string_ref = (CFStringRef) CFArrayGetValueAtIndex(hotloader->path, index);
free(hotloader->watch_list[index].directory);
free(hotloader->watch_list[index].filename);
diff --git a/src/locale.c b/src/locale.c
index 941a1eb..974c3ae 100644
--- a/src/locale.c
+++ b/src/locale.c
@@ -13,7 +13,7 @@ cfstring_from_keycode(CGKeyCode keycode)
CFRelease(keyboard);
UCKeyboardLayout *keyboard_layout = (UCKeyboardLayout *) CFDataGetBytePtr(uchr);
- if(keyboard_layout) {
+ if (keyboard_layout) {
UInt32 dead_key_state = 0;
UniCharCount max_string_length = 255;
UniCharCount string_length = 0;
@@ -27,7 +27,7 @@ cfstring_from_keycode(CGKeyCode keycode)
&string_length,
unicode_string);
- if(string_length == 0 && dead_key_state) {
+ if (string_length == 0 && dead_key_state) {
status = UCKeyTranslate(keyboard_layout, kVK_Space,
kUCKeyActionDown, 0,
LMGetKbdType(), 0,
@@ -37,7 +37,7 @@ cfstring_from_keycode(CGKeyCode keycode)
unicode_string);
}
- if(string_length > 0 && status == noErr) {
+ if (string_length > 0 && status == noErr) {
return CFStringCreateWithCharacters(NULL, unicode_string, string_length);
}
}
@@ -51,11 +51,11 @@ uint32_t keycode_from_char(char key)
{
uint32_t keycode = 0;
local_persist CFMutableDictionaryRef keycode_map = NULL;
- if(!keycode_map) {
+ if (!keycode_map) {
keycode_map = CFDictionaryCreateMutable(kCFAllocatorDefault, 128, &kCFCopyStringDictionaryKeyCallBacks, NULL);
- for(unsigned index = 0; index < 128; ++index) {
+ for (unsigned index = 0; index < 128; ++index) {
CFStringRef key_string = cfstring_from_keycode(index);
- if(key_string) {
+ if (key_string) {
CFDictionaryAddValue(keycode_map, key_string, (const void *)index);
CFRelease(key_string);
}
diff --git a/src/parse.c b/src/parse.c
index ab9add5..cc5250c 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -18,7 +18,7 @@ read_file(const char *file)
char *buffer = NULL;
FILE *handle = fopen(file, "r");
- if(handle) {
+ if (handle) {
fseek(handle, 0, SEEK_END);
length = ftell(handle);
fseek(handle, 0, SEEK_SET);
@@ -104,8 +104,8 @@ parse_key_literal(struct parser *parser)
uint32_t keycode;
struct token key = parser_previous(parser);
- for(int i = 0; i < array_count(literal_keycode_str); ++i) {
- if(token_equals(key, literal_keycode_str[i])) {
+ for (int i = 0; i < array_count(literal_keycode_str); ++i) {
+ if (token_equals(key, literal_keycode_str[i])) {
keycode = literal_keycode_value[i];
printf("\tkey: '%.*s' (0x%02x)\n", key.length, key.text, keycode);
break;
@@ -131,16 +131,16 @@ parse_modifier(struct parser *parser)
uint32_t flags = 0;
struct token modifier = parser_previous(parser);
- for(int i = 0; i < array_count(modifier_flags_str); ++i) {
- if(token_equals(modifier, modifier_flags_str[i])) {
+ for (int i = 0; i < array_count(modifier_flags_str); ++i) {
+ if (token_equals(modifier, modifier_flags_str[i])) {
flags |= modifier_flags_value[i];
printf("\tmod: '%s'\n", modifier_flags_str[i]);
break;
}
}
- if(parser_match(parser, Token_Plus)) {
- if(parser_match(parser, Token_Modifier)) {
+ if (parser_match(parser, Token_Plus)) {
+ if (parser_match(parser, Token_Modifier)) {
flags |= parse_modifier(parser);
} else {
fprintf(stderr, "(#%d:%d) expected modifier, but got '%.*s'\n",
@@ -161,9 +161,9 @@ parse_hotkey(struct parser *parser)
printf("(#%d) hotkey :: {\n", parser->current_token.line);
- if(parser_match(parser, Token_Modifier)) {
+ if (parser_match(parser, Token_Modifier)) {
hotkey->flags = parse_modifier(parser);
- if(parser->error) {
+ if (parser->error) {
return NULL;
}
found_modifier = 1;
@@ -171,8 +171,8 @@ parse_hotkey(struct parser *parser)
hotkey->flags = found_modifier = 0;
}
- if(found_modifier) {
- if(!parser_match(parser, Token_Dash)) {
+ if (found_modifier) {
+ if (!parser_match(parser, Token_Dash)) {
fprintf(stderr, "(#%d:%d) expected '-', but got '%.*s'\n",
parser->current_token.line, parser->current_token.cursor,
parser->current_token.length, parser->current_token.text);
@@ -181,11 +181,11 @@ parse_hotkey(struct parser *parser)
}
}
- if(parser_match(parser, Token_Key)) {
+ if (parser_match(parser, Token_Key)) {
hotkey->key = parse_key(parser);
- } else if(parser_match(parser, Token_Key_Hex)) {
+ } else if (parser_match(parser, Token_Key_Hex)) {
hotkey->key = parse_key_hex(parser);
- } else if(parser_match(parser, Token_Literal)) {
+ } else if (parser_match(parser, Token_Literal)) {
hotkey->key = parse_key_literal(parser);
} else {
fprintf(stderr, "(#%d:%d) expected key-literal, but got '%.*s'\n",
@@ -195,11 +195,11 @@ parse_hotkey(struct parser *parser)
return NULL;
}
- if(parser_match(parser, Token_Arrow)) {
+ if (parser_match(parser, Token_Arrow)) {
hotkey->flags |= Hotkey_Flag_Passthrough;
}
- if(parser_match(parser, Token_Command)) {
+ if (parser_match(parser, Token_Command)) {
hotkey->command = parse_command(parser);
} else {
fprintf(stderr, "(#%d:%d) expected ':' followed by command, but got '%.*s'\n",
@@ -217,13 +217,13 @@ parse_hotkey(struct parser *parser)
void parse_config(struct parser *parser, struct table *hotkey_map)
{
struct hotkey *hotkey;
- while(!parser_eof(parser)) {
- if((parser_check(parser, Token_Modifier)) ||
- (parser_check(parser, Token_Literal)) ||
- (parser_check(parser, Token_Key_Hex)) ||
- (parser_check(parser, Token_Key))) {
+ while (!parser_eof(parser)) {
+ if ((parser_check(parser, Token_Modifier)) ||
+ (parser_check(parser, Token_Literal)) ||
+ (parser_check(parser, Token_Key_Hex)) ||
+ (parser_check(parser, Token_Key))) {
hotkey = parse_hotkey(parser);
- if(parser->error) {
+ if (parser->error) {
free_hotkeys(hotkey_map);
return;
}
@@ -259,7 +259,7 @@ bool parser_eof(struct parser *parser)
struct token
parser_advance(struct parser *parser)
{
- if(!parser_eof(parser)) {
+ if (!parser_eof(parser)) {
parser->previous_token = parser->current_token;
parser->current_token = get_token(&parser->tokenizer);
}
@@ -268,14 +268,14 @@ parser_advance(struct parser *parser)
bool parser_check(struct parser *parser, enum token_type type)
{
- if(parser_eof(parser)) return false;
+ if (parser_eof(parser)) return false;
struct token token = parser_peek(parser);
return token.type == type;
}
bool parser_match(struct parser *parser, enum token_type type)
{
- if(parser_check(parser, type)) {
+ if (parser_check(parser, type)) {
parser_advance(parser);
return true;
}
@@ -286,7 +286,7 @@ bool parser_init(struct parser *parser, char *file)
{
memset(parser, 0, sizeof(struct parser));
char *buffer = read_file(file);
- if(buffer) {
+ if (buffer) {
tokenizer_init(&parser->tokenizer, buffer);
parser_advance(parser);
return true;
diff --git a/src/skhd.c b/src/skhd.c
index 03ff7a7..7fb35fb 100644
--- a/src/skhd.c
+++ b/src/skhd.c
@@ -68,7 +68,7 @@ internal void
parse_config_helper(char *absolutepath)
{
struct parser parser;
- if(parser_init(&parser, absolutepath)) {
+ if (parser_init(&parser, absolutepath)) {
parse_config(&parser, &hotkey_map);
parser_destroy(&parser);
} else {
@@ -84,7 +84,7 @@ internal HOTLOADER_CALLBACK(config_handler)
internal EVENT_TAP_CALLBACK(key_handler)
{
- switch(type) {
+ switch (type) {
case kCGEventTapDisabledByTimeout:
case kCGEventTapDisabledByUserInput: {
printf("skhd: restarting event-tap\n");
@@ -97,7 +97,7 @@ internal EVENT_TAP_CALLBACK(key_handler)
struct hotkey eventkey = { .flags = 0, .key = key };
cgeventflags_to_hotkeyflags(flags, &eventkey);
bool result = find_and_exec_hotkey(&eventkey, &hotkey_map);
- if(result) {
+ if (result) {
return NULL;
}
} break;
@@ -116,8 +116,8 @@ parse_arguments(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
- while((option = getopt_long(argc, argv, short_option, long_option, NULL)) != -1) {
- switch(option) {
+ while ((option = getopt_long(argc, argv, short_option, long_option, NULL)) != -1) {
+ switch (option) {
case 'v': {
printf("skhd version %d.%d.%d\n", major_version, minor_version, patch_version);
return true;
@@ -154,7 +154,7 @@ internal void
set_config_path()
{
char *home = getenv("HOME");
- if(home) {
+ if (home) {
int length = strlen(home) + strlen("/.skhdrc");
config_file = (char *) malloc(length + 1);
strcpy(config_file, home);
@@ -166,23 +166,23 @@ set_config_path()
int main(int argc, char **argv)
{
- if(parse_arguments(argc, argv)) {
+ if (parse_arguments(argc, argv)) {
return EXIT_SUCCESS;
}
- if(getuid() == 0 || geteuid() == 0) {
+ if (getuid() == 0 || geteuid() == 0) {
error("skhd: running as root is not allowed! abort..\n");
}
- if(secure_keyboard_entry_enabled()) {
+ if (secure_keyboard_entry_enabled()) {
error("skhd: secure keyboard entry is enabled! abort..\n");
}
- if(!check_privileges()) {
+ if (!check_privileges()) {
error("skhd: must be run with accessibility access.\n");
}
- if(!config_file) {
+ if (!config_file) {
set_config_path();
}
diff --git a/src/tokenize.c b/src/tokenize.c
index 645b79f..691b9c8 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -7,8 +7,8 @@
int token_equals(struct token token, const char *match)
{
const char *at = match;
- for(int i = 0; i < token.length; ++i, ++at) {
- if((*at == 0) || (token.text[i] != *at)) {
+ for (int i = 0; i < token.length; ++i, ++at) {
+ if ((*at == 0) || (token.text[i] != *at)) {
return false;
}
}
@@ -18,7 +18,7 @@ int token_equals(struct token token, const char *match)
internal void
advance(struct tokenizer *tokenizer)
{
- if(*tokenizer->at == '\n') {
+ if (*tokenizer->at == '\n') {
tokenizer->cursor = 0;
++tokenizer->line;
}
@@ -29,7 +29,7 @@ advance(struct tokenizer *tokenizer)
internal void
eat_whitespace(struct tokenizer *tokenizer)
{
- while(*tokenizer->at && isspace(*tokenizer->at)) {
+ while (*tokenizer->at && isspace(*tokenizer->at)) {
advance(tokenizer);
}
}
@@ -37,7 +37,7 @@ eat_whitespace(struct tokenizer *tokenizer)
internal void
eat_comment(struct tokenizer *tokenizer)
{
- while(*tokenizer->at && *tokenizer->at != '\n') {
+ while (*tokenizer->at && *tokenizer->at != '\n') {
advance(tokenizer);
}
}
@@ -45,8 +45,8 @@ eat_comment(struct tokenizer *tokenizer)
internal void
eat_command(struct tokenizer *tokenizer)
{
- while(*tokenizer->at && *tokenizer->at != '\n') {
- if(*tokenizer->at == '\\') {
+ while (*tokenizer->at && *tokenizer->at != '\n') {
+ if (*tokenizer->at == '\\') {
advance(tokenizer);
}
advance(tokenizer);
@@ -56,9 +56,9 @@ eat_command(struct tokenizer *tokenizer)
internal void
eat_hex(struct tokenizer *tokenizer)
{
- while((*tokenizer->at) &&
- ((isdigit(*tokenizer->at)) ||
- (*tokenizer->at >= 'A' && *tokenizer->at <= 'F'))) {
+ while ((*tokenizer->at) &&
+ ((isdigit(*tokenizer->at)) ||
+ (*tokenizer->at >= 'A' && *tokenizer->at <= 'F'))) {
advance(tokenizer);
}
}
@@ -66,11 +66,11 @@ eat_hex(struct tokenizer *tokenizer)
internal void
eat_identifier(struct tokenizer *tokenizer)
{
- while((*tokenizer->at) && isalpha(*tokenizer->at)) {
+ while ((*tokenizer->at) && isalpha(*tokenizer->at)) {
advance(tokenizer);
}
- while((*tokenizer->at) && isdigit(*tokenizer->at)) {
+ while ((*tokenizer->at) && isdigit(*tokenizer->at)) {
advance(tokenizer);
}
}
@@ -78,18 +78,18 @@ eat_identifier(struct tokenizer *tokenizer)
internal enum token_type
resolve_identifier_type(struct token token)
{
- if(token.length == 1) {
+ if (token.length == 1) {
return Token_Key;
}
- for(int i = 0; i < array_count(modifier_flags_str); ++i) {
- if(token_equals(token, modifier_flags_str[i])) {
+ for (int i = 0; i < array_count(modifier_flags_str); ++i) {
+ if (token_equals(token, modifier_flags_str[i])) {
return Token_Modifier;
}
}
- for(int i = 0; i < array_count(literal_keycode_str); ++i) {
- if(token_equals(token, literal_keycode_str[i])) {
+ for (int i = 0; i < array_count(literal_keycode_str); ++i) {
+ if (token_equals(token, literal_keycode_str[i])) {
return Token_Literal;
}
}
@@ -118,7 +118,7 @@ get_token(struct tokenizer *tokenizer)
c = *token.text;
advance(tokenizer);
- switch(c) {
+ switch (c) {
case '\0':{ token.type = Token_EndOfStream; } break;
case '+': { token.type = Token_Plus; } break;
case '#': {
@@ -126,7 +126,7 @@ get_token(struct tokenizer *tokenizer)
token = get_token(tokenizer);
} break;
case '-': {
- if(*tokenizer->at && *tokenizer->at == '>') {
+ if (*tokenizer->at && *tokenizer->at == '>') {
advance(tokenizer);
token.length = tokenizer->at - token.text;
token.type = Token_Arrow;
@@ -146,14 +146,14 @@ get_token(struct tokenizer *tokenizer)
token.type = Token_Command;
} break;
default: {
- if(c == '0' && *tokenizer->at == 'x') {
+ if (c == '0' && *tokenizer->at == 'x') {
advance(tokenizer);
eat_hex(tokenizer);
token.length = tokenizer->at - token.text;
token.type = Token_Key_Hex;
- } else if(isdigit(c)) {
+ } else if (isdigit(c)) {
token.type = Token_Key;
- } else if(isalpha(c)) {
+ } else if (isalpha(c)) {
eat_identifier(tokenizer);
token.length = tokenizer->at - token.text;
token.type = resolve_identifier_type(token);