Skip to content

Parentheses around kemaps are stripped too eagerly #91

@hupfdule

Description

@hupfdule

The code seems to remove surrounding parentheses before splitting a keymap into chunks. However it seems that if the last key in a keymap ends with a parentheses this one will be stripped as well and therefore the key is parsed incorrectly.

See for example the Model01 keymap from QMK. The last two keys (the palm keys) are both defined as MO(FUN). But when running keymapviz over (via PR #90) it the last one is incorrectly parsed as MO.

/* ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┐                           ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┐
 * │QK_BOO│  1   │  2   │  3   │  4   │  5   │RGB_MO│                           │      │  6   │  7   │  8   │  9   │  0   │TG(NUM│
 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤                           ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
 * │ GRV  │  Q   │  W   │  E   │  R   │  T   │      │                           │      │  Y   │  U   │  I   │  O   │  P   │ EQL  │
 * ├──────┼──────┼──────┼──────┼──────┼──────┤ TAB  │                           │ ENT  ├──────┼──────┼──────┼──────┼──────┼──────┤
 * │ PGUP │  A   │  S   │  D   │  F   │  G   ├──────┤                           ├──────┤  H   │  J   │  K   │  L   │ SCLN │ QUOT │
 * ├──────┼──────┼──────┼──────┼──────┼──────┤      │                           │      ├──────┼──────┼──────┼──────┼──────┼──────┤
 * │ PGDN │  Z   │  X   │  C   │  V   │  B   │ ESC  │                           │      │  N   │  M   │ COMM │ DOT  │ SLSH │ MINS │
 * └──────┴──────┴──────┴──────┴──────┴──────┴──────┘                           └──────┴──────┴──────┴──────┴──────┴──────┴──────┘
 *
 *                             ┌──────┬──────┐                                         ┌──────┬──────┐
 *                             │ LCTL │ BSPC ├──────┐                           ┌──────┤ SPC  │ RCTL │
 *                             │      │      │ LGUI ├──────┐             ┌──────┤ RALT │      │      │
 *                             └──────┴──────┤      │ LSFT │             │ RSFT │      ├──────┴──────┘
 *                                           └──────┤      │             │      ├──────┘
 *                                 ┌──────┐         └──────┘             └──────┘           ┌──────┐
 *                                 │      │                                                 │      │
 *                                 │MO(FUN│                                                 │  MO  │
 *                                 │      │                                                 │      │
 *                                 └──────┘                                                 └──────┘
 *                                                                                                      generated by [keymapviz] */

This is not specific to PR #90. It happens with already existing code, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions