From 26437c35ad12ac90a94657b3bb5a1ed1b8f5e0db Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Wed, 7 Oct 2015 20:05:44 -0700 Subject: [PATCH] Fixing ascii string macro processing - Fixing very old naming convention Brace to Bracket - For now, accepting the old Brace names (will be deprecated at some point) --- kll.py | 15 ++++++++------- kll_lib/hid_dict.py | 12 ++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/kll.py b/kll.py index 07a822c..c4386e0 100755 --- a/kll.py +++ b/kll.py @@ -147,7 +147,7 @@ def tokenize( string ): ( 'ScanCode', ( r'S((0x[0-9a-fA-F]+)|([0-9]+))', ) ), ( 'ScanCodeStart', ( r'S\[', ) ), ( 'CodeEnd', ( r'\]', ) ), - ( 'String', ( r'"[^"]*"', VERBOSE ) ), + ( 'String', ( r'"[^"]*"', ) ), ( 'SequenceString', ( r"'[^']*'", ) ), ( 'Operator', ( r'=>|:\+|:-|::|:|=', ) ), ( 'Comma', ( r',', ) ), @@ -268,16 +268,17 @@ def make_seqString( token ): ( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0x20 ), ( "+", 0x12 ), ( "&(", 0x11 ), - ( "!#$%<>", 0x10 ), + ( "!#$%", 0x10 ), ( "*", 0x0E ), ( ")", 0x07 ), ( '"', 0x05 ), ( ":", 0x01 ), - ( "^", -0x10 ), - ( "_", -0x18 ), - ( "{}|~", -0x1E ), - ( "@", -0x32 ), - ( "?", -0x38 ), + ( "@", -0x0E ), + ( "<>?", -0x10 ), + ( "~", -0x1E ), + ( "{}|", -0x20 ), + ( "^", -0x28 ), + ( "_", -0x32 ), ) listOfLists = [] diff --git a/kll_lib/hid_dict.py b/kll_lib/hid_dict.py index 18d0547..4206a01 100644 --- a/kll_lib/hid_dict.py +++ b/kll_lib/hid_dict.py @@ -71,8 +71,8 @@ hid_lookup_dictionary = dict([ ( ('USB', 0x2C), 'KEY_SPACE' ), ( ('USB', 0x2D), 'KEY_MINUS' ), ( ('USB', 0x2E), 'KEY_EQUAL' ), - ( ('USB', 0x2F), 'KEY_LEFT_BRACE' ), - ( ('USB', 0x30), 'KEY_RIGHT_BRACE' ), + ( ('USB', 0x2F), 'KEY_LEFT_BRACKET' ), + ( ('USB', 0x30), 'KEY_RIGHT_BRACKET' ), ( ('USB', 0x31), 'KEY_BACKSLASH' ), ( ('USB', 0x32), 'KEY_NUMBER' ), ( ('USB', 0x33), 'KEY_SEMICOLON' ), @@ -198,8 +198,8 @@ hid_lookup_dictionary = dict([ ( ('USB', 0xB5), 'KEY_CURRENCY_SUB' ), ( ('USB', 0xB6), 'KEYPAD_LPAREN' ), ( ('USB', 0xB7), 'KEYPAD_RPAREN' ), - ( ('USB', 0xB8), 'KEYPAD_LBRACE' ), - ( ('USB', 0xB9), 'KEYPAD_RBRACE' ), + ( ('USB', 0xB8), 'KEYPAD_LBRACKET' ), + ( ('USB', 0xB9), 'KEYPAD_RBRACKET' ), ( ('USB', 0xBA), 'KEYPAD_TAB' ), ( ('USB', 0xBB), 'KEYPAD_BACKSPACE' ), ( ('USB', 0xBC), 'KEYPAD_A' ), @@ -835,8 +835,8 @@ kll_hid_lookup_dictionary['USBCode'] = dict([ ( 'SPACE', ('USB', 0x2C) ), ( 'SPACEBAR', ('USB', 0x2C) ), ( '-', ('USB', 0x2D) ), ( 'MINUS', ('USB', 0x2D) ), ( '=', ('USB', 0x2E) ), ( 'EQUALS', ('USB', 0x2E) ), ( 'EQUAL', ('USB', 0x2E) ), - ( '{', ('USB', 0x2F) ), ( 'LEFT BRACE', ('USB', 0x2F) ), ( 'LBRACE', ('USB', 0x2F) ), - ( '}', ('USB', 0x30) ), ( 'RIGHT BRACE', ('USB', 0x30) ), ( 'RBRACE', ('USB', 0x30) ), + ( '[', ('USB', 0x2F) ), ( 'LEFT BRACKET', ('USB', 0x2F) ), ( 'LBRACKET', ('USB', 0x2F) ), ( 'LEFT BRACE', ('USB', 0x2F) ), ( 'LBRACE', ('USB', 0x2F) ), + ( ']', ('USB', 0x30) ), ( 'RIGHT BRACKET', ('USB', 0x30) ), ( 'RBRACKET', ('USB', 0x30) ), ( 'RIGHT BRACE', ('USB', 0x30) ), ( 'RBRACE', ('USB', 0x30) ), ( '\\', ('USB', 0x31) ), ( 'BACKSLASH', ('USB', 0x31) ), ( '#', ('USB', 0x32) ), ( 'NUMBER', ('USB', 0x32) ), ( 'HASH', ('USB', 0x32) ), ( ';', ('USB', 0x33) ), ( 'SEMICOLON', ('USB', 0x33) ),