diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-10-23 21:14:14 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-10-23 21:14:14 +0200 |
commit | b77510eef5fe46127e8a2d24c40a4b5107931d4c (patch) | |
tree | 48ba1eb25726bf3cc0c1ecaaa18c310ad4f442bf | |
parent | whitespace (diff) | |
download | mds-b77510eef5fe46127e8a2d24c40a4b5107931d4c.tar.gz mds-b77510eef5fe46127e8a2d24c40a4b5107931d4c.tar.bz2 mds-b77510eef5fe46127e8a2d24c40a4b5107931d4c.tar.xz |
syntax for kbd files
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | src/mds-kbdc/mds-kbdc.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/mds-kbdc/mds-kbdc.c b/src/mds-kbdc/mds-kbdc.c index 45a0f88..56cbd42 100644 --- a/src/mds-kbdc/mds-kbdc.c +++ b/src/mds-kbdc/mds-kbdc.c @@ -44,7 +44,78 @@ int main(int argc_, char** argv_) source_code_initialise(&source_code); fail_if (read_source_lines(pathname, &source_code) < 0); + + /* + + information + language "LANGUAGE" # multiple is allowed + country "COUNTRY" # multiple is allowed + variant "VARIANT" + end information + + include "some file" + + function add/3 + \add(\add(\1 \2) \3) + end function + + macro caps_affected/2 + <letter \1> : "\1" + <shift letter \1> : "\2" + <caps letter \1> : "\2" + <caps shift letter \1> : "\1" + end macro + + <altgr letter \\> : <dead letter ´> + <altgr shift letter \\> : "¬" + <altgr shift letter j> : <dead letter \u031B> # horn + + assumption + have_range "a" "z" + have_range "A" "Z" + have_range "0" "9" + have_chars " !\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~" + have <dead compose> + have <shift> + have <altgr> + have <alt> + have <ctrl> + end assumption + + for "A" to "Z" as \1 + <dead compose> "(" "\1" ")" : "\add(\u24B6 \sub(\1 "A"))" + end for + + let \6 : { \and(\4 16) \and(\4 32) \and(\4 64) \and(\4 128) } + + for 0 to 3 as \8 + \set(\6 \8 \add(\rsh(\get(\6 \8) \8) \mul(2 \rsh(\get(\7 \8))))) + end for + + if \and(\1 128) = 128 + let \2 : \or(\2 64) + end if + + \add(a b) # a + b + \sub(a b) # a - b + \mul(a b) # a ⋅ b + \div(a b) # floor[a / b] + \mod(a b) # a mod b + \rsh(a b) # a ⋅ 2 ↑ b + \lsh(a b) # floor[a / 2 ↑ b] + \or(a b) # bitwise + \and(a b) # bitwise + \xor(a b) # bitwise + \not(a) # logical + \equals(a b) # a = b + \greater(a b) # a > b + \less(a b) # a < b + \set(variable index value) + \get(variable index) + + */ + source_code_destroy(&source_code); return 0; pfail: |