keyboardlayouteditor

[Fork] Archive of the keyboard layout editor.
git clone https://git.jojolepro.com/keyboardlayouteditor.git
Log | Files | Refs | README | LICENSE

commit 911e7ef563787fbbad5c7738f769c8dd0f41df5e
parent b72aab89de9e0873b28a0ea0cf3f9cbbb9a35ccc
Author: simos.lists <simos.lists@70737e48-4f4a-0410-8df8-290828ad50c4>
Date:   Tue, 20 May 2008 20:56:07 +0000

Now type[] works locally inside key<>

git-svn-id: http://keyboardlayouteditor.googlecode.com/svn/trunk@28 70737e48-4f4a-0410-8df8-290828ad50c4

Diffstat:
MXKBGrammar/XKBGrammar.g | 11++++-------
MXKBGrammar/XKBGrammar.tokens | 97+++++++++++++++++++++++++++++++++++++++++--------------------------------------
MXKBGrammar/XKBGrammarLexer.py | 723++++++++++++++++++++++++++++++++++++++++++-------------------------------------
MXKBGrammar/XKBGrammarLexer.pyc | 0
MXKBGrammar/XKBGrammarParser.py | 650++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
MXKBGrammar/XKBGrammarParser.pyc | 0
MXKBGrammar/XKBGrammarWalker.g | 7++++++-
MXKBGrammar/check_xkb.py | 14+++++++++++++-
MXKBGrammar/gr | 10++++------
MXKBGrammar/print_tree.py | 6+++---
10 files changed, 825 insertions(+), 693 deletions(-)

diff --git a/XKBGrammar/XKBGrammar.g b/XKBGrammar/XKBGrammar.g @@ -17,6 +17,7 @@ tokens TOKEN_KEY_TYPE; TOKEN_NAME; TOKEN_KEY; + TOKEN_TYPE; TOKEN_MODIFIER_MAP; // Tokens for tree. @@ -86,7 +87,7 @@ line_keytype : 'key.type' '[' n1=NAME ']' '=' n2=DQSTRING -> ^(TOKEN_KEY_TYPE $n1 ^(VALUE $n2)) ; - + line_key : 'key' keycode keysyms -> ^(TOKEN_KEY keycode keysyms) @@ -97,18 +98,14 @@ line_modifier_map -> ^(TOKEN_MODIFIER_MAP state keycode+) ; -// segment_type -// : 'type' '[' NAME ']' '=' DQSTRING ',' -// -> ^(TOKEN_SEGMENT_TYPE NAME DQSTRING) - keycode : NAME -> ^(KEYCODE NAME) | '<' NAME '>' -> ^(KEYCODEX NAME) ; keysyms - : '{' '[' keysym+=NAME (',' keysym+=NAME)* ']' '}' - -> ^(KEYSYMS $keysym+) + : '{' ('type' '[' tn1=NAME ']' '=' tn2=DQSTRING ',')? '[' keysym+=NAME (',' keysym+=NAME)* ']' '}' + -> ^(KEYSYMS ^(TOKEN_TYPE $tn1 $tn2)? $keysym+) ; mapOptions diff --git a/XKBGrammar/XKBGrammar.tokens b/XKBGrammar/XKBGrammar.tokens @@ -2,41 +2,43 @@ T__29=29 T__28=28 T__27=27 T__26=26 -T__25=25 -MAPOPTIONS=12 +MAPOPTIONS=13 TOKEN_INCLUDE=4 -TOKEN_MODIFIER_MAP=8 -MAPTYPE=10 -NAME=21 +TOKEN_MODIFIER_MAP=9 +TOKEN_TYPE=8 +MAPTYPE=11 +T__55=55 +NAME=22 T__51=51 T__52=52 +MAPMATERIAL=14 T__53=53 -MAPMATERIAL=13 -KEYSYMS=17 -COMMENT=23 -DQSTRING=20 +T__54=54 +KEYSYMS=18 +COMMENT=24 +DQSTRING=21 T__50=50 T__42=42 T__43=43 -STATE=19 +STATE=20 T__40=40 T__41=41 T__46=46 T__47=47 T__44=44 +SECTION=15 T__45=45 -SECTION=14 -LINE_COMMENT=24 -KEYCODE=15 +LINE_COMMENT=25 +KEYCODE=16 T__48=48 T__49=49 TOKEN_NAME=6 -VALUE=18 -LAYOUT=9 +VALUE=19 +LAYOUT=10 T__30=30 T__31=31 T__32=32 -WS=22 +WS=23 T__33=33 T__34=34 T__35=35 @@ -45,35 +47,36 @@ T__37=37 T__38=38 T__39=39 TOKEN_KEY=7 -MAPNAME=11 +MAPNAME=12 TOKEN_KEY_TYPE=5 -KEYCODEX=16 -'alphanumeric_keys'=42 -'Shift'=46 -'alternate_group'=44 -'Mod3'=51 -'>'=38 -'include'=28 -'hidden'=40 -';'=27 -'Mod1'=49 -'='=32 -'Mod5'=53 -'xkb_symbols'=45 -'}'=26 -'Control'=47 -'key'=34 -'partial'=41 -'{'=25 -'modifier_keys'=43 -'Mod4'=52 -'Mod2'=50 -'<'=37 -'key.type'=33 -'['=30 -'name'=29 -','=36 -'modifier_map'=35 -'default'=39 -']'=31 -'Lock'=48 +KEYCODEX=17 +'alphanumeric_keys'=44 +'Shift'=48 +'alternate_group'=46 +'Mod3'=53 +'type'=40 +'>'=39 +'include'=29 +'hidden'=42 +';'=28 +'Mod1'=51 +'='=33 +'Mod5'=55 +'xkb_symbols'=47 +'}'=27 +'Control'=49 +'key'=35 +'partial'=43 +'{'=26 +'modifier_keys'=45 +'Mod4'=54 +'Mod2'=52 +'<'=38 +'key.type'=34 +'['=31 +'name'=30 +','=37 +'modifier_map'=36 +'default'=41 +']'=32 +'Lock'=50 diff --git a/XKBGrammar/XKBGrammarLexer.py b/XKBGrammar/XKBGrammarLexer.py @@ -1,4 +1,4 @@ -# $ANTLR 3.1b1 XKBGrammar.g 2008-05-20 20:25:39 +# $ANTLR 3.1b1 XKBGrammar.g 2008-05-20 21:54:25 import sys from antlr3 import * @@ -13,53 +13,55 @@ T__29=29 T__28=28 T__27=27 T__26=26 -MAPOPTIONS=12 -T__25=25 +MAPOPTIONS=13 TOKEN_INCLUDE=4 -TOKEN_MODIFIER_MAP=8 +TOKEN_MODIFIER_MAP=9 EOF=-1 -MAPTYPE=10 -NAME=21 +TOKEN_TYPE=8 +MAPTYPE=11 +T__55=55 +NAME=22 T__51=51 T__52=52 -MAPMATERIAL=13 T__53=53 -KEYSYMS=17 -COMMENT=23 -DQSTRING=20 +MAPMATERIAL=14 +T__54=54 +KEYSYMS=18 +COMMENT=24 +DQSTRING=21 T__50=50 T__42=42 T__43=43 -STATE=19 +STATE=20 T__40=40 T__41=41 T__46=46 T__47=47 T__44=44 +SECTION=15 T__45=45 -SECTION=14 -LINE_COMMENT=24 -KEYCODE=15 +LINE_COMMENT=25 +KEYCODE=16 T__48=48 T__49=49 TOKEN_NAME=6 -VALUE=18 -LAYOUT=9 +VALUE=19 +LAYOUT=10 T__30=30 T__31=31 T__32=32 -WS=22 T__33=33 +WS=23 T__34=34 T__35=35 T__36=36 T__37=37 T__38=38 T__39=39 -MAPNAME=11 +MAPNAME=12 TOKEN_KEY=7 TOKEN_KEY_TYPE=5 -KEYCODEX=16 +KEYCODEX=17 class XKBGrammarLexer(Lexer): @@ -87,31 +89,6 @@ class XKBGrammarLexer(Lexer): - # $ANTLR start T__25 - def mT__25(self, ): - - try: - _type = T__25 - _channel = DEFAULT_CHANNEL - - # XKBGrammar.g:7:7: ( '{' ) - # XKBGrammar.g:7:9: '{' - self.match(123) - - - - - self._state.type = _type - self._state.channel = _channel - - finally: - - pass - - # $ANTLR end T__25 - - - # $ANTLR start T__26 def mT__26(self, ): @@ -119,9 +96,9 @@ class XKBGrammarLexer(Lexer): _type = T__26 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:8:7: ( '}' ) - # XKBGrammar.g:8:9: '}' - self.match(125) + # XKBGrammar.g:7:7: ( '{' ) + # XKBGrammar.g:7:9: '{' + self.match(123) @@ -144,9 +121,9 @@ class XKBGrammarLexer(Lexer): _type = T__27 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:9:7: ( ';' ) - # XKBGrammar.g:9:9: ';' - self.match(59) + # XKBGrammar.g:8:7: ( '}' ) + # XKBGrammar.g:8:9: '}' + self.match(125) @@ -169,9 +146,9 @@ class XKBGrammarLexer(Lexer): _type = T__28 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:10:7: ( 'include' ) - # XKBGrammar.g:10:9: 'include' - self.match("include") + # XKBGrammar.g:9:7: ( ';' ) + # XKBGrammar.g:9:9: ';' + self.match(59) @@ -194,9 +171,9 @@ class XKBGrammarLexer(Lexer): _type = T__29 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:11:7: ( 'name' ) - # XKBGrammar.g:11:9: 'name' - self.match("name") + # XKBGrammar.g:10:7: ( 'include' ) + # XKBGrammar.g:10:9: 'include' + self.match("include") @@ -219,9 +196,9 @@ class XKBGrammarLexer(Lexer): _type = T__30 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:12:7: ( '[' ) - # XKBGrammar.g:12:9: '[' - self.match(91) + # XKBGrammar.g:11:7: ( 'name' ) + # XKBGrammar.g:11:9: 'name' + self.match("name") @@ -244,9 +221,9 @@ class XKBGrammarLexer(Lexer): _type = T__31 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:13:7: ( ']' ) - # XKBGrammar.g:13:9: ']' - self.match(93) + # XKBGrammar.g:12:7: ( '[' ) + # XKBGrammar.g:12:9: '[' + self.match(91) @@ -269,9 +246,9 @@ class XKBGrammarLexer(Lexer): _type = T__32 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:14:7: ( '=' ) - # XKBGrammar.g:14:9: '=' - self.match(61) + # XKBGrammar.g:13:7: ( ']' ) + # XKBGrammar.g:13:9: ']' + self.match(93) @@ -294,9 +271,9 @@ class XKBGrammarLexer(Lexer): _type = T__33 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:15:7: ( 'key.type' ) - # XKBGrammar.g:15:9: 'key.type' - self.match("key.type") + # XKBGrammar.g:14:7: ( '=' ) + # XKBGrammar.g:14:9: '=' + self.match(61) @@ -319,9 +296,9 @@ class XKBGrammarLexer(Lexer): _type = T__34 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:16:7: ( 'key' ) - # XKBGrammar.g:16:9: 'key' - self.match("key") + # XKBGrammar.g:15:7: ( 'key.type' ) + # XKBGrammar.g:15:9: 'key.type' + self.match("key.type") @@ -344,9 +321,9 @@ class XKBGrammarLexer(Lexer): _type = T__35 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:17:7: ( 'modifier_map' ) - # XKBGrammar.g:17:9: 'modifier_map' - self.match("modifier_map") + # XKBGrammar.g:16:7: ( 'key' ) + # XKBGrammar.g:16:9: 'key' + self.match("key") @@ -369,9 +346,9 @@ class XKBGrammarLexer(Lexer): _type = T__36 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:18:7: ( ',' ) - # XKBGrammar.g:18:9: ',' - self.match(44) + # XKBGrammar.g:17:7: ( 'modifier_map' ) + # XKBGrammar.g:17:9: 'modifier_map' + self.match("modifier_map") @@ -394,9 +371,9 @@ class XKBGrammarLexer(Lexer): _type = T__37 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:19:7: ( '<' ) - # XKBGrammar.g:19:9: '<' - self.match(60) + # XKBGrammar.g:18:7: ( ',' ) + # XKBGrammar.g:18:9: ',' + self.match(44) @@ -419,9 +396,9 @@ class XKBGrammarLexer(Lexer): _type = T__38 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:20:7: ( '>' ) - # XKBGrammar.g:20:9: '>' - self.match(62) + # XKBGrammar.g:19:7: ( '<' ) + # XKBGrammar.g:19:9: '<' + self.match(60) @@ -444,9 +421,9 @@ class XKBGrammarLexer(Lexer): _type = T__39 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:21:7: ( 'default' ) - # XKBGrammar.g:21:9: 'default' - self.match("default") + # XKBGrammar.g:20:7: ( '>' ) + # XKBGrammar.g:20:9: '>' + self.match(62) @@ -469,9 +446,9 @@ class XKBGrammarLexer(Lexer): _type = T__40 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:22:7: ( 'hidden' ) - # XKBGrammar.g:22:9: 'hidden' - self.match("hidden") + # XKBGrammar.g:21:7: ( 'type' ) + # XKBGrammar.g:21:9: 'type' + self.match("type") @@ -494,9 +471,9 @@ class XKBGrammarLexer(Lexer): _type = T__41 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:23:7: ( 'partial' ) - # XKBGrammar.g:23:9: 'partial' - self.match("partial") + # XKBGrammar.g:22:7: ( 'default' ) + # XKBGrammar.g:22:9: 'default' + self.match("default") @@ -519,9 +496,9 @@ class XKBGrammarLexer(Lexer): _type = T__42 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:24:7: ( 'alphanumeric_keys' ) - # XKBGrammar.g:24:9: 'alphanumeric_keys' - self.match("alphanumeric_keys") + # XKBGrammar.g:23:7: ( 'hidden' ) + # XKBGrammar.g:23:9: 'hidden' + self.match("hidden") @@ -544,9 +521,9 @@ class XKBGrammarLexer(Lexer): _type = T__43 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:25:7: ( 'modifier_keys' ) - # XKBGrammar.g:25:9: 'modifier_keys' - self.match("modifier_keys") + # XKBGrammar.g:24:7: ( 'partial' ) + # XKBGrammar.g:24:9: 'partial' + self.match("partial") @@ -569,9 +546,9 @@ class XKBGrammarLexer(Lexer): _type = T__44 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:26:7: ( 'alternate_group' ) - # XKBGrammar.g:26:9: 'alternate_group' - self.match("alternate_group") + # XKBGrammar.g:25:7: ( 'alphanumeric_keys' ) + # XKBGrammar.g:25:9: 'alphanumeric_keys' + self.match("alphanumeric_keys") @@ -594,9 +571,9 @@ class XKBGrammarLexer(Lexer): _type = T__45 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:27:7: ( 'xkb_symbols' ) - # XKBGrammar.g:27:9: 'xkb_symbols' - self.match("xkb_symbols") + # XKBGrammar.g:26:7: ( 'modifier_keys' ) + # XKBGrammar.g:26:9: 'modifier_keys' + self.match("modifier_keys") @@ -619,9 +596,9 @@ class XKBGrammarLexer(Lexer): _type = T__46 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:28:7: ( 'Shift' ) - # XKBGrammar.g:28:9: 'Shift' - self.match("Shift") + # XKBGrammar.g:27:7: ( 'alternate_group' ) + # XKBGrammar.g:27:9: 'alternate_group' + self.match("alternate_group") @@ -644,9 +621,9 @@ class XKBGrammarLexer(Lexer): _type = T__47 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:29:7: ( 'Control' ) - # XKBGrammar.g:29:9: 'Control' - self.match("Control") + # XKBGrammar.g:28:7: ( 'xkb_symbols' ) + # XKBGrammar.g:28:9: 'xkb_symbols' + self.match("xkb_symbols") @@ -669,9 +646,9 @@ class XKBGrammarLexer(Lexer): _type = T__48 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:30:7: ( 'Lock' ) - # XKBGrammar.g:30:9: 'Lock' - self.match("Lock") + # XKBGrammar.g:29:7: ( 'Shift' ) + # XKBGrammar.g:29:9: 'Shift' + self.match("Shift") @@ -694,9 +671,9 @@ class XKBGrammarLexer(Lexer): _type = T__49 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:31:7: ( 'Mod1' ) - # XKBGrammar.g:31:9: 'Mod1' - self.match("Mod1") + # XKBGrammar.g:30:7: ( 'Control' ) + # XKBGrammar.g:30:9: 'Control' + self.match("Control") @@ -719,9 +696,9 @@ class XKBGrammarLexer(Lexer): _type = T__50 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:32:7: ( 'Mod2' ) - # XKBGrammar.g:32:9: 'Mod2' - self.match("Mod2") + # XKBGrammar.g:31:7: ( 'Lock' ) + # XKBGrammar.g:31:9: 'Lock' + self.match("Lock") @@ -744,9 +721,9 @@ class XKBGrammarLexer(Lexer): _type = T__51 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:33:7: ( 'Mod3' ) - # XKBGrammar.g:33:9: 'Mod3' - self.match("Mod3") + # XKBGrammar.g:32:7: ( 'Mod1' ) + # XKBGrammar.g:32:9: 'Mod1' + self.match("Mod1") @@ -769,9 +746,9 @@ class XKBGrammarLexer(Lexer): _type = T__52 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:34:7: ( 'Mod4' ) - # XKBGrammar.g:34:9: 'Mod4' - self.match("Mod4") + # XKBGrammar.g:33:7: ( 'Mod2' ) + # XKBGrammar.g:33:9: 'Mod2' + self.match("Mod2") @@ -794,9 +771,9 @@ class XKBGrammarLexer(Lexer): _type = T__53 _channel = DEFAULT_CHANNEL - # XKBGrammar.g:35:7: ( 'Mod5' ) - # XKBGrammar.g:35:9: 'Mod5' - self.match("Mod5") + # XKBGrammar.g:34:7: ( 'Mod3' ) + # XKBGrammar.g:34:9: 'Mod3' + self.match("Mod3") @@ -812,6 +789,56 @@ class XKBGrammarLexer(Lexer): + # $ANTLR start T__54 + def mT__54(self, ): + + try: + _type = T__54 + _channel = DEFAULT_CHANNEL + + # XKBGrammar.g:35:7: ( 'Mod4' ) + # XKBGrammar.g:35:9: 'Mod4' + self.match("Mod4") + + + + + self._state.type = _type + self._state.channel = _channel + + finally: + + pass + + # $ANTLR end T__54 + + + + # $ANTLR start T__55 + def mT__55(self, ): + + try: + _type = T__55 + _channel = DEFAULT_CHANNEL + + # XKBGrammar.g:36:7: ( 'Mod5' ) + # XKBGrammar.g:36:9: 'Mod5' + self.match("Mod5") + + + + + self._state.type = _type + self._state.channel = _channel + + finally: + + pass + + # $ANTLR end T__55 + + + # $ANTLR start NAME def mNAME(self, ): @@ -819,9 +846,9 @@ class XKBGrammarLexer(Lexer): _type = NAME _channel = DEFAULT_CHANNEL - # XKBGrammar.g:136:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' | '+' | '-' )* ) - # XKBGrammar.g:136:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' | '+' | '-' )* - # XKBGrammar.g:136:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' | '+' | '-' )* + # XKBGrammar.g:133:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' | '+' | '-' )* ) + # XKBGrammar.g:133:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' | '+' | '-' )* + # XKBGrammar.g:133:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' | '+' | '-' )* while True: #loop1 alt1 = 2 LA1_0 = self.input.LA(1) @@ -867,8 +894,8 @@ class XKBGrammarLexer(Lexer): _type = WS _channel = DEFAULT_CHANNEL - # XKBGrammar.g:140:2: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) ) - # XKBGrammar.g:141:2: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) + # XKBGrammar.g:137:2: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) ) + # XKBGrammar.g:138:2: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) if (9 <= self.input.LA(1) <= 10) or (12 <= self.input.LA(1) <= 13) or self.input.LA(1) == 32: self.input.consume(); else: @@ -901,10 +928,10 @@ class XKBGrammarLexer(Lexer): _type = COMMENT _channel = DEFAULT_CHANNEL - # XKBGrammar.g:146:6: ( '/*' ( . )* '*/' ) - # XKBGrammar.g:147:2: '/*' ( . )* '*/' + # XKBGrammar.g:143:6: ( '/*' ( . )* '*/' ) + # XKBGrammar.g:144:2: '/*' ( . )* '*/' self.match("/*") - # XKBGrammar.g:147:7: ( . )* + # XKBGrammar.g:144:7: ( . )* while True: #loop2 alt2 = 2 LA2_0 = self.input.LA(1) @@ -923,7 +950,7 @@ class XKBGrammarLexer(Lexer): if alt2 == 1: - # XKBGrammar.g:147:7: . + # XKBGrammar.g:144:7: . self.matchAny() @@ -958,10 +985,10 @@ class XKBGrammarLexer(Lexer): _type = LINE_COMMENT _channel = DEFAULT_CHANNEL - # XKBGrammar.g:151:6: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) - # XKBGrammar.g:152:2: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' + # XKBGrammar.g:148:6: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) + # XKBGrammar.g:149:2: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' self.match("//") - # XKBGrammar.g:152:7: (~ ( '\\n' | '\\r' ) )* + # XKBGrammar.g:149:7: (~ ( '\\n' | '\\r' ) )* while True: #loop3 alt3 = 2 LA3_0 = self.input.LA(1) @@ -971,7 +998,7 @@ class XKBGrammarLexer(Lexer): if alt3 == 1: - # XKBGrammar.g:152:7: ~ ( '\\n' | '\\r' ) + # XKBGrammar.g:149:7: ~ ( '\\n' | '\\r' ) if (0 <= self.input.LA(1) <= 9) or (11 <= self.input.LA(1) <= 12) or (14 <= self.input.LA(1) <= 65534): self.input.consume(); else: @@ -986,14 +1013,14 @@ class XKBGrammarLexer(Lexer): break #loop3 - # XKBGrammar.g:152:23: ( '\\r' )? + # XKBGrammar.g:149:23: ( '\\r' )? alt4 = 2 LA4_0 = self.input.LA(1) if (LA4_0 == 13) : alt4 = 1 if alt4 == 1: - # XKBGrammar.g:152:23: '\\r' + # XKBGrammar.g:149:23: '\\r' self.match(13) @@ -1025,10 +1052,10 @@ class XKBGrammarLexer(Lexer): _type = DQSTRING _channel = DEFAULT_CHANNEL - # XKBGrammar.g:160:6: ( '\"' ( options {greedy=false; } : ~ ( '\"' ) )* '\"' ) - # XKBGrammar.g:160:10: '\"' ( options {greedy=false; } : ~ ( '\"' ) )* '\"' + # XKBGrammar.g:157:6: ( '\"' ( options {greedy=false; } : ~ ( '\"' ) )* '\"' ) + # XKBGrammar.g:157:10: '\"' ( options {greedy=false; } : ~ ( '\"' ) )* '\"' self.match(34) - # XKBGrammar.g:160:14: ( options {greedy=false; } : ~ ( '\"' ) )* + # XKBGrammar.g:157:14: ( options {greedy=false; } : ~ ( '\"' ) )* while True: #loop5 alt5 = 2 LA5_0 = self.input.LA(1) @@ -1040,7 +1067,7 @@ class XKBGrammarLexer(Lexer): if alt5 == 1: - # XKBGrammar.g:160:39: ~ ( '\"' ) + # XKBGrammar.g:157:39: ~ ( '\"' ) if (0 <= self.input.LA(1) <= 33) or (35 <= self.input.LA(1) <= 65534): self.input.consume(); else: @@ -1072,209 +1099,215 @@ class XKBGrammarLexer(Lexer): def mTokens(self): - # XKBGrammar.g:1:8: ( T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | NAME | WS | COMMENT | LINE_COMMENT | DQSTRING ) - alt6 = 34 + # XKBGrammar.g:1:8: ( T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | NAME | WS | COMMENT | LINE_COMMENT | DQSTRING ) + alt6 = 35 alt6 = self.dfa6.predict(self.input) if alt6 == 1: - # XKBGrammar.g:1:10: T__25 - self.mT__25() + # XKBGrammar.g:1:10: T__26 + self.mT__26() elif alt6 == 2: - # XKBGrammar.g:1:16: T__26 - self.mT__26() + # XKBGrammar.g:1:16: T__27 + self.mT__27() elif alt6 == 3: - # XKBGrammar.g:1:22: T__27 - self.mT__27() + # XKBGrammar.g:1:22: T__28 + self.mT__28() elif alt6 == 4: - # XKBGrammar.g:1:28: T__28 - self.mT__28() + # XKBGrammar.g:1:28: T__29 + self.mT__29() elif alt6 == 5: - # XKBGrammar.g:1:34: T__29 - self.mT__29() + # XKBGrammar.g:1:34: T__30 + self.mT__30() elif alt6 == 6: - # XKBGrammar.g:1:40: T__30 - self.mT__30() + # XKBGrammar.g:1:40: T__31 + self.mT__31() elif alt6 == 7: - # XKBGrammar.g:1:46: T__31 - self.mT__31() + # XKBGrammar.g:1:46: T__32 + self.mT__32() elif alt6 == 8: - # XKBGrammar.g:1:52: T__32 - self.mT__32() + # XKBGrammar.g:1:52: T__33 + self.mT__33() elif alt6 == 9: - # XKBGrammar.g:1:58: T__33 - self.mT__33() + # XKBGrammar.g:1:58: T__34 + self.mT__34() elif alt6 == 10: - # XKBGrammar.g:1:64: T__34 - self.mT__34() + # XKBGrammar.g:1:64: T__35 + self.mT__35() elif alt6 == 11: - # XKBGrammar.g:1:70: T__35 - self.mT__35() + # XKBGrammar.g:1:70: T__36 + self.mT__36() elif alt6 == 12: - # XKBGrammar.g:1:76: T__36 - self.mT__36() + # XKBGrammar.g:1:76: T__37 + self.mT__37() elif alt6 == 13: - # XKBGrammar.g:1:82: T__37 - self.mT__37() + # XKBGrammar.g:1:82: T__38 + self.mT__38() elif alt6 == 14: - # XKBGrammar.g:1:88: T__38 - self.mT__38() + # XKBGrammar.g:1:88: T__39 + self.mT__39() elif alt6 == 15: - # XKBGrammar.g:1:94: T__39 - self.mT__39() + # XKBGrammar.g:1:94: T__40 + self.mT__40() elif alt6 == 16: - # XKBGrammar.g:1:100: T__40 - self.mT__40() + # XKBGrammar.g:1:100: T__41 + self.mT__41() elif alt6 == 17: - # XKBGrammar.g:1:106: T__41 - self.mT__41() + # XKBGrammar.g:1:106: T__42 + self.mT__42() elif alt6 == 18: - # XKBGrammar.g:1:112: T__42 - self.mT__42() + # XKBGrammar.g:1:112: T__43 + self.mT__43() elif alt6 == 19: - # XKBGrammar.g:1:118: T__43 - self.mT__43() + # XKBGrammar.g:1:118: T__44 + self.mT__44() elif alt6 == 20: - # XKBGrammar.g:1:124: T__44 - self.mT__44() + # XKBGrammar.g:1:124: T__45 + self.mT__45() elif alt6 == 21: - # XKBGrammar.g:1:130: T__45 - self.mT__45() + # XKBGrammar.g:1:130: T__46 + self.mT__46() elif alt6 == 22: - # XKBGrammar.g:1:136: T__46 - self.mT__46() + # XKBGrammar.g:1:136: T__47 + self.mT__47() elif alt6 == 23: - # XKBGrammar.g:1:142: T__47 - self.mT__47() + # XKBGrammar.g:1:142: T__48 + self.mT__48() elif alt6 == 24: - # XKBGrammar.g:1:148: T__48 - self.mT__48() + # XKBGrammar.g:1:148: T__49 + self.mT__49() elif alt6 == 25: - # XKBGrammar.g:1:154: T__49 - self.mT__49() + # XKBGrammar.g:1:154: T__50 + self.mT__50() elif alt6 == 26: - # XKBGrammar.g:1:160: T__50 - self.mT__50() + # XKBGrammar.g:1:160: T__51 + self.mT__51() elif alt6 == 27: - # XKBGrammar.g:1:166: T__51 - self.mT__51() + # XKBGrammar.g:1:166: T__52 + self.mT__52() elif alt6 == 28: - # XKBGrammar.g:1:172: T__52 - self.mT__52() + # XKBGrammar.g:1:172: T__53 + self.mT__53() elif alt6 == 29: - # XKBGrammar.g:1:178: T__53 - self.mT__53() + # XKBGrammar.g:1:178: T__54 + self.mT__54() elif alt6 == 30: - # XKBGrammar.g:1:184: NAME - self.mNAME() + # XKBGrammar.g:1:184: T__55 + self.mT__55() elif alt6 == 31: - # XKBGrammar.g:1:189: WS - self.mWS() + # XKBGrammar.g:1:190: NAME + self.mNAME() elif alt6 == 32: - # XKBGrammar.g:1:192: COMMENT - self.mCOMMENT() + # XKBGrammar.g:1:195: WS + self.mWS() elif alt6 == 33: - # XKBGrammar.g:1:200: LINE_COMMENT - self.mLINE_COMMENT() + # XKBGrammar.g:1:198: COMMENT + self.mCOMMENT() elif alt6 == 34: - # XKBGrammar.g:1:213: DQSTRING + # XKBGrammar.g:1:206: LINE_COMMENT + self.mLINE_COMMENT() + + + + elif alt6 == 35: + # XKBGrammar.g:1:219: DQSTRING self.mDQSTRING() @@ -1287,83 +1320,84 @@ class XKBGrammarLexer(Lexer): # lookup tables for DFA #6 DFA6_eot = DFA.unpack( - u"\1\27\3\uffff\2\27\3\uffff\2\27\3\uffff\11\27\4\uffff\15\27\2\uffff" - u"\2\27\1\73\14\27\1\114\2\uffff\11\27\1\126\1\127\1\130\1\131\1" - u"\132\1\133\1\27\1\uffff\7\27\1\144\1\27\6\uffff\3\27\1\151\4\27" - u"\1\uffff\1\27\1\157\1\27\1\161\1\uffff\1\162\3\27\1\166\1\uffff" - u"\1\27\2\uffff\3\27\1\uffff\15\27\1\u0089\1\u008a\3\27\2\uffff\1" - u"\u008e\2\27\1\uffff\3\27\1\u0094\1\27\1\uffff\1\u0096\1\uffff" + u"\1\30\3\uffff\2\30\3\uffff\2\30\3\uffff\12\30\4\uffff\16\30\2\uffff" + u"\2\30\1\76\15\30\1\120\2\uffff\1\30\1\122\10\30\1\133\1\134\1\135" + u"\1\136\1\137\1\140\1\30\1\uffff\1\30\1\uffff\6\30\1\151\1\30\6" + u"\uffff\3\30\1\156\4\30\1\uffff\1\30\1\164\1\30\1\166\1\uffff\1" + u"\167\3\30\1\173\1\uffff\1\30\2\uffff\3\30\1\uffff\15\30\1\u008e" + u"\1\u008f\3\30\2\uffff\1\u0093\2\30\1\uffff\3\30\1\u0099\1\30\1" + u"\uffff\1\u009b\1\uffff" ) DFA6_eof = DFA.unpack( - u"\u0097\uffff" + u"\u009c\uffff" ) DFA6_min = DFA.unpack( - u"\1\11\3\uffff\1\156\1\141\3\uffff\1\145\1\157\3\uffff\1\145\1\151" - u"\1\141\1\154\1\153\1\150\3\157\2\uffff\1\52\1\uffff\1\143\1\155" - u"\1\171\1\144\1\146\1\144\1\162\1\160\1\142\1\151\1\156\1\143\1" - u"\144\2\uffff\1\154\1\145\1\50\1\151\1\141\1\144\1\164\1\150\1\145" - u"\1\137\1\146\1\164\1\153\1\61\1\165\1\50\2\uffff\1\146\1\165\1" - u"\145\1\151\1\141\1\162\1\163\1\164\1\162\6\50\1\144\1\uffff\1\151" - u"\1\154\1\156\1\141\2\156\1\171\1\50\1\157\6\uffff\2\145\1\164\1" - u"\50\1\154\1\165\1\141\1\155\1\uffff\1\154\1\50\1\162\1\50\1\uffff" - u"\1\50\1\155\1\164\1\142\1\50\1\uffff\1\137\2\uffff\2\145\1\157" - u"\1\uffff\1\153\1\162\1\137\1\154\1\141\1\145\1\151\1\147\1\163" - u"\1\160\1\171\1\143\1\162\2\50\1\163\1\137\1\157\2\uffff\1\50\1" - u"\153\1\165\1\uffff\1\145\1\160\1\171\1\50\1\163\1\uffff\1\50\1" - u"\uffff" + u"\1\11\3\uffff\1\156\1\141\3\uffff\1\145\1\157\3\uffff\1\171\1\145" + u"\1\151\1\141\1\154\1\153\1\150\3\157\2\uffff\1\52\1\uffff\1\143" + u"\1\155\1\171\1\144\1\160\1\146\1\144\1\162\1\160\1\142\1\151\1" + u"\156\1\143\1\144\2\uffff\1\154\1\145\1\50\1\151\1\145\1\141\1\144" + u"\1\164\1\150\1\145\1\137\1\146\1\164\1\153\1\61\1\165\1\50\2\uffff" + u"\1\146\1\50\1\165\1\145\1\151\1\141\1\162\1\163\1\164\1\162\6\50" + u"\1\144\1\uffff\1\151\1\uffff\1\154\1\156\1\141\2\156\1\171\1\50" + u"\1\157\6\uffff\2\145\1\164\1\50\1\154\1\165\1\141\1\155\1\uffff" + u"\1\154\1\50\1\162\1\50\1\uffff\1\50\1\155\1\164\1\142\1\50\1\uffff" + u"\1\137\2\uffff\2\145\1\157\1\uffff\1\153\1\162\1\137\1\154\1\141" + u"\1\145\1\151\1\147\1\163\1\160\1\171\1\143\1\162\2\50\1\163\1\137" + u"\1\157\2\uffff\1\50\1\153\1\165\1\uffff\1\145\1\160\1\171\1\50" + u"\1\163\1\uffff\1\50\1\uffff" ) DFA6_max = DFA.unpack( - u"\1\175\3\uffff\1\156\1\141\3\uffff\1\145\1\157\3\uffff\1\145\1" - u"\151\1\141\1\154\1\153\1\150\3\157\2\uffff\1\57\1\uffff\1\143\1" - u"\155\1\171\1\144\1\146\1\144\1\162\1\164\1\142\1\151\1\156\1\143" - u"\1\144\2\uffff\1\154\1\145\1\172\1\151\1\141\1\144\1\164\1\150" - u"\1\145\1\137\1\146\1\164\1\153\1\65\1\165\1\172\2\uffff\1\146\1" - u"\165\1\145\1\151\1\141\1\162\1\163\1\164\1\162\6\172\1\144\1\uffff" - u"\1\151\1\154\1\156\1\141\2\156\1\171\1\172\1\157\6\uffff\2\145" - u"\1\164\1\172\1\154\1\165\1\141\1\155\1\uffff\1\154\1\172\1\162" - u"\1\172\1\uffff\1\172\1\155\1\164\1\142\1\172\1\uffff\1\137\2\uffff" - u"\2\145\1\157\1\uffff\1\155\1\162\1\137\1\154\1\141\1\145\1\151" - u"\1\147\1\163\1\160\1\171\1\143\1\162\2\172\1\163\1\137\1\157\2" - u"\uffff\1\172\1\153\1\165\1\uffff\1\145\1\160\1\171\1\172\1\163" - u"\1\uffff\1\172\1\uffff" + u"\1\175\3\uffff\1\156\1\141\3\uffff\1\145\1\157\3\uffff\1\171\1" + u"\145\1\151\1\141\1\154\1\153\1\150\3\157\2\uffff\1\57\1\uffff\1" + u"\143\1\155\1\171\1\144\1\160\1\146\1\144\1\162\1\164\1\142\1\151" + u"\1\156\1\143\1\144\2\uffff\1\154\1\145\1\172\1\151\1\145\1\141" + u"\1\144\1\164\1\150\1\145\1\137\1\146\1\164\1\153\1\65\1\165\1\172" + u"\2\uffff\1\146\1\172\1\165\1\145\1\151\1\141\1\162\1\163\1\164" + u"\1\162\6\172\1\144\1\uffff\1\151\1\uffff\1\154\1\156\1\141\2\156" + u"\1\171\1\172\1\157\6\uffff\2\145\1\164\1\172\1\154\1\165\1\141" + u"\1\155\1\uffff\1\154\1\172\1\162\1\172\1\uffff\1\172\1\155\1\164" + u"\1\142\1\172\1\uffff\1\137\2\uffff\2\145\1\157\1\uffff\1\155\1" + u"\162\1\137\1\154\1\141\1\145\1\151\1\147\1\163\1\160\1\171\1\143" + u"\1\162\2\172\1\163\1\137\1\157\2\uffff\1\172\1\153\1\165\1\uffff" + u"\1\145\1\160\1\171\1\172\1\163\1\uffff\1\172\1\uffff" ) DFA6_accept = DFA.unpack( u"\1\uffff\1\1\1\2\1\3\2\uffff\1\6\1\7\1\10\2\uffff\1\14\1\15\1\16" - u"\11\uffff\1\36\1\37\1\uffff\1\42\15\uffff\1\40\1\41\20\uffff\1" - u"\11\1\12\20\uffff\1\5\11\uffff\1\30\1\31\1\32\1\33\1\34\1\35\10" - u"\uffff\1\26\4\uffff\1\20\5\uffff\1\4\1\uffff\1\17\1\21\3\uffff" - u"\1\27\22\uffff\1\25\1\13\3\uffff\1\23\5\uffff\1\24\1\uffff\1\22" + u"\12\uffff\1\37\1\40\1\uffff\1\43\16\uffff\1\41\1\42\21\uffff\1" + u"\11\1\12\21\uffff\1\5\1\uffff\1\17\10\uffff\1\31\1\32\1\33\1\34" + u"\1\35\1\36\10\uffff\1\27\4\uffff\1\21\5\uffff\1\4\1\uffff\1\20" + u"\1\22\3\uffff\1\30\22\uffff\1\26\1\13\3\uffff\1\24\5\uffff\1\25" + u"\1\uffff\1\23" ) DFA6_special = DFA.unpack( - u"\u0097\uffff" + u"\u009c\uffff" ) DFA6_transition = [ - DFA.unpack(u"\2\30\1\uffff\2\30\22\uffff\1\30\1\uffff\1\32\11\uffff" - u"\1\13\2\uffff\1\31\13\uffff\1\3\1\14\1\10\1\15\4\uffff\1\24\10" - u"\uffff\1\25\1\26\5\uffff\1\23\7\uffff\1\6\1\uffff\1\7\3\uffff\1" - u"\21\2\uffff\1\16\3\uffff\1\17\1\4\1\uffff\1\11\1\uffff\1\12\1\5" - u"\1\uffff\1\20\7\uffff\1\22\2\uffff\1\1\1\uffff\1\2"), + DFA.unpack(u"\2\31\1\uffff\2\31\22\uffff\1\31\1\uffff\1\33\11\uffff" + u"\1\13\2\uffff\1\32\13\uffff\1\3\1\14\1\10\1\15\4\uffff\1\25\10" + u"\uffff\1\26\1\27\5\uffff\1\24\7\uffff\1\6\1\uffff\1\7\3\uffff\1" + u"\22\2\uffff\1\17\3\uffff\1\20\1\4\1\uffff\1\11\1\uffff\1\12\1\5" + u"\1\uffff\1\21\3\uffff\1\16\3\uffff\1\23\2\uffff\1\1\1\uffff\1\2"), DFA.unpack(u""), DFA.unpack(u""), DFA.unpack(u""), - DFA.unpack(u"\1\33"), DFA.unpack(u"\1\34"), + DFA.unpack(u"\1\35"), DFA.unpack(u""), DFA.unpack(u""), DFA.unpack(u""), - DFA.unpack(u"\1\35"), DFA.unpack(u"\1\36"), + DFA.unpack(u"\1\37"), DFA.unpack(u""), DFA.unpack(u""), DFA.unpack(u""), - DFA.unpack(u"\1\37"), DFA.unpack(u"\1\40"), DFA.unpack(u"\1\41"), DFA.unpack(u"\1\42"), @@ -1372,32 +1406,32 @@ class XKBGrammarLexer(Lexer): DFA.unpack(u"\1\45"), DFA.unpack(u"\1\46"), DFA.unpack(u"\1\47"), + DFA.unpack(u"\1\50"), + DFA.unpack(u"\1\51"), DFA.unpack(u""), DFA.unpack(u""), - DFA.unpack(u"\1\50\4\uffff\1\51"), + DFA.unpack(u"\1\52\4\uffff\1\53"), DFA.unpack(u""), - DFA.unpack(u"\1\52"), - DFA.unpack(u"\1\53"), DFA.unpack(u"\1\54"), DFA.unpack(u"\1\55"), DFA.unpack(u"\1\56"), DFA.unpack(u"\1\57"), DFA.unpack(u"\1\60"), - DFA.unpack(u"\1\61\3\uffff\1\62"), + DFA.unpack(u"\1\61"), + DFA.unpack(u"\1\62"), DFA.unpack(u"\1\63"), - DFA.unpack(u"\1\64"), - DFA.unpack(u"\1\65"), + DFA.unpack(u"\1\64\3\uffff\1\65"), DFA.unpack(u"\1\66"), DFA.unpack(u"\1\67"), - DFA.unpack(u""), - DFA.unpack(u""), DFA.unpack(u"\1\70"), DFA.unpack(u"\1\71"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\1\72\1\uffff\12\27\7" - u"\uffff\32\27\4\uffff\1\27\1\uffff\32\27"), + DFA.unpack(u"\1\72"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\73"), DFA.unpack(u"\1\74"), - DFA.unpack(u"\1\75"), - DFA.unpack(u"\1\76"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\1\75\1\uffff\12\30\7" + u"\uffff\32\30\4\uffff\1\30\1\uffff\32\30"), DFA.unpack(u"\1\77"), DFA.unpack(u"\1\100"), DFA.unpack(u"\1\101"), @@ -1405,89 +1439,91 @@ class XKBGrammarLexer(Lexer): DFA.unpack(u"\1\103"), DFA.unpack(u"\1\104"), DFA.unpack(u"\1\105"), - DFA.unpack(u"\1\106\1\107\1\110\1\111\1\112"), - DFA.unpack(u"\1\113"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), + DFA.unpack(u"\1\106"), + DFA.unpack(u"\1\107"), + DFA.unpack(u"\1\110"), + DFA.unpack(u"\1\111"), + DFA.unpack(u"\1\112\1\113\1\114\1\115\1\116"), + DFA.unpack(u"\1\117"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), DFA.unpack(u""), DFA.unpack(u""), - DFA.unpack(u"\1\115"), - DFA.unpack(u"\1\116"), - DFA.unpack(u"\1\117"), - DFA.unpack(u"\1\120"), DFA.unpack(u"\1\121"), - DFA.unpack(u"\1\122"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), DFA.unpack(u"\1\123"), DFA.unpack(u"\1\124"), DFA.unpack(u"\1\125"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u"\1\134"), - DFA.unpack(u""), - DFA.unpack(u"\1\135"), - DFA.unpack(u"\1\136"), - DFA.unpack(u"\1\137"), - DFA.unpack(u"\1\140"), + DFA.unpack(u"\1\126"), + DFA.unpack(u"\1\127"), + DFA.unpack(u"\1\130"), + DFA.unpack(u"\1\131"), + DFA.unpack(u"\1\132"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), DFA.unpack(u"\1\141"), + DFA.unpack(u""), DFA.unpack(u"\1\142"), + DFA.unpack(u""), DFA.unpack(u"\1\143"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), + DFA.unpack(u"\1\144"), DFA.unpack(u"\1\145"), + DFA.unpack(u"\1\146"), + DFA.unpack(u"\1\147"), + DFA.unpack(u"\1\150"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\1\152"), DFA.unpack(u""), DFA.unpack(u""), DFA.unpack(u""), DFA.unpack(u""), DFA.unpack(u""), DFA.unpack(u""), - DFA.unpack(u"\1\146"), - DFA.unpack(u"\1\147"), - DFA.unpack(u"\1\150"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u"\1\152"), DFA.unpack(u"\1\153"), DFA.unpack(u"\1\154"), DFA.unpack(u"\1\155"), - DFA.unpack(u""), - DFA.unpack(u"\1\156"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\1\157"), DFA.unpack(u"\1\160"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), + DFA.unpack(u"\1\161"), + DFA.unpack(u"\1\162"), DFA.unpack(u""), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), DFA.unpack(u"\1\163"), - DFA.unpack(u"\1\164"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), DFA.unpack(u"\1\165"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u""), - DFA.unpack(u"\1\167"), - DFA.unpack(u""), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), DFA.unpack(u""), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), DFA.unpack(u"\1\170"), DFA.unpack(u"\1\171"), DFA.unpack(u"\1\172"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u""), + DFA.unpack(u"\1\174"), + DFA.unpack(u""), DFA.unpack(u""), - DFA.unpack(u"\1\174\1\uffff\1\173"), DFA.unpack(u"\1\175"), DFA.unpack(u"\1\176"), DFA.unpack(u"\1\177"), - DFA.unpack(u"\1\u0080"), - DFA.unpack(u"\1\u0081"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0081\1\uffff\1\u0080"), DFA.unpack(u"\1\u0082"), DFA.unpack(u"\1\u0083"), DFA.unpack(u"\1\u0084"), @@ -1495,29 +1531,34 @@ class XKBGrammarLexer(Lexer): DFA.unpack(u"\1\u0086"), DFA.unpack(u"\1\u0087"), DFA.unpack(u"\1\u0088"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), + DFA.unpack(u"\1\u0089"), + DFA.unpack(u"\1\u008a"), DFA.unpack(u"\1\u008b"), DFA.unpack(u"\1\u008c"), DFA.unpack(u"\1\u008d"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), - DFA.unpack(u"\1\u008f"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), DFA.unpack(u"\1\u0090"), - DFA.unpack(u""), DFA.unpack(u"\1\u0091"), DFA.unpack(u"\1\u0092"), - DFA.unpack(u"\1\u0093"), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\1\u0094"), DFA.unpack(u"\1\u0095"), DFA.unpack(u""), - DFA.unpack(u"\2\27\1\uffff\1\27\1\uffff\1\27\2\uffff\12\27\7\uffff" - u"\32\27\4\uffff\1\27\1\uffff\32\27"), + DFA.unpack(u"\1\u0096"), + DFA.unpack(u"\1\u0097"), + DFA.unpack(u"\1\u0098"), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), + DFA.unpack(u"\1\u009a"), + DFA.unpack(u""), + DFA.unpack(u"\2\30\1\uffff\1\30\1\uffff\1\30\2\uffff\12\30\7\uffff" + u"\32\30\4\uffff\1\30\1\uffff\32\30"), DFA.unpack(u"") ] diff --git a/XKBGrammar/XKBGrammarLexer.pyc b/XKBGrammar/XKBGrammarLexer.pyc Binary files differ. diff --git a/XKBGrammar/XKBGrammarParser.py b/XKBGrammar/XKBGrammarParser.py @@ -1,4 +1,4 @@ -# $ANTLR 3.1b1 XKBGrammar.g 2008-05-20 20:25:38 +# $ANTLR 3.1b1 XKBGrammar.g 2008-05-20 21:54:24 import sys from antlr3 import * @@ -16,42 +16,44 @@ T__29=29 T__28=28 T__27=27 T__26=26 -T__25=25 -MAPOPTIONS=12 +MAPOPTIONS=13 TOKEN_INCLUDE=4 -TOKEN_MODIFIER_MAP=8 +TOKEN_MODIFIER_MAP=9 EOF=-1 -MAPTYPE=10 -NAME=21 +TOKEN_TYPE=8 +MAPTYPE=11 +T__55=55 +NAME=22 T__51=51 T__52=52 +MAPMATERIAL=14 T__53=53 -MAPMATERIAL=13 -KEYSYMS=17 -COMMENT=23 -DQSTRING=20 +T__54=54 +KEYSYMS=18 +COMMENT=24 +DQSTRING=21 T__50=50 T__42=42 T__43=43 -STATE=19 +STATE=20 T__40=40 T__41=41 T__46=46 T__47=47 T__44=44 +SECTION=15 T__45=45 -SECTION=14 -LINE_COMMENT=24 -KEYCODE=15 +LINE_COMMENT=25 +KEYCODE=16 T__48=48 T__49=49 TOKEN_NAME=6 -VALUE=18 -LAYOUT=9 +VALUE=19 +LAYOUT=10 T__30=30 T__31=31 T__32=32 -WS=22 +WS=23 T__33=33 T__34=34 T__35=35 @@ -60,21 +62,22 @@ T__37=37 T__38=38 T__39=39 TOKEN_KEY=7 -MAPNAME=11 +MAPNAME=12 TOKEN_KEY_TYPE=5 -KEYCODEX=16 +KEYCODEX=17 # token names tokenNames = [ "<invalid>", "<EOR>", "<DOWN>", "<UP>", - "TOKEN_INCLUDE", "TOKEN_KEY_TYPE", "TOKEN_NAME", "TOKEN_KEY", "TOKEN_MODIFIER_MAP", - "LAYOUT", "MAPTYPE", "MAPNAME", "MAPOPTIONS", "MAPMATERIAL", "SECTION", - "KEYCODE", "KEYCODEX", "KEYSYMS", "VALUE", "STATE", "DQSTRING", "NAME", - "WS", "COMMENT", "LINE_COMMENT", "'{'", "'}'", "';'", "'include'", "'name'", - "'['", "']'", "'='", "'key.type'", "'key'", "'modifier_map'", "','", - "'<'", "'>'", "'default'", "'hidden'", "'partial'", "'alphanumeric_keys'", - "'modifier_keys'", "'alternate_group'", "'xkb_symbols'", "'Shift'", - "'Control'", "'Lock'", "'Mod1'", "'Mod2'", "'Mod3'", "'Mod4'", "'Mod5'" + "TOKEN_INCLUDE", "TOKEN_KEY_TYPE", "TOKEN_NAME", "TOKEN_KEY", "TOKEN_TYPE", + "TOKEN_MODIFIER_MAP", "LAYOUT", "MAPTYPE", "MAPNAME", "MAPOPTIONS", + "MAPMATERIAL", "SECTION", "KEYCODE", "KEYCODEX", "KEYSYMS", "VALUE", + "STATE", "DQSTRING", "NAME", "WS", "COMMENT", "LINE_COMMENT", "'{'", + "'}'", "';'", "'include'", "'name'", "'['", "']'", "'='", "'key.type'", + "'key'", "'modifier_map'", "','", "'<'", "'>'", "'type'", "'default'", + "'hidden'", "'partial'", "'alphanumeric_keys'", "'modifier_keys'", "'alternate_group'", + "'xkb_symbols'", "'Shift'", "'Control'", "'Lock'", "'Mod1'", "'Mod2'", + "'Mod3'", "'Mod4'", "'Mod5'" ] @@ -114,7 +117,7 @@ class XKBGrammarParser(Parser): # $ANTLR start layout - # XKBGrammar.g:52:1: layout : ( section )+ EOF -> ^( LAYOUT ( section )+ ) ; + # XKBGrammar.g:53:1: layout : ( section )+ EOF -> ^( LAYOUT ( section )+ ) ; def layout(self, ): retval = self.layout_return() @@ -131,21 +134,21 @@ class XKBGrammarParser(Parser): stream_section = RewriteRuleSubtreeStream(self.adaptor, "rule section") try: try: - # XKBGrammar.g:53:2: ( ( section )+ EOF -> ^( LAYOUT ( section )+ ) ) - # XKBGrammar.g:53:4: ( section )+ EOF - # XKBGrammar.g:53:4: ( section )+ + # XKBGrammar.g:54:2: ( ( section )+ EOF -> ^( LAYOUT ( section )+ ) ) + # XKBGrammar.g:54:4: ( section )+ EOF + # XKBGrammar.g:54:4: ( section )+ cnt1 = 0 while True: #loop1 alt1 = 2 LA1_0 = self.input.LA(1) - if ((39 <= LA1_0 <= 45)) : + if ((41 <= LA1_0 <= 47)) : alt1 = 1 if alt1 == 1: - # XKBGrammar.g:53:4: section - self._state.following.append(self.FOLLOW_section_in_layout129) + # XKBGrammar.g:54:4: section + self._state.following.append(self.FOLLOW_section_in_layout133) section1 = self.section() self._state.following.pop() @@ -164,7 +167,7 @@ class XKBGrammarParser(Parser): EOF2 = self.input.LT(1) - self.match(self.input, EOF, self.FOLLOW_EOF_in_layout132) + self.match(self.input, EOF, self.FOLLOW_EOF_in_layout136) stream_EOF.add(EOF2) # AST Rewrite # elements: section @@ -182,12 +185,12 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 54:2: -> ^( LAYOUT ( section )+ ) - # XKBGrammar.g:54:5: ^( LAYOUT ( section )+ ) + # 55:2: -> ^( LAYOUT ( section )+ ) + # XKBGrammar.g:55:5: ^( LAYOUT ( section )+ ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(LAYOUT, "LAYOUT"), root_1) - # XKBGrammar.g:54:14: ( section )+ + # XKBGrammar.g:55:14: ( section )+ if not (stream_section.hasNext()): raise RewriteEarlyExitException() @@ -236,7 +239,7 @@ class XKBGrammarParser(Parser): # $ANTLR start section - # XKBGrammar.g:57:1: section : mapType '{' ( mapMaterial )+ '}' ';' -> ^( SECTION mapType ^( MAPMATERIAL ( mapMaterial )+ ) ) ; + # XKBGrammar.g:58:1: section : mapType '{' ( mapMaterial )+ '}' ';' -> ^( SECTION mapType ^( MAPMATERIAL ( mapMaterial )+ ) ) ; def section(self, ): retval = self.section_return() @@ -255,36 +258,36 @@ class XKBGrammarParser(Parser): char_literal4_tree = None char_literal6_tree = None char_literal7_tree = None - stream_25 = RewriteRuleTokenStream(self.adaptor, "token 25") stream_26 = RewriteRuleTokenStream(self.adaptor, "token 26") stream_27 = RewriteRuleTokenStream(self.adaptor, "token 27") + stream_28 = RewriteRuleTokenStream(self.adaptor, "token 28") stream_mapMaterial = RewriteRuleSubtreeStream(self.adaptor, "rule mapMaterial") stream_mapType = RewriteRuleSubtreeStream(self.adaptor, "rule mapType") try: try: - # XKBGrammar.g:58:2: ( mapType '{' ( mapMaterial )+ '}' ';' -> ^( SECTION mapType ^( MAPMATERIAL ( mapMaterial )+ ) ) ) - # XKBGrammar.g:58:4: mapType '{' ( mapMaterial )+ '}' ';' - self._state.following.append(self.FOLLOW_mapType_in_section155) + # XKBGrammar.g:59:2: ( mapType '{' ( mapMaterial )+ '}' ';' -> ^( SECTION mapType ^( MAPMATERIAL ( mapMaterial )+ ) ) ) + # XKBGrammar.g:59:4: mapType '{' ( mapMaterial )+ '}' ';' + self._state.following.append(self.FOLLOW_mapType_in_section159) mapType3 = self.mapType() self._state.following.pop() stream_mapType.add(mapType3.tree) char_literal4 = self.input.LT(1) - self.match(self.input, 25, self.FOLLOW_25_in_section157) - stream_25.add(char_literal4) - # XKBGrammar.g:58:16: ( mapMaterial )+ + self.match(self.input, 26, self.FOLLOW_26_in_section161) + stream_26.add(char_literal4) + # XKBGrammar.g:59:16: ( mapMaterial )+ cnt2 = 0 while True: #loop2 alt2 = 2 LA2_0 = self.input.LA(1) - if ((28 <= LA2_0 <= 29) or (33 <= LA2_0 <= 35)) : + if ((29 <= LA2_0 <= 30) or (34 <= LA2_0 <= 36)) : alt2 = 1 if alt2 == 1: - # XKBGrammar.g:58:16: mapMaterial - self._state.following.append(self.FOLLOW_mapMaterial_in_section159) + # XKBGrammar.g:59:16: mapMaterial + self._state.following.append(self.FOLLOW_mapMaterial_in_section163) mapMaterial5 = self.mapMaterial() self._state.following.pop() @@ -303,11 +306,11 @@ class XKBGrammarParser(Parser): char_literal6 = self.input.LT(1) - self.match(self.input, 26, self.FOLLOW_26_in_section162) - stream_26.add(char_literal6) + self.match(self.input, 27, self.FOLLOW_27_in_section166) + stream_27.add(char_literal6) char_literal7 = self.input.LT(1) - self.match(self.input, 27, self.FOLLOW_27_in_section164) - stream_27.add(char_literal7) + self.match(self.input, 28, self.FOLLOW_28_in_section168) + stream_28.add(char_literal7) # AST Rewrite # elements: mapMaterial, mapType # token labels: @@ -324,17 +327,17 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 59:2: -> ^( SECTION mapType ^( MAPMATERIAL ( mapMaterial )+ ) ) - # XKBGrammar.g:59:5: ^( SECTION mapType ^( MAPMATERIAL ( mapMaterial )+ ) ) + # 60:2: -> ^( SECTION mapType ^( MAPMATERIAL ( mapMaterial )+ ) ) + # XKBGrammar.g:60:5: ^( SECTION mapType ^( MAPMATERIAL ( mapMaterial )+ ) ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(SECTION, "SECTION"), root_1) self.adaptor.addChild(root_1, stream_mapType.nextTree()) - # XKBGrammar.g:59:23: ^( MAPMATERIAL ( mapMaterial )+ ) + # XKBGrammar.g:60:23: ^( MAPMATERIAL ( mapMaterial )+ ) root_2 = self.adaptor.nil() root_2 = self.adaptor.becomeRoot(self.adaptor.createFromType(MAPMATERIAL, "MAPMATERIAL"), root_2) - # XKBGrammar.g:59:37: ( mapMaterial )+ + # XKBGrammar.g:60:37: ( mapMaterial )+ if not (stream_mapMaterial.hasNext()): raise RewriteEarlyExitException() @@ -385,7 +388,7 @@ class XKBGrammarParser(Parser): # $ANTLR start mapType - # XKBGrammar.g:62:1: mapType : ( mapOptions )+ DQSTRING -> ^( MAPTYPE ^( MAPOPTIONS ( mapOptions )+ ) ^( MAPNAME DQSTRING ) ) ; + # XKBGrammar.g:63:1: mapType : ( mapOptions )+ DQSTRING -> ^( MAPTYPE ^( MAPOPTIONS ( mapOptions )+ ) ^( MAPNAME DQSTRING ) ) ; def mapType(self, ): retval = self.mapType_return() @@ -402,21 +405,21 @@ class XKBGrammarParser(Parser): stream_mapOptions = RewriteRuleSubtreeStream(self.adaptor, "rule mapOptions") try: try: - # XKBGrammar.g:63:2: ( ( mapOptions )+ DQSTRING -> ^( MAPTYPE ^( MAPOPTIONS ( mapOptions )+ ) ^( MAPNAME DQSTRING ) ) ) - # XKBGrammar.g:63:4: ( mapOptions )+ DQSTRING - # XKBGrammar.g:63:4: ( mapOptions )+ + # XKBGrammar.g:64:2: ( ( mapOptions )+ DQSTRING -> ^( MAPTYPE ^( MAPOPTIONS ( mapOptions )+ ) ^( MAPNAME DQSTRING ) ) ) + # XKBGrammar.g:64:4: ( mapOptions )+ DQSTRING + # XKBGrammar.g:64:4: ( mapOptions )+ cnt3 = 0 while True: #loop3 alt3 = 2 LA3_0 = self.input.LA(1) - if ((39 <= LA3_0 <= 45)) : + if ((41 <= LA3_0 <= 47)) : alt3 = 1 if alt3 == 1: - # XKBGrammar.g:63:4: mapOptions - self._state.following.append(self.FOLLOW_mapOptions_in_mapType192) + # XKBGrammar.g:64:4: mapOptions + self._state.following.append(self.FOLLOW_mapOptions_in_mapType196) mapOptions8 = self.mapOptions() self._state.following.pop() @@ -435,7 +438,7 @@ class XKBGrammarParser(Parser): DQSTRING9 = self.input.LT(1) - self.match(self.input, DQSTRING, self.FOLLOW_DQSTRING_in_mapType195) + self.match(self.input, DQSTRING, self.FOLLOW_DQSTRING_in_mapType199) stream_DQSTRING.add(DQSTRING9) # AST Rewrite # elements: DQSTRING, mapOptions @@ -453,16 +456,16 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 64:2: -> ^( MAPTYPE ^( MAPOPTIONS ( mapOptions )+ ) ^( MAPNAME DQSTRING ) ) - # XKBGrammar.g:64:5: ^( MAPTYPE ^( MAPOPTIONS ( mapOptions )+ ) ^( MAPNAME DQSTRING ) ) + # 65:2: -> ^( MAPTYPE ^( MAPOPTIONS ( mapOptions )+ ) ^( MAPNAME DQSTRING ) ) + # XKBGrammar.g:65:5: ^( MAPTYPE ^( MAPOPTIONS ( mapOptions )+ ) ^( MAPNAME DQSTRING ) ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(MAPTYPE, "MAPTYPE"), root_1) - # XKBGrammar.g:64:15: ^( MAPOPTIONS ( mapOptions )+ ) + # XKBGrammar.g:65:15: ^( MAPOPTIONS ( mapOptions )+ ) root_2 = self.adaptor.nil() root_2 = self.adaptor.becomeRoot(self.adaptor.createFromType(MAPOPTIONS, "MAPOPTIONS"), root_2) - # XKBGrammar.g:64:28: ( mapOptions )+ + # XKBGrammar.g:65:28: ( mapOptions )+ if not (stream_mapOptions.hasNext()): raise RewriteEarlyExitException() @@ -473,7 +476,7 @@ class XKBGrammarParser(Parser): stream_mapOptions.reset() self.adaptor.addChild(root_1, root_2) - # XKBGrammar.g:64:41: ^( MAPNAME DQSTRING ) + # XKBGrammar.g:65:41: ^( MAPNAME DQSTRING ) root_2 = self.adaptor.nil() root_2 = self.adaptor.becomeRoot(self.adaptor.createFromType(MAPNAME, "MAPNAME"), root_2) @@ -520,7 +523,7 @@ class XKBGrammarParser(Parser): # $ANTLR start mapMaterial - # XKBGrammar.g:67:1: mapMaterial : ( line_include | line_name ';' | line_keytype ';' | line_key ';' | line_modifier_map ';' ); + # XKBGrammar.g:68:1: mapMaterial : ( line_include | line_name ';' | line_keytype ';' | line_key ';' | line_modifier_map ';' ); def mapMaterial(self, ): retval = self.mapMaterial_return() @@ -550,18 +553,18 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:68:2: ( line_include | line_name ';' | line_keytype ';' | line_key ';' | line_modifier_map ';' ) + # XKBGrammar.g:69:2: ( line_include | line_name ';' | line_keytype ';' | line_key ';' | line_modifier_map ';' ) alt4 = 5 LA4 = self.input.LA(1) - if LA4 == 28: + if LA4 == 29: alt4 = 1 - elif LA4 == 29: + elif LA4 == 30: alt4 = 2 - elif LA4 == 33: - alt4 = 3 elif LA4 == 34: - alt4 = 4 + alt4 = 3 elif LA4 == 35: + alt4 = 4 + elif LA4 == 36: alt4 = 5 else: nvae = NoViableAltException("", 4, 0, self.input) @@ -569,10 +572,10 @@ class XKBGrammarParser(Parser): raise nvae if alt4 == 1: - # XKBGrammar.g:68:4: line_include + # XKBGrammar.g:69:4: line_include root_0 = self.adaptor.nil() - self._state.following.append(self.FOLLOW_line_include_in_mapMaterial227) + self._state.following.append(self.FOLLOW_line_include_in_mapMaterial231) line_include10 = self.line_include() self._state.following.pop() @@ -581,58 +584,58 @@ class XKBGrammarParser(Parser): elif alt4 == 2: - # XKBGrammar.g:69:4: line_name ';' + # XKBGrammar.g:70:4: line_name ';' root_0 = self.adaptor.nil() - self._state.following.append(self.FOLLOW_line_name_in_mapMaterial233) + self._state.following.append(self.FOLLOW_line_name_in_mapMaterial237) line_name11 = self.line_name() self._state.following.pop() self.adaptor.addChild(root_0, line_name11.tree) char_literal12 = self.input.LT(1) - self.match(self.input, 27, self.FOLLOW_27_in_mapMaterial235) + self.match(self.input, 28, self.FOLLOW_28_in_mapMaterial239) elif alt4 == 3: - # XKBGrammar.g:70:4: line_keytype ';' + # XKBGrammar.g:71:4: line_keytype ';' root_0 = self.adaptor.nil() - self._state.following.append(self.FOLLOW_line_keytype_in_mapMaterial241) + self._state.following.append(self.FOLLOW_line_keytype_in_mapMaterial245) line_keytype13 = self.line_keytype() self._state.following.pop() self.adaptor.addChild(root_0, line_keytype13.tree) char_literal14 = self.input.LT(1) - self.match(self.input, 27, self.FOLLOW_27_in_mapMaterial243) + self.match(self.input, 28, self.FOLLOW_28_in_mapMaterial247) elif alt4 == 4: - # XKBGrammar.g:71:4: line_key ';' + # XKBGrammar.g:72:4: line_key ';' root_0 = self.adaptor.nil() - self._state.following.append(self.FOLLOW_line_key_in_mapMaterial249) + self._state.following.append(self.FOLLOW_line_key_in_mapMaterial253) line_key15 = self.line_key() self._state.following.pop() self.adaptor.addChild(root_0, line_key15.tree) char_literal16 = self.input.LT(1) - self.match(self.input, 27, self.FOLLOW_27_in_mapMaterial251) + self.match(self.input, 28, self.FOLLOW_28_in_mapMaterial255) elif alt4 == 5: - # XKBGrammar.g:72:4: line_modifier_map ';' + # XKBGrammar.g:73:4: line_modifier_map ';' root_0 = self.adaptor.nil() - self._state.following.append(self.FOLLOW_line_modifier_map_in_mapMaterial257) + self._state.following.append(self.FOLLOW_line_modifier_map_in_mapMaterial261) line_modifier_map17 = self.line_modifier_map() self._state.following.pop() self.adaptor.addChild(root_0, line_modifier_map17.tree) char_literal18 = self.input.LT(1) - self.match(self.input, 27, self.FOLLOW_27_in_mapMaterial259) + self.match(self.input, 28, self.FOLLOW_28_in_mapMaterial263) @@ -666,7 +669,7 @@ class XKBGrammarParser(Parser): # $ANTLR start line_include - # XKBGrammar.g:75:1: line_include : 'include' DQSTRING -> ^( TOKEN_INCLUDE DQSTRING ) ; + # XKBGrammar.g:76:1: line_include : 'include' DQSTRING -> ^( TOKEN_INCLUDE DQSTRING ) ; def line_include(self, ): retval = self.line_include_return() @@ -680,17 +683,17 @@ class XKBGrammarParser(Parser): string_literal19_tree = None DQSTRING20_tree = None stream_DQSTRING = RewriteRuleTokenStream(self.adaptor, "token DQSTRING") - stream_28 = RewriteRuleTokenStream(self.adaptor, "token 28") + stream_29 = RewriteRuleTokenStream(self.adaptor, "token 29") try: try: - # XKBGrammar.g:76:2: ( 'include' DQSTRING -> ^( TOKEN_INCLUDE DQSTRING ) ) - # XKBGrammar.g:76:4: 'include' DQSTRING + # XKBGrammar.g:77:2: ( 'include' DQSTRING -> ^( TOKEN_INCLUDE DQSTRING ) ) + # XKBGrammar.g:77:4: 'include' DQSTRING string_literal19 = self.input.LT(1) - self.match(self.input, 28, self.FOLLOW_28_in_line_include271) - stream_28.add(string_literal19) + self.match(self.input, 29, self.FOLLOW_29_in_line_include275) + stream_29.add(string_literal19) DQSTRING20 = self.input.LT(1) - self.match(self.input, DQSTRING, self.FOLLOW_DQSTRING_in_line_include273) + self.match(self.input, DQSTRING, self.FOLLOW_DQSTRING_in_line_include277) stream_DQSTRING.add(DQSTRING20) # AST Rewrite # elements: DQSTRING @@ -708,8 +711,8 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 77:2: -> ^( TOKEN_INCLUDE DQSTRING ) - # XKBGrammar.g:77:5: ^( TOKEN_INCLUDE DQSTRING ) + # 78:2: -> ^( TOKEN_INCLUDE DQSTRING ) + # XKBGrammar.g:78:5: ^( TOKEN_INCLUDE DQSTRING ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(TOKEN_INCLUDE, "TOKEN_INCLUDE"), root_1) @@ -754,7 +757,7 @@ class XKBGrammarParser(Parser): # $ANTLR start line_name - # XKBGrammar.g:80:1: line_name : 'name' '[' n1= NAME ']' '=' n2= DQSTRING -> ^( TOKEN_NAME $n1 ^( VALUE $n2) ) ; + # XKBGrammar.g:81:1: line_name : 'name' '[' n1= NAME ']' '=' n2= DQSTRING -> ^( TOKEN_NAME $n1 ^( VALUE $n2) ) ; def line_name(self, ): retval = self.line_name_return() @@ -780,29 +783,29 @@ class XKBGrammarParser(Parser): stream_32 = RewriteRuleTokenStream(self.adaptor, "token 32") stream_31 = RewriteRuleTokenStream(self.adaptor, "token 31") stream_DQSTRING = RewriteRuleTokenStream(self.adaptor, "token DQSTRING") - stream_29 = RewriteRuleTokenStream(self.adaptor, "token 29") + stream_33 = RewriteRuleTokenStream(self.adaptor, "token 33") try: try: - # XKBGrammar.g:81:2: ( 'name' '[' n1= NAME ']' '=' n2= DQSTRING -> ^( TOKEN_NAME $n1 ^( VALUE $n2) ) ) - # XKBGrammar.g:81:4: 'name' '[' n1= NAME ']' '=' n2= DQSTRING + # XKBGrammar.g:82:2: ( 'name' '[' n1= NAME ']' '=' n2= DQSTRING -> ^( TOKEN_NAME $n1 ^( VALUE $n2) ) ) + # XKBGrammar.g:82:4: 'name' '[' n1= NAME ']' '=' n2= DQSTRING string_literal21 = self.input.LT(1) - self.match(self.input, 29, self.FOLLOW_29_in_line_name293) - stream_29.add(string_literal21) + self.match(self.input, 30, self.FOLLOW_30_in_line_name297) + stream_30.add(string_literal21) char_literal22 = self.input.LT(1) - self.match(self.input, 30, self.FOLLOW_30_in_line_name295) - stream_30.add(char_literal22) + self.match(self.input, 31, self.FOLLOW_31_in_line_name299) + stream_31.add(char_literal22) n1 = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_line_name299) + self.match(self.input, NAME, self.FOLLOW_NAME_in_line_name303) stream_NAME.add(n1) char_literal23 = self.input.LT(1) - self.match(self.input, 31, self.FOLLOW_31_in_line_name301) - stream_31.add(char_literal23) + self.match(self.input, 32, self.FOLLOW_32_in_line_name305) + stream_32.add(char_literal23) char_literal24 = self.input.LT(1) - self.match(self.input, 32, self.FOLLOW_32_in_line_name303) - stream_32.add(char_literal24) + self.match(self.input, 33, self.FOLLOW_33_in_line_name307) + stream_33.add(char_literal24) n2 = self.input.LT(1) - self.match(self.input, DQSTRING, self.FOLLOW_DQSTRING_in_line_name307) + self.match(self.input, DQSTRING, self.FOLLOW_DQSTRING_in_line_name311) stream_DQSTRING.add(n2) # AST Rewrite # elements: n2, n1 @@ -822,13 +825,13 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 82:2: -> ^( TOKEN_NAME $n1 ^( VALUE $n2) ) - # XKBGrammar.g:82:5: ^( TOKEN_NAME $n1 ^( VALUE $n2) ) + # 83:2: -> ^( TOKEN_NAME $n1 ^( VALUE $n2) ) + # XKBGrammar.g:83:5: ^( TOKEN_NAME $n1 ^( VALUE $n2) ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(TOKEN_NAME, "TOKEN_NAME"), root_1) self.adaptor.addChild(root_1, stream_n1.nextNode()) - # XKBGrammar.g:82:22: ^( VALUE $n2) + # XKBGrammar.g:83:22: ^( VALUE $n2) root_2 = self.adaptor.nil() root_2 = self.adaptor.becomeRoot(self.adaptor.createFromType(VALUE, "VALUE"), root_2) @@ -875,7 +878,7 @@ class XKBGrammarParser(Parser): # $ANTLR start line_keytype - # XKBGrammar.g:85:1: line_keytype : 'key.type' '[' n1= NAME ']' '=' n2= DQSTRING -> ^( TOKEN_KEY_TYPE $n1 ^( VALUE $n2) ) ; + # XKBGrammar.g:86:1: line_keytype : 'key.type' '[' n1= NAME ']' '=' n2= DQSTRING -> ^( TOKEN_KEY_TYPE $n1 ^( VALUE $n2) ) ; def line_keytype(self, ): retval = self.line_keytype_return() @@ -897,33 +900,33 @@ class XKBGrammarParser(Parser): char_literal27_tree = None char_literal28_tree = None stream_NAME = RewriteRuleTokenStream(self.adaptor, "token NAME") - stream_30 = RewriteRuleTokenStream(self.adaptor, "token 30") stream_32 = RewriteRuleTokenStream(self.adaptor, "token 32") stream_31 = RewriteRuleTokenStream(self.adaptor, "token 31") stream_DQSTRING = RewriteRuleTokenStream(self.adaptor, "token DQSTRING") stream_33 = RewriteRuleTokenStream(self.adaptor, "token 33") + stream_34 = RewriteRuleTokenStream(self.adaptor, "token 34") try: try: - # XKBGrammar.g:86:2: ( 'key.type' '[' n1= NAME ']' '=' n2= DQSTRING -> ^( TOKEN_KEY_TYPE $n1 ^( VALUE $n2) ) ) - # XKBGrammar.g:86:4: 'key.type' '[' n1= NAME ']' '=' n2= DQSTRING + # XKBGrammar.g:87:2: ( 'key.type' '[' n1= NAME ']' '=' n2= DQSTRING -> ^( TOKEN_KEY_TYPE $n1 ^( VALUE $n2) ) ) + # XKBGrammar.g:87:4: 'key.type' '[' n1= NAME ']' '=' n2= DQSTRING string_literal25 = self.input.LT(1) - self.match(self.input, 33, self.FOLLOW_33_in_line_keytype335) - stream_33.add(string_literal25) + self.match(self.input, 34, self.FOLLOW_34_in_line_keytype339) + stream_34.add(string_literal25) char_literal26 = self.input.LT(1) - self.match(self.input, 30, self.FOLLOW_30_in_line_keytype337) - stream_30.add(char_literal26) + self.match(self.input, 31, self.FOLLOW_31_in_line_keytype341) + stream_31.add(char_literal26) n1 = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_line_keytype341) + self.match(self.input, NAME, self.FOLLOW_NAME_in_line_keytype345) stream_NAME.add(n1) char_literal27 = self.input.LT(1) - self.match(self.input, 31, self.FOLLOW_31_in_line_keytype343) - stream_31.add(char_literal27) + self.match(self.input, 32, self.FOLLOW_32_in_line_keytype347) + stream_32.add(char_literal27) char_literal28 = self.input.LT(1) - self.match(self.input, 32, self.FOLLOW_32_in_line_keytype345) - stream_32.add(char_literal28) + self.match(self.input, 33, self.FOLLOW_33_in_line_keytype349) + stream_33.add(char_literal28) n2 = self.input.LT(1) - self.match(self.input, DQSTRING, self.FOLLOW_DQSTRING_in_line_keytype349) + self.match(self.input, DQSTRING, self.FOLLOW_DQSTRING_in_line_keytype353) stream_DQSTRING.add(n2) # AST Rewrite # elements: n1, n2 @@ -943,13 +946,13 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 87:2: -> ^( TOKEN_KEY_TYPE $n1 ^( VALUE $n2) ) - # XKBGrammar.g:87:5: ^( TOKEN_KEY_TYPE $n1 ^( VALUE $n2) ) + # 88:2: -> ^( TOKEN_KEY_TYPE $n1 ^( VALUE $n2) ) + # XKBGrammar.g:88:5: ^( TOKEN_KEY_TYPE $n1 ^( VALUE $n2) ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(TOKEN_KEY_TYPE, "TOKEN_KEY_TYPE"), root_1) self.adaptor.addChild(root_1, stream_n1.nextNode()) - # XKBGrammar.g:87:26: ^( VALUE $n2) + # XKBGrammar.g:88:26: ^( VALUE $n2) root_2 = self.adaptor.nil() root_2 = self.adaptor.becomeRoot(self.adaptor.createFromType(VALUE, "VALUE"), root_2) @@ -996,7 +999,7 @@ class XKBGrammarParser(Parser): # $ANTLR start line_key - # XKBGrammar.g:90:1: line_key : 'key' keycode keysyms -> ^( TOKEN_KEY keycode keysyms ) ; + # XKBGrammar.g:91:1: line_key : 'key' keycode keysyms -> ^( TOKEN_KEY keycode keysyms ) ; def line_key(self, ): retval = self.line_key_return() @@ -1011,22 +1014,22 @@ class XKBGrammarParser(Parser): string_literal29_tree = None - stream_34 = RewriteRuleTokenStream(self.adaptor, "token 34") + stream_35 = RewriteRuleTokenStream(self.adaptor, "token 35") stream_keysyms = RewriteRuleSubtreeStream(self.adaptor, "rule keysyms") stream_keycode = RewriteRuleSubtreeStream(self.adaptor, "rule keycode") try: try: - # XKBGrammar.g:91:2: ( 'key' keycode keysyms -> ^( TOKEN_KEY keycode keysyms ) ) - # XKBGrammar.g:91:4: 'key' keycode keysyms + # XKBGrammar.g:92:2: ( 'key' keycode keysyms -> ^( TOKEN_KEY keycode keysyms ) ) + # XKBGrammar.g:92:4: 'key' keycode keysyms string_literal29 = self.input.LT(1) - self.match(self.input, 34, self.FOLLOW_34_in_line_key378) - stream_34.add(string_literal29) - self._state.following.append(self.FOLLOW_keycode_in_line_key380) + self.match(self.input, 35, self.FOLLOW_35_in_line_key381) + stream_35.add(string_literal29) + self._state.following.append(self.FOLLOW_keycode_in_line_key383) keycode30 = self.keycode() self._state.following.pop() stream_keycode.add(keycode30.tree) - self._state.following.append(self.FOLLOW_keysyms_in_line_key382) + self._state.following.append(self.FOLLOW_keysyms_in_line_key385) keysyms31 = self.keysyms() self._state.following.pop() @@ -1047,8 +1050,8 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 92:2: -> ^( TOKEN_KEY keycode keysyms ) - # XKBGrammar.g:92:5: ^( TOKEN_KEY keycode keysyms ) + # 93:2: -> ^( TOKEN_KEY keycode keysyms ) + # XKBGrammar.g:93:5: ^( TOKEN_KEY keycode keysyms ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(TOKEN_KEY, "TOKEN_KEY"), root_1) @@ -1094,7 +1097,7 @@ class XKBGrammarParser(Parser): # $ANTLR start line_modifier_map - # XKBGrammar.g:95:1: line_modifier_map : 'modifier_map' state '{' keycode ( ',' keycode )* '}' -> ^( TOKEN_MODIFIER_MAP state ( keycode )+ ) ; + # XKBGrammar.g:96:1: line_modifier_map : 'modifier_map' state '{' keycode ( ',' keycode )* '}' -> ^( TOKEN_MODIFIER_MAP state ( keycode )+ ) ; def line_modifier_map(self, ): retval = self.line_modifier_map_return() @@ -1117,47 +1120,47 @@ class XKBGrammarParser(Parser): char_literal34_tree = None char_literal36_tree = None char_literal38_tree = None - stream_35 = RewriteRuleTokenStream(self.adaptor, "token 35") stream_36 = RewriteRuleTokenStream(self.adaptor, "token 36") - stream_25 = RewriteRuleTokenStream(self.adaptor, "token 25") stream_26 = RewriteRuleTokenStream(self.adaptor, "token 26") + stream_27 = RewriteRuleTokenStream(self.adaptor, "token 27") + stream_37 = RewriteRuleTokenStream(self.adaptor, "token 37") stream_state = RewriteRuleSubtreeStream(self.adaptor, "rule state") stream_keycode = RewriteRuleSubtreeStream(self.adaptor, "rule keycode") try: try: - # XKBGrammar.g:96:2: ( 'modifier_map' state '{' keycode ( ',' keycode )* '}' -> ^( TOKEN_MODIFIER_MAP state ( keycode )+ ) ) - # XKBGrammar.g:96:4: 'modifier_map' state '{' keycode ( ',' keycode )* '}' + # XKBGrammar.g:97:2: ( 'modifier_map' state '{' keycode ( ',' keycode )* '}' -> ^( TOKEN_MODIFIER_MAP state ( keycode )+ ) ) + # XKBGrammar.g:97:4: 'modifier_map' state '{' keycode ( ',' keycode )* '}' string_literal32 = self.input.LT(1) - self.match(self.input, 35, self.FOLLOW_35_in_line_modifier_map404) - stream_35.add(string_literal32) - self._state.following.append(self.FOLLOW_state_in_line_modifier_map406) + self.match(self.input, 36, self.FOLLOW_36_in_line_modifier_map407) + stream_36.add(string_literal32) + self._state.following.append(self.FOLLOW_state_in_line_modifier_map409) state33 = self.state() self._state.following.pop() stream_state.add(state33.tree) char_literal34 = self.input.LT(1) - self.match(self.input, 25, self.FOLLOW_25_in_line_modifier_map408) - stream_25.add(char_literal34) - self._state.following.append(self.FOLLOW_keycode_in_line_modifier_map410) + self.match(self.input, 26, self.FOLLOW_26_in_line_modifier_map411) + stream_26.add(char_literal34) + self._state.following.append(self.FOLLOW_keycode_in_line_modifier_map413) keycode35 = self.keycode() self._state.following.pop() stream_keycode.add(keycode35.tree) - # XKBGrammar.g:96:37: ( ',' keycode )* + # XKBGrammar.g:97:37: ( ',' keycode )* while True: #loop5 alt5 = 2 LA5_0 = self.input.LA(1) - if (LA5_0 == 36) : + if (LA5_0 == 37) : alt5 = 1 if alt5 == 1: - # XKBGrammar.g:96:38: ',' keycode + # XKBGrammar.g:97:38: ',' keycode char_literal36 = self.input.LT(1) - self.match(self.input, 36, self.FOLLOW_36_in_line_modifier_map413) - stream_36.add(char_literal36) - self._state.following.append(self.FOLLOW_keycode_in_line_modifier_map415) + self.match(self.input, 37, self.FOLLOW_37_in_line_modifier_map416) + stream_37.add(char_literal36) + self._state.following.append(self.FOLLOW_keycode_in_line_modifier_map418) keycode37 = self.keycode() self._state.following.pop() @@ -1170,8 +1173,8 @@ class XKBGrammarParser(Parser): char_literal38 = self.input.LT(1) - self.match(self.input, 26, self.FOLLOW_26_in_line_modifier_map419) - stream_26.add(char_literal38) + self.match(self.input, 27, self.FOLLOW_27_in_line_modifier_map422) + stream_27.add(char_literal38) # AST Rewrite # elements: state, keycode # token labels: @@ -1188,13 +1191,13 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 97:2: -> ^( TOKEN_MODIFIER_MAP state ( keycode )+ ) - # XKBGrammar.g:97:5: ^( TOKEN_MODIFIER_MAP state ( keycode )+ ) + # 98:2: -> ^( TOKEN_MODIFIER_MAP state ( keycode )+ ) + # XKBGrammar.g:98:5: ^( TOKEN_MODIFIER_MAP state ( keycode )+ ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(TOKEN_MODIFIER_MAP, "TOKEN_MODIFIER_MAP"), root_1) self.adaptor.addChild(root_1, stream_state.nextTree()) - # XKBGrammar.g:97:32: ( keycode )+ + # XKBGrammar.g:98:32: ( keycode )+ if not (stream_keycode.hasNext()): raise RewriteEarlyExitException() @@ -1243,7 +1246,7 @@ class XKBGrammarParser(Parser): # $ANTLR start keycode - # XKBGrammar.g:104:1: keycode : ( NAME -> ^( KEYCODE NAME ) | '<' NAME '>' -> ^( KEYCODEX NAME ) ); + # XKBGrammar.g:101:1: keycode : ( NAME -> ^( KEYCODE NAME ) | '<' NAME '>' -> ^( KEYCODEX NAME ) ); def keycode(self, ): retval = self.keycode_return() @@ -1261,18 +1264,18 @@ class XKBGrammarParser(Parser): NAME41_tree = None char_literal42_tree = None stream_NAME = RewriteRuleTokenStream(self.adaptor, "token NAME") - stream_37 = RewriteRuleTokenStream(self.adaptor, "token 37") + stream_39 = RewriteRuleTokenStream(self.adaptor, "token 39") stream_38 = RewriteRuleTokenStream(self.adaptor, "token 38") try: try: - # XKBGrammar.g:105:2: ( NAME -> ^( KEYCODE NAME ) | '<' NAME '>' -> ^( KEYCODEX NAME ) ) + # XKBGrammar.g:102:2: ( NAME -> ^( KEYCODE NAME ) | '<' NAME '>' -> ^( KEYCODEX NAME ) ) alt6 = 2 LA6_0 = self.input.LA(1) if (LA6_0 == NAME) : alt6 = 1 - elif (LA6_0 == 37) : + elif (LA6_0 == 38) : alt6 = 2 else: nvae = NoViableAltException("", 6, 0, self.input) @@ -1280,9 +1283,9 @@ class XKBGrammarParser(Parser): raise nvae if alt6 == 1: - # XKBGrammar.g:105:4: NAME + # XKBGrammar.g:102:4: NAME NAME39 = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_keycode447) + self.match(self.input, NAME, self.FOLLOW_NAME_in_keycode446) stream_NAME.add(NAME39) # AST Rewrite # elements: NAME @@ -1300,8 +1303,8 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 105:9: -> ^( KEYCODE NAME ) - # XKBGrammar.g:105:12: ^( KEYCODE NAME ) + # 102:9: -> ^( KEYCODE NAME ) + # XKBGrammar.g:102:12: ^( KEYCODE NAME ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(KEYCODE, "KEYCODE"), root_1) @@ -1316,16 +1319,16 @@ class XKBGrammarParser(Parser): elif alt6 == 2: - # XKBGrammar.g:106:4: '<' NAME '>' + # XKBGrammar.g:103:4: '<' NAME '>' char_literal40 = self.input.LT(1) - self.match(self.input, 37, self.FOLLOW_37_in_keycode460) - stream_37.add(char_literal40) + self.match(self.input, 38, self.FOLLOW_38_in_keycode459) + stream_38.add(char_literal40) NAME41 = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_keycode462) + self.match(self.input, NAME, self.FOLLOW_NAME_in_keycode461) stream_NAME.add(NAME41) char_literal42 = self.input.LT(1) - self.match(self.input, 38, self.FOLLOW_38_in_keycode464) - stream_38.add(char_literal42) + self.match(self.input, 39, self.FOLLOW_39_in_keycode463) + stream_39.add(char_literal42) # AST Rewrite # elements: NAME # token labels: @@ -1342,8 +1345,8 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 106:17: -> ^( KEYCODEX NAME ) - # XKBGrammar.g:106:20: ^( KEYCODEX NAME ) + # 103:17: -> ^( KEYCODEX NAME ) + # XKBGrammar.g:103:20: ^( KEYCODEX NAME ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(KEYCODEX, "KEYCODEX"), root_1) @@ -1387,7 +1390,7 @@ class XKBGrammarParser(Parser): # $ANTLR start keysyms - # XKBGrammar.g:109:1: keysyms : '{' '[' keysym+= NAME ( ',' keysym+= NAME )* ']' '}' -> ^( KEYSYMS ( $keysym)+ ) ; + # XKBGrammar.g:106:1: keysyms : '{' ( 'type' '[' tn1= NAME ']' '=' tn2= DQSTRING ',' )? '[' keysym+= NAME ( ',' keysym+= NAME )* ']' '}' -> ^( KEYSYMS ( ^( TOKEN_TYPE $tn1 $tn2) )? ( $keysym)+ ) ; def keysyms(self, ): retval = self.keysyms_return() @@ -1395,60 +1398,110 @@ class XKBGrammarParser(Parser): root_0 = None + tn1 = None + tn2 = None char_literal43 = None - char_literal44 = None + string_literal44 = None char_literal45 = None char_literal46 = None char_literal47 = None + char_literal48 = None + char_literal49 = None + char_literal50 = None + char_literal51 = None + char_literal52 = None keysym = None list_keysym = None + tn1_tree = None + tn2_tree = None char_literal43_tree = None - char_literal44_tree = None + string_literal44_tree = None char_literal45_tree = None char_literal46_tree = None char_literal47_tree = None + char_literal48_tree = None + char_literal49_tree = None + char_literal50_tree = None + char_literal51_tree = None + char_literal52_tree = None keysym_tree = None stream_NAME = RewriteRuleTokenStream(self.adaptor, "token NAME") - stream_30 = RewriteRuleTokenStream(self.adaptor, "token 30") + stream_32 = RewriteRuleTokenStream(self.adaptor, "token 32") + stream_40 = RewriteRuleTokenStream(self.adaptor, "token 40") stream_31 = RewriteRuleTokenStream(self.adaptor, "token 31") - stream_36 = RewriteRuleTokenStream(self.adaptor, "token 36") - stream_25 = RewriteRuleTokenStream(self.adaptor, "token 25") + stream_DQSTRING = RewriteRuleTokenStream(self.adaptor, "token DQSTRING") + stream_33 = RewriteRuleTokenStream(self.adaptor, "token 33") stream_26 = RewriteRuleTokenStream(self.adaptor, "token 26") + stream_27 = RewriteRuleTokenStream(self.adaptor, "token 27") + stream_37 = RewriteRuleTokenStream(self.adaptor, "token 37") try: try: - # XKBGrammar.g:110:2: ( '{' '[' keysym+= NAME ( ',' keysym+= NAME )* ']' '}' -> ^( KEYSYMS ( $keysym)+ ) ) - # XKBGrammar.g:110:4: '{' '[' keysym+= NAME ( ',' keysym+= NAME )* ']' '}' + # XKBGrammar.g:107:2: ( '{' ( 'type' '[' tn1= NAME ']' '=' tn2= DQSTRING ',' )? '[' keysym+= NAME ( ',' keysym+= NAME )* ']' '}' -> ^( KEYSYMS ( ^( TOKEN_TYPE $tn1 $tn2) )? ( $keysym)+ ) ) + # XKBGrammar.g:107:4: '{' ( 'type' '[' tn1= NAME ']' '=' tn2= DQSTRING ',' )? '[' keysym+= NAME ( ',' keysym+= NAME )* ']' '}' char_literal43 = self.input.LT(1) - self.match(self.input, 25, self.FOLLOW_25_in_keysyms483) - stream_25.add(char_literal43) - char_literal44 = self.input.LT(1) - self.match(self.input, 30, self.FOLLOW_30_in_keysyms485) - stream_30.add(char_literal44) + self.match(self.input, 26, self.FOLLOW_26_in_keysyms482) + stream_26.add(char_literal43) + # XKBGrammar.g:107:8: ( 'type' '[' tn1= NAME ']' '=' tn2= DQSTRING ',' )? + alt7 = 2 + LA7_0 = self.input.LA(1) + + if (LA7_0 == 40) : + alt7 = 1 + if alt7 == 1: + # XKBGrammar.g:107:9: 'type' '[' tn1= NAME ']' '=' tn2= DQSTRING ',' + string_literal44 = self.input.LT(1) + self.match(self.input, 40, self.FOLLOW_40_in_keysyms485) + stream_40.add(string_literal44) + char_literal45 = self.input.LT(1) + self.match(self.input, 31, self.FOLLOW_31_in_keysyms487) + stream_31.add(char_literal45) + tn1 = self.input.LT(1) + self.match(self.input, NAME, self.FOLLOW_NAME_in_keysyms491) + stream_NAME.add(tn1) + char_literal46 = self.input.LT(1) + self.match(self.input, 32, self.FOLLOW_32_in_keysyms493) + stream_32.add(char_literal46) + char_literal47 = self.input.LT(1) + self.match(self.input, 33, self.FOLLOW_33_in_keysyms495) + stream_33.add(char_literal47) + tn2 = self.input.LT(1) + self.match(self.input, DQSTRING, self.FOLLOW_DQSTRING_in_keysyms499) + stream_DQSTRING.add(tn2) + char_literal48 = self.input.LT(1) + self.match(self.input, 37, self.FOLLOW_37_in_keysyms501) + stream_37.add(char_literal48) + + + + + char_literal49 = self.input.LT(1) + self.match(self.input, 31, self.FOLLOW_31_in_keysyms505) + stream_31.add(char_literal49) keysym = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_keysyms489) + self.match(self.input, NAME, self.FOLLOW_NAME_in_keysyms509) stream_NAME.add(keysym) if list_keysym is None: list_keysym = [] list_keysym.append(keysym) - # XKBGrammar.g:110:25: ( ',' keysym+= NAME )* - while True: #loop7 - alt7 = 2 - LA7_0 = self.input.LA(1) + # XKBGrammar.g:107:73: ( ',' keysym+= NAME )* + while True: #loop8 + alt8 = 2 + LA8_0 = self.input.LA(1) - if (LA7_0 == 36) : - alt7 = 1 + if (LA8_0 == 37) : + alt8 = 1 - if alt7 == 1: - # XKBGrammar.g:110:26: ',' keysym+= NAME - char_literal45 = self.input.LT(1) - self.match(self.input, 36, self.FOLLOW_36_in_keysyms492) - stream_36.add(char_literal45) + if alt8 == 1: + # XKBGrammar.g:107:74: ',' keysym+= NAME + char_literal50 = self.input.LT(1) + self.match(self.input, 37, self.FOLLOW_37_in_keysyms512) + stream_37.add(char_literal50) keysym = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_keysyms496) + self.match(self.input, NAME, self.FOLLOW_NAME_in_keysyms516) stream_NAME.add(keysym) if list_keysym is None: list_keysym = [] @@ -1458,23 +1511,25 @@ class XKBGrammarParser(Parser): else: - break #loop7 + break #loop8 - char_literal46 = self.input.LT(1) - self.match(self.input, 31, self.FOLLOW_31_in_keysyms500) - stream_31.add(char_literal46) - char_literal47 = self.input.LT(1) - self.match(self.input, 26, self.FOLLOW_26_in_keysyms502) - stream_26.add(char_literal47) + char_literal51 = self.input.LT(1) + self.match(self.input, 32, self.FOLLOW_32_in_keysyms520) + stream_32.add(char_literal51) + char_literal52 = self.input.LT(1) + self.match(self.input, 27, self.FOLLOW_27_in_keysyms522) + stream_27.add(char_literal52) # AST Rewrite - # elements: keysym - # token labels: + # elements: tn2, keysym, tn1 + # token labels: tn1, tn2 # rule labels: retval # token list labels: keysym # rule list labels: retval.tree = root_0 + stream_tn1 = RewriteRuleTokenStream(self.adaptor, "token tn1", tn1) + stream_tn2 = RewriteRuleTokenStream(self.adaptor, "token tn2", tn2) stream_keysym = RewriteRuleTokenStream(self.adaptor, "token keysym", list_keysym) if retval is not None: @@ -1484,12 +1539,26 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 111:2: -> ^( KEYSYMS ( $keysym)+ ) - # XKBGrammar.g:111:5: ^( KEYSYMS ( $keysym)+ ) + # 108:2: -> ^( KEYSYMS ( ^( TOKEN_TYPE $tn1 $tn2) )? ( $keysym)+ ) + # XKBGrammar.g:108:5: ^( KEYSYMS ( ^( TOKEN_TYPE $tn1 $tn2) )? ( $keysym)+ ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(KEYSYMS, "KEYSYMS"), root_1) - # XKBGrammar.g:111:15: ( $keysym)+ + # XKBGrammar.g:108:15: ( ^( TOKEN_TYPE $tn1 $tn2) )? + if stream_tn2.hasNext() or stream_tn1.hasNext(): + # XKBGrammar.g:108:15: ^( TOKEN_TYPE $tn1 $tn2) + root_2 = self.adaptor.nil() + root_2 = self.adaptor.becomeRoot(self.adaptor.createFromType(TOKEN_TYPE, "TOKEN_TYPE"), root_2) + + self.adaptor.addChild(root_2, stream_tn1.nextNode()) + self.adaptor.addChild(root_2, stream_tn2.nextNode()) + + self.adaptor.addChild(root_1, root_2) + + + stream_tn2.reset(); + stream_tn1.reset(); + # XKBGrammar.g:108:40: ( $keysym)+ if not (stream_keysym.hasNext()): raise RewriteEarlyExitException() @@ -1538,7 +1607,7 @@ class XKBGrammarParser(Parser): # $ANTLR start mapOptions - # XKBGrammar.g:114:1: mapOptions : ( 'default' | 'hidden' | 'partial' | 'alphanumeric_keys' | 'modifier_keys' | 'alternate_group' | 'xkb_symbols' ); + # XKBGrammar.g:111:1: mapOptions : ( 'default' | 'hidden' | 'partial' | 'alphanumeric_keys' | 'modifier_keys' | 'alternate_group' | 'xkb_symbols' ); def mapOptions(self, ): retval = self.mapOptions_return() @@ -1546,20 +1615,20 @@ class XKBGrammarParser(Parser): root_0 = None - set48 = None + set53 = None - set48_tree = None + set53_tree = None try: try: - # XKBGrammar.g:115:2: ( 'default' | 'hidden' | 'partial' | 'alphanumeric_keys' | 'modifier_keys' | 'alternate_group' | 'xkb_symbols' ) + # XKBGrammar.g:112:2: ( 'default' | 'hidden' | 'partial' | 'alphanumeric_keys' | 'modifier_keys' | 'alternate_group' | 'xkb_symbols' ) # XKBGrammar.g: root_0 = self.adaptor.nil() - set48 = self.input.LT(1) - if (39 <= self.input.LA(1) <= 45): + set53 = self.input.LT(1) + if (41 <= self.input.LA(1) <= 47): self.input.consume(); - self.adaptor.addChild(root_0, self.adaptor.createWithPayload(set48)) + self.adaptor.addChild(root_0, self.adaptor.createWithPayload(set53)) self._state.errorRecovery = False else: @@ -1600,7 +1669,7 @@ class XKBGrammarParser(Parser): # $ANTLR start state - # XKBGrammar.g:124:1: state : ( 'Shift' | 'Control' | 'Lock' | 'Mod1' | 'Mod2' | 'Mod3' | 'Mod4' | 'Mod5' ); + # XKBGrammar.g:121:1: state : ( 'Shift' | 'Control' | 'Lock' | 'Mod1' | 'Mod2' | 'Mod3' | 'Mod4' | 'Mod5' ); def state(self, ): retval = self.state_return() @@ -1608,20 +1677,20 @@ class XKBGrammarParser(Parser): root_0 = None - set49 = None + set54 = None - set49_tree = None + set54_tree = None try: try: - # XKBGrammar.g:125:2: ( 'Shift' | 'Control' | 'Lock' | 'Mod1' | 'Mod2' | 'Mod3' | 'Mod4' | 'Mod5' ) + # XKBGrammar.g:122:2: ( 'Shift' | 'Control' | 'Lock' | 'Mod1' | 'Mod2' | 'Mod3' | 'Mod4' | 'Mod5' ) # XKBGrammar.g: root_0 = self.adaptor.nil() - set49 = self.input.LT(1) - if (46 <= self.input.LA(1) <= 53): + set54 = self.input.LT(1) + if (48 <= self.input.LA(1) <= 55): self.input.consume(); - self.adaptor.addChild(root_0, self.adaptor.createWithPayload(set49)) + self.adaptor.addChild(root_0, self.adaptor.createWithPayload(set54)) self._state.errorRecovery = False else: @@ -1657,59 +1726,66 @@ class XKBGrammarParser(Parser): - FOLLOW_section_in_layout129 = frozenset([39, 40, 41, 42, 43, 44, 45]) - FOLLOW_EOF_in_layout132 = frozenset([1]) - FOLLOW_mapType_in_section155 = frozenset([25]) - FOLLOW_25_in_section157 = frozenset([28, 29, 33, 34, 35]) - FOLLOW_mapMaterial_in_section159 = frozenset([26, 28, 29, 33, 34, 35]) - FOLLOW_26_in_section162 = frozenset([27]) - FOLLOW_27_in_section164 = frozenset([1]) - FOLLOW_mapOptions_in_mapType192 = frozenset([20, 39, 40, 41, 42, 43, 44, 45]) - FOLLOW_DQSTRING_in_mapType195 = frozenset([1]) - FOLLOW_line_include_in_mapMaterial227 = frozenset([1]) - FOLLOW_line_name_in_mapMaterial233 = frozenset([27]) - FOLLOW_27_in_mapMaterial235 = frozenset([1]) - FOLLOW_line_keytype_in_mapMaterial241 = frozenset([27]) - FOLLOW_27_in_mapMaterial243 = frozenset([1]) - FOLLOW_line_key_in_mapMaterial249 = frozenset([27]) - FOLLOW_27_in_mapMaterial251 = frozenset([1]) - FOLLOW_line_modifier_map_in_mapMaterial257 = frozenset([27]) - FOLLOW_27_in_mapMaterial259 = frozenset([1]) - FOLLOW_28_in_line_include271 = frozenset([20]) - FOLLOW_DQSTRING_in_line_include273 = frozenset([1]) - FOLLOW_29_in_line_name293 = frozenset([30]) - FOLLOW_30_in_line_name295 = frozenset([21]) - FOLLOW_NAME_in_line_name299 = frozenset([31]) - FOLLOW_31_in_line_name301 = frozenset([32]) - FOLLOW_32_in_line_name303 = frozenset([20]) - FOLLOW_DQSTRING_in_line_name307 = frozenset([1]) - FOLLOW_33_in_line_keytype335 = frozenset([30]) - FOLLOW_30_in_line_keytype337 = frozenset([21]) - FOLLOW_NAME_in_line_keytype341 = frozenset([31]) - FOLLOW_31_in_line_keytype343 = frozenset([32]) - FOLLOW_32_in_line_keytype345 = frozenset([20]) - FOLLOW_DQSTRING_in_line_keytype349 = frozenset([1]) - FOLLOW_34_in_line_key378 = frozenset([21, 37]) - FOLLOW_keycode_in_line_key380 = frozenset([25]) - FOLLOW_keysyms_in_line_key382 = frozenset([1]) - FOLLOW_35_in_line_modifier_map404 = frozenset([46, 47, 48, 49, 50, 51, 52, 53]) - FOLLOW_state_in_line_modifier_map406 = frozenset([25]) - FOLLOW_25_in_line_modifier_map408 = frozenset([21, 37]) - FOLLOW_keycode_in_line_modifier_map410 = frozenset([26, 36]) - FOLLOW_36_in_line_modifier_map413 = frozenset([21, 37]) - FOLLOW_keycode_in_line_modifier_map415 = frozenset([26, 36]) - FOLLOW_26_in_line_modifier_map419 = frozenset([1]) - FOLLOW_NAME_in_keycode447 = frozenset([1]) - FOLLOW_37_in_keycode460 = frozenset([21]) - FOLLOW_NAME_in_keycode462 = frozenset([38]) - FOLLOW_38_in_keycode464 = frozenset([1]) - FOLLOW_25_in_keysyms483 = frozenset([30]) - FOLLOW_30_in_keysyms485 = frozenset([21]) - FOLLOW_NAME_in_keysyms489 = frozenset([31, 36]) - FOLLOW_36_in_keysyms492 = frozenset([21]) - FOLLOW_NAME_in_keysyms496 = frozenset([31, 36]) - FOLLOW_31_in_keysyms500 = frozenset([26]) - FOLLOW_26_in_keysyms502 = frozenset([1]) + FOLLOW_section_in_layout133 = frozenset([41, 42, 43, 44, 45, 46, 47]) + FOLLOW_EOF_in_layout136 = frozenset([1]) + FOLLOW_mapType_in_section159 = frozenset([26]) + FOLLOW_26_in_section161 = frozenset([29, 30, 34, 35, 36]) + FOLLOW_mapMaterial_in_section163 = frozenset([27, 29, 30, 34, 35, 36]) + FOLLOW_27_in_section166 = frozenset([28]) + FOLLOW_28_in_section168 = frozenset([1]) + FOLLOW_mapOptions_in_mapType196 = frozenset([21, 41, 42, 43, 44, 45, 46, 47]) + FOLLOW_DQSTRING_in_mapType199 = frozenset([1]) + FOLLOW_line_include_in_mapMaterial231 = frozenset([1]) + FOLLOW_line_name_in_mapMaterial237 = frozenset([28]) + FOLLOW_28_in_mapMaterial239 = frozenset([1]) + FOLLOW_line_keytype_in_mapMaterial245 = frozenset([28]) + FOLLOW_28_in_mapMaterial247 = frozenset([1]) + FOLLOW_line_key_in_mapMaterial253 = frozenset([28]) + FOLLOW_28_in_mapMaterial255 = frozenset([1]) + FOLLOW_line_modifier_map_in_mapMaterial261 = frozenset([28]) + FOLLOW_28_in_mapMaterial263 = frozenset([1]) + FOLLOW_29_in_line_include275 = frozenset([21]) + FOLLOW_DQSTRING_in_line_include277 = frozenset([1]) + FOLLOW_30_in_line_name297 = frozenset([31]) + FOLLOW_31_in_line_name299 = frozenset([22]) + FOLLOW_NAME_in_line_name303 = frozenset([32]) + FOLLOW_32_in_line_name305 = frozenset([33]) + FOLLOW_33_in_line_name307 = frozenset([21]) + FOLLOW_DQSTRING_in_line_name311 = frozenset([1]) + FOLLOW_34_in_line_keytype339 = frozenset([31]) + FOLLOW_31_in_line_keytype341 = frozenset([22]) + FOLLOW_NAME_in_line_keytype345 = frozenset([32]) + FOLLOW_32_in_line_keytype347 = frozenset([33]) + FOLLOW_33_in_line_keytype349 = frozenset([21]) + FOLLOW_DQSTRING_in_line_keytype353 = frozenset([1]) + FOLLOW_35_in_line_key381 = frozenset([22, 38]) + FOLLOW_keycode_in_line_key383 = frozenset([26]) + FOLLOW_keysyms_in_line_key385 = frozenset([1]) + FOLLOW_36_in_line_modifier_map407 = frozenset([48, 49, 50, 51, 52, 53, 54, 55]) + FOLLOW_state_in_line_modifier_map409 = frozenset([26]) + FOLLOW_26_in_line_modifier_map411 = frozenset([22, 38]) + FOLLOW_keycode_in_line_modifier_map413 = frozenset([27, 37]) + FOLLOW_37_in_line_modifier_map416 = frozenset([22, 38]) + FOLLOW_keycode_in_line_modifier_map418 = frozenset([27, 37]) + FOLLOW_27_in_line_modifier_map422 = frozenset([1]) + FOLLOW_NAME_in_keycode446 = frozenset([1]) + FOLLOW_38_in_keycode459 = frozenset([22]) + FOLLOW_NAME_in_keycode461 = frozenset([39]) + FOLLOW_39_in_keycode463 = frozenset([1]) + FOLLOW_26_in_keysyms482 = frozenset([31, 40]) + FOLLOW_40_in_keysyms485 = frozenset([31]) + FOLLOW_31_in_keysyms487 = frozenset([22]) + FOLLOW_NAME_in_keysyms491 = frozenset([32]) + FOLLOW_32_in_keysyms493 = frozenset([33]) + FOLLOW_33_in_keysyms495 = frozenset([21]) + FOLLOW_DQSTRING_in_keysyms499 = frozenset([37]) + FOLLOW_37_in_keysyms501 = frozenset([31]) + FOLLOW_31_in_keysyms505 = frozenset([22]) + FOLLOW_NAME_in_keysyms509 = frozenset([32, 37]) + FOLLOW_37_in_keysyms512 = frozenset([22]) + FOLLOW_NAME_in_keysyms516 = frozenset([32, 37]) + FOLLOW_32_in_keysyms520 = frozenset([27]) + FOLLOW_27_in_keysyms522 = frozenset([1]) FOLLOW_set_in_mapOptions0 = frozenset([1]) FOLLOW_set_in_state0 = frozenset([1]) diff --git a/XKBGrammar/XKBGrammarParser.pyc b/XKBGrammar/XKBGrammarParser.pyc Binary files differ. diff --git a/XKBGrammar/XKBGrammarWalker.g b/XKBGrammar/XKBGrammarWalker.g @@ -72,8 +72,13 @@ mapMaterial | ^(TOKEN_KEY keycode keysyms) | ^(TOKEN_MODIFIER_MAP state keycode+) ; + +line_type + : + ^(TOKEN_TYPE NAME ^(VALUE DQSTRING)) + ; keysyms - : ^(KEYSYMS NAME+) + : ^(KEYSYMS ^(TOKEN_TYPE NAME DQSTRING) NAME+) ; diff --git a/XKBGrammar/check_xkb.py b/XKBGrammar/check_xkb.py @@ -6,7 +6,7 @@ import sys import pdb import antlr3 -from XKBGrammarLexer import XKBGrammarLexer, SECTION, MAPTYPE, MAPNAME, MAPOPTIONS, MAPMATERIAL, TOKEN_INCLUDE, TOKEN_NAME, TOKEN_KEY_TYPE, TOKEN_KEY, VALUE, KEYCODE, KEYCODEX, KEYSYMS +from XKBGrammarLexer import XKBGrammarLexer, SECTION, MAPTYPE, MAPNAME, MAPOPTIONS, MAPMATERIAL, TOKEN_INCLUDE, TOKEN_NAME, TOKEN_KEY_TYPE, TOKEN_KEY, VALUE, KEYCODE, KEYCODEX, KEYSYMS, TOKEN_TYPE from XKBGrammarParser import XKBGrammarParser from XKBGrammarWalker import XKBGrammarWalker @@ -26,6 +26,15 @@ def getChildrenListByType(tree, type_value): list.append(child) return list +def hasChildByType(tree, type_value): + has = False + for i in range(tree.getChildCount()): + child = tree.getChild(i) + if child.getType() == type_value: + has = True + break + return has + xkbfilename = "gr" if len(sys.argv) > 1: xkbfilename = sys.argv[1] @@ -98,6 +107,9 @@ for section in result.tree.getChildren(): sys.exit(-1) for ks in keysyms[0].getChildren(): if first_time: + if ks.getType() == TOKEN_TYPE: + print 'type[%(t)s] = %(n)s, ' % {"t": ks.getChild(0).getText(), "n": ks.getChild(1).getText()}, + continue first_time = False else: sys.stdout.write(", "); diff --git a/XKBGrammar/gr b/XKBGrammar/gr @@ -3,10 +3,8 @@ xkb_symbols "extended" { include "gr(basic)" name[Group1] = "Greece-Extended"; key.type[Group1] = "THREE_LEVEL"; // yeah, comment - key <AE03> { [ NoSymbol, NoSymbol, sterling ] }; // my comment - key <AE10> { [ NoSymbol, NoSymbol, degree ] }; // more comment - - include "level3(ralt_switch)" - include "eurosign(5)" - include "eurosign(e)" + key <AD01> { type[Group1] = "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC", + [ U1C9, U1C8, any, U1C7 ] }; // q + key <AD02> { type[Group1] = "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC", + [ U1CC, U1CB, any, U1CA ] }; // w }; diff --git a/XKBGrammar/print_tree.py b/XKBGrammar/print_tree.py @@ -52,14 +52,14 @@ nodes.setTokenStream(tokens) walker = XKBGrammarWalker(nodes) # walker.layout() -MAX = 8 -TABS = "\t\t\t\t\t\t\t\t" +MAX = 10 +TABS = "\t\t\t\t\t\t\t\t\t\t" def print_tree(node, depth): if depth >= MAX: return for n in node.getChildren(): - print TABS[:depth], n.getText() + print TABS[:depth], "===", n.getText(), "===" print_tree(n, depth + 1)