Edit

kc3-lang/libxkbcommon/test/data/rules/merge-mode-replace

Branch :

  • Show log

    Commit

  • Author : Pierre Le Marre
    Date : 2025-03-25 22:52:06
    Hash : 23598fa1
    Message : Enable merge mode “replace” in include statements Previously only the merge modes “override” and “augment” were available in include statements, using the prefix ‘+’ and ‘|’ respectively. While on one hand `replace` include statement can be used in keymap files, on the other hand *rules* files have no way to express the *replace* mode. This commit enables the merge mode “replace” using the prefix `^`. This prefix was chosen due to its similarity with the `XOR` bit operator, which convey *mutual exclusion*. Other candidates: - `!` conveys some kind of higher precedence, akin to CSS `!important`. But it conflicts with the section header `!`, which is a token in the current parser. It would require special handling, not worth it. It also convey the meaning of negation, which is confusing. - `&` has the advantage of not corresponding to a token in the rules parser. `^` seems however to stand out more and it is less likely to trigger erroneous comparison with `|` and `&` bit operators.

  • test/data/rules/merge-mode-replace
  • ! model         = keycodes
      *             = evdev
    
    
    ! model         = types
      *             = complete
    
    ! model         = compat
      *             = complete
    
    ! layout        = symbols
      *             = pc+%l
    
    ! layout[1]     = symbols
      *             = pc+%l[1]
    
    ! layout[2]     = symbols
      *             = +%l[2]:2
    
    ! option        = symbols
    replace:single  = ^level3(ralt_alt)
    replace:first   = ^level3(ralt_alt)|empty
    replace:later   = +level3(ralt_switch)^level3(ralt_alt)|empty
    grp:menu_toggle	= +group(menu_toggle)