MrMarble / zmk-viewer

cli tool to generate preview images from a zmk .keymap file
MIT License
135 stars 7 forks source link

can't generate cradio layout for default keymap #12

Open dstudzinski opened 1 year ago

dstudzinski commented 1 year ago

Hi,

I'm trying to generate layout for Cradio with default keymap. I downloaded default keymap from https://github.com/zmkfirmware/zmk/blob/main/app/boards/shields/cradio/cradio.keymap and I try to generate layout with zmk-viewer generate cradio -f ./cradio.keymap

I get

ERR  error="/Users/dawidstudzinski/Projects/zmk-config/cradio.keymap:9:13: unexpected token \"(\" (expected (<ident> | <int>))"

error and empty layout (same like without -f flag).

Am I doing something wrong or is it problem with keymap file?

sqdbruh commented 1 year ago

Same. Probably some issue with the parser.

MrMarble commented 1 year ago

Sorry for the delay, It's in part related to #14 but also the Home rows, as @sqdrck said, the parser is broken.

I'll fix it as soon as I can


Diving deeper into the issue, it isn't the #define itself but the custom home row function, I can't ignore part of the file with the parser I'm using. I'm trying to make my own parser which should be easier to read and maintain

bakerbrandond commented 1 year ago

Sorry for the delay, It's in part related to #14 but also the Home rows, as @sqdrck said, the parser is broken.

I'll fix it as soon as I can

Diving deeper into the issue, it isn't the #define itself but the custom home row function, I can't ignore part of the file with the parser I'm using. I'm trying to make my own parser which should be easier to read and maintain

have you looked into treesitter? there is a devicetree grammar already, can maybe reuse the treesitter parser? https://github.com/joelspadin/tree-sitter-devicetree

llama0815 commented 5 months ago

I'm not sure if it needs another ticket, but it's an issue with define as well:

I've got this line #include "keys_de.h" for local German characters and this error: unexpected token \"#\" (expected \"/\" \"{\" Device \"}\" \";\")"

when I change the line to #include <keys_de.h> it works but is obviously wrong.