#Parse C file without checking for errors?
1 messages · Page 1 of 1 (latest)
Basically saying "Hey I import this C file, I know what I'm doing trust me, don't check for errors"
I cant think of any way of doing this without using the build system
you can preprocess the C file with a Run step and send the result of that into a TranslateC step
and then turn the result of the TranslateC step into a module you can import
Hmm ok ty, I'll look into the build system then. Haven't learn any of that 
why do you want to do this?
I want to make a program that reads a QMK keymap.c keymaps matrix and map the keys into an ASCII art template
I did this before but I have to use regex, It would be cool if Zig could read C file directly and access the data the legit way
Any reason you cant seperate it into a header file?
wdym? I want to make it general so that anyone can just point the program to a keymap.c file and that's it. Because it's a C file, people can put whatever they want inside of it, all I know is that by convention, the keymap.c will have this inside:
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_ortho_4x12(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
), .....}
And this is the only part I'm interested in.