keyboardlayouteditor

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

commit 31b6f3d31f96bcf94154e9bd0b949c8e8244b54f
parent 407a12f7684b227d06716e35ab643ffaf732c125
Author: simos.lists <simos.lists@70737e48-4f4a-0410-8df8-290828ad50c4>
Date:   Fri,  9 May 2008 12:02:02 +0000

Grammar now outputs generic input file + fixes

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

Diffstat:
MXKBGrammar/XKBGrammar.g | 78++++++++++++++++++++++++++++++++++++++++++++++++------------------------------
MXKBGrammar/XKBGrammarLexer.py | 28++++++++++++++--------------
MXKBGrammar/XKBGrammarLexer.pyc | 0
MXKBGrammar/XKBGrammarParser.py | 477+++++++++++++++++++++++++++++++++++++++++--------------------------------------
MXKBGrammar/XKBGrammarParser.pyc | 0
MXKBGrammar/XKBGrammar__.g | 13+++++++------
6 files changed, 319 insertions(+), 277 deletions(-)

diff --git a/XKBGrammar/XKBGrammar.g b/XKBGrammar/XKBGrammar.g @@ -71,35 +71,39 @@ tokens // // // can have several sections as above. -layout : section* EOF! - ; +layout + : section* EOF! + ; -section : preamble sectionmaterial - { print '}' } - -> ^(SECTION) - ; - -preamble : attribute_xkb+ sectionname=quotedstring - { print '\%(sectionname)s {' \% { "sectionname": $sectionname.text } } - ; +section + : preamble sectionmaterial + { print '}' } + -> ^(SECTION) + ; + +preamble + : attribute_xkb+ sectionname=quotedstring + { print '\%(sectionname)s {' \% { "sectionname": $sectionname.text } } + ; quotedstring returns [value] - : DQUOTE sectionname+=~(DQUOTE)+ DQUOTE - { - qstring = ['"'] - for elem in $sectionname: - qstring.append(elem.getText()) - qstring.append('"') - $value = "".join(qstring) - } - ; - -sectionmaterial : LCURLY (line_include - | line_name - | line_keytype - | line_key - )+ RCURLY SEMICOLON - ; + : DQUOTE sectionname+=~(DQUOTE)+ DQUOTE + { + qstring = ['"'] + for elem in $sectionname: + qstring.append(elem.getText()) + qstring.append('"') + $value = "".join(qstring) + } + ; + +sectionmaterial + : LCURLY (line_include + | line_name + | line_keytype + | line_key + )+ RCURLY SEMICOLON + ; line_include : TOKEN_INCLUDE include=quotedstring @@ -118,7 +122,7 @@ line_keytype line_key : TOKEN_KEY keycode keysyms SEMICOLON - { print "\tkey \%(keycode)s \%(keysyms)s ;" \% { "keycode": $keycode.text, "keysyms": $keysyms.text } } + { print '\tkey \%(keycode)s \%(keysyms)s;' \% { "keycode": $keycode.text, "keysyms": $keysyms.value } } ; keycode @@ -126,8 +130,21 @@ keycode -> ^(INCLUDE NAME) ; -keysyms - : LCURLY LBRACKET NAME (COMMA NAME)* RBRACKET RCURLY +keysyms returns [value] + : LCURLY LBRACKET keysym+=NAME (COMMA keysym+=NAME)* RBRACKET RCURLY + { + qstring = ["{ [ "] + first_elem = $keysym[0].getText() + qstring.append(first_elem) + for elem in $keysym: + if first_elem != "": + first_elem = "" + continue + qstring.append(", ") + qstring.append(elem.getText()) + qstring.append(" ] }") + $value = "".join(qstring) + } ; // mapsyms @@ -153,7 +170,8 @@ NAME ; // Comments are currently ignored. -COMMENT : '//' (~('\n'|'\r'))* +COMMENT + : '//' (~('\n'|'\r'))* { $channel = HIDDEN; } ; diff --git a/XKBGrammar/XKBGrammarLexer.py b/XKBGrammar/XKBGrammarLexer.py @@ -1,4 +1,4 @@ -# $ANTLR 3.0.1 XKBGrammar.g 2008-05-09 12:05:39 +# $ANTLR 3.0.1 XKBGrammar.g 2008-05-09 13:01:19 from antlr3 import * from antlr3.compat import set, frozenset @@ -601,8 +601,8 @@ class XKBGrammarLexer(Lexer): def mGENERIC_NAME(self, ): try: - # XKBGrammar.g:148:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' ) ) - # XKBGrammar.g:148:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' ) + # XKBGrammar.g:165:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' ) ) + # XKBGrammar.g:165:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' ) if (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'): self.input.consume(); @@ -639,9 +639,9 @@ class XKBGrammarLexer(Lexer): try: self.type = NAME - # XKBGrammar.g:152:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' )* ) - # XKBGrammar.g:152:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' )* - # XKBGrammar.g:152:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' )* + # XKBGrammar.g:169:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' )* ) + # XKBGrammar.g:169:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' )* + # XKBGrammar.g:169:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '(' | ')' | '0' .. '9' )* while True: #loop1 alt1 = 2 LA1_0 = self.input.LA(1) @@ -685,12 +685,12 @@ class XKBGrammarLexer(Lexer): try: self.type = COMMENT - # XKBGrammar.g:156:9: ( '//' (~ ( '\\n' | '\\r' ) )* ) - # XKBGrammar.g:156:11: '//' (~ ( '\\n' | '\\r' ) )* + # XKBGrammar.g:174:2: ( '//' (~ ( '\\n' | '\\r' ) )* ) + # XKBGrammar.g:174:4: '//' (~ ( '\\n' | '\\r' ) )* self.match("//") - # XKBGrammar.g:156:16: (~ ( '\\n' | '\\r' ) )* + # XKBGrammar.g:174:9: (~ ( '\\n' | '\\r' ) )* while True: #loop2 alt2 = 2 LA2_0 = self.input.LA(1) @@ -700,7 +700,7 @@ class XKBGrammarLexer(Lexer): if alt2 == 1: - # XKBGrammar.g:156:17: ~ ( '\\n' | '\\r' ) + # XKBGrammar.g:174:10: ~ ( '\\n' | '\\r' ) if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'): self.input.consume(); @@ -737,9 +737,9 @@ class XKBGrammarLexer(Lexer): try: self.type = WS - # XKBGrammar.g:160:9: ( ( '\\t' | ' ' | NEWLINE )+ ) - # XKBGrammar.g:160:17: ( '\\t' | ' ' | NEWLINE )+ - # XKBGrammar.g:160:17: ( '\\t' | ' ' | NEWLINE )+ + # XKBGrammar.g:178:9: ( ( '\\t' | ' ' | NEWLINE )+ ) + # XKBGrammar.g:178:17: ( '\\t' | ' ' | NEWLINE )+ + # XKBGrammar.g:178:17: ( '\\t' | ' ' | NEWLINE )+ cnt3 = 0 while True: #loop3 alt3 = 2 @@ -791,7 +791,7 @@ class XKBGrammarLexer(Lexer): def mNEWLINE(self, ): try: - # XKBGrammar.g:165:9: ( '\\r' | '\\n' ) + # XKBGrammar.g:183:9: ( '\\r' | '\\n' ) # XKBGrammar.g: if self.input.LA(1) == u'\n' or self.input.LA(1) == u'\r': self.input.consume(); 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.0.1 XKBGrammar.g 2008-05-09 12:05:38 +# $ANTLR 3.0.1 XKBGrammar.g 2008-05-09 13:01:19 from antlr3 import * from antlr3.compat import set, frozenset @@ -103,11 +103,11 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:74:10: ( ( section )* EOF ) - # XKBGrammar.g:74:12: ( section )* EOF + # XKBGrammar.g:75:2: ( ( section )* EOF ) + # XKBGrammar.g:75:4: ( section )* EOF root_0 = self.adaptor.nil() - # XKBGrammar.g:74:12: ( section )* + # XKBGrammar.g:75:4: ( section )* while True: #loop1 alt1 = 2 LA1_0 = self.input.LA(1) @@ -117,8 +117,8 @@ class XKBGrammarParser(Parser): if alt1 == 1: - # XKBGrammar.g:74:12: section - self.following.append(self.FOLLOW_section_in_layout359) + # XKBGrammar.g:75:4: section + self.following.append(self.FOLLOW_section_in_layout361) section1 = self.section() self.following.pop() @@ -130,7 +130,7 @@ class XKBGrammarParser(Parser): EOF2 = self.input.LT(1) - self.match(self.input, EOF, self.FOLLOW_EOF_in_layout362) + self.match(self.input, EOF, self.FOLLOW_EOF_in_layout364) @@ -161,7 +161,7 @@ class XKBGrammarParser(Parser): # $ANTLR start section - # XKBGrammar.g:77:1: section : preamble sectionmaterial -> ^( SECTION ) ; + # XKBGrammar.g:78:1: section : preamble sectionmaterial -> ^( SECTION ) ; def section(self, ): retval = self.section_return() @@ -178,14 +178,14 @@ class XKBGrammarParser(Parser): stream_sectionmaterial = RewriteRuleSubtreeStream(self.adaptor, "rule sectionmaterial") try: try: - # XKBGrammar.g:77:10: ( preamble sectionmaterial -> ^( SECTION ) ) - # XKBGrammar.g:77:12: preamble sectionmaterial - self.following.append(self.FOLLOW_preamble_in_section377) + # XKBGrammar.g:79:2: ( preamble sectionmaterial -> ^( SECTION ) ) + # XKBGrammar.g:79:4: preamble sectionmaterial + self.following.append(self.FOLLOW_preamble_in_section380) preamble3 = self.preamble() self.following.pop() stream_preamble.add(preamble3.tree) - self.following.append(self.FOLLOW_sectionmaterial_in_section379) + self.following.append(self.FOLLOW_sectionmaterial_in_section382) sectionmaterial4 = self.sectionmaterial() self.following.pop() @@ -209,8 +209,8 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 79:3: -> ^( SECTION ) - # XKBGrammar.g:79:6: ^( SECTION ) + # 81:2: -> ^( SECTION ) + # XKBGrammar.g:81:5: ^( SECTION ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(SECTION, "SECTION"), root_1) @@ -247,7 +247,7 @@ class XKBGrammarParser(Parser): # $ANTLR start preamble - # XKBGrammar.g:82:1: preamble : ( attribute_xkb )+ sectionname= quotedstring ; + # XKBGrammar.g:84:1: preamble : ( attribute_xkb )+ sectionname= quotedstring ; def preamble(self, ): retval = self.preamble_return() @@ -263,11 +263,11 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:82:11: ( ( attribute_xkb )+ sectionname= quotedstring ) - # XKBGrammar.g:82:13: ( attribute_xkb )+ sectionname= quotedstring + # XKBGrammar.g:85:2: ( ( attribute_xkb )+ sectionname= quotedstring ) + # XKBGrammar.g:85:4: ( attribute_xkb )+ sectionname= quotedstring root_0 = self.adaptor.nil() - # XKBGrammar.g:82:13: ( attribute_xkb )+ + # XKBGrammar.g:85:4: ( attribute_xkb )+ cnt2 = 0 while True: #loop2 alt2 = 2 @@ -278,8 +278,8 @@ class XKBGrammarParser(Parser): if alt2 == 1: - # XKBGrammar.g:82:13: attribute_xkb - self.following.append(self.FOLLOW_attribute_xkb_in_preamble405) + # XKBGrammar.g:85:4: attribute_xkb + self.following.append(self.FOLLOW_attribute_xkb_in_preamble407) attribute_xkb5 = self.attribute_xkb() self.following.pop() @@ -296,7 +296,7 @@ class XKBGrammarParser(Parser): cnt2 += 1 - self.following.append(self.FOLLOW_quotedstring_in_preamble410) + self.following.append(self.FOLLOW_quotedstring_in_preamble412) sectionname = self.quotedstring() self.following.pop() @@ -334,7 +334,7 @@ class XKBGrammarParser(Parser): # $ANTLR start quotedstring - # XKBGrammar.g:86:1: quotedstring returns [value] : DQUOTE (sectionname+=~ ( DQUOTE ) )+ DQUOTE ; + # XKBGrammar.g:89:1: quotedstring returns [value] : DQUOTE (sectionname+=~ ( DQUOTE ) )+ DQUOTE ; def quotedstring(self, ): retval = self.quotedstring_return() @@ -353,18 +353,18 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:87:10: ( DQUOTE (sectionname+=~ ( DQUOTE ) )+ DQUOTE ) - # XKBGrammar.g:87:12: DQUOTE (sectionname+=~ ( DQUOTE ) )+ DQUOTE + # XKBGrammar.g:90:9: ( DQUOTE (sectionname+=~ ( DQUOTE ) )+ DQUOTE ) + # XKBGrammar.g:90:11: DQUOTE (sectionname+=~ ( DQUOTE ) )+ DQUOTE root_0 = self.adaptor.nil() DQUOTE6 = self.input.LT(1) - self.match(self.input, DQUOTE, self.FOLLOW_DQUOTE_in_quotedstring438) + self.match(self.input, DQUOTE, self.FOLLOW_DQUOTE_in_quotedstring437) DQUOTE6_tree = self.adaptor.createWithPayload(DQUOTE6) self.adaptor.addChild(root_0, DQUOTE6_tree) - # XKBGrammar.g:87:30: (sectionname+=~ ( DQUOTE ) )+ + # XKBGrammar.g:90:29: (sectionname+=~ ( DQUOTE ) )+ cnt3 = 0 while True: #loop3 alt3 = 2 @@ -375,7 +375,7 @@ class XKBGrammarParser(Parser): if alt3 == 1: - # XKBGrammar.g:87:30: sectionname+=~ ( DQUOTE ) + # XKBGrammar.g:90:29: sectionname+=~ ( DQUOTE ) sectionname = self.input.LT(1) if (TOKEN_DEFAULT <= self.input.LA(1) <= COMMA) or (MINUS <= self.input.LA(1) <= WS): self.input.consume(); @@ -385,7 +385,7 @@ class XKBGrammarParser(Parser): else: mse = MismatchedSetException(None, self.input) self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_quotedstring442 + self.input, mse, self.FOLLOW_set_in_quotedstring441 ) raise mse @@ -407,20 +407,20 @@ class XKBGrammarParser(Parser): DQUOTE7 = self.input.LT(1) - self.match(self.input, DQUOTE, self.FOLLOW_DQUOTE_in_quotedstring448) + self.match(self.input, DQUOTE, self.FOLLOW_DQUOTE_in_quotedstring447) DQUOTE7_tree = self.adaptor.createWithPayload(DQUOTE7) self.adaptor.addChild(root_0, DQUOTE7_tree) #action start - + qstring = ['"'] for elem in list_sectionname: qstring.append(elem.getText()) qstring.append('"') retval.value = "".join(qstring) - + #action end @@ -451,7 +451,7 @@ class XKBGrammarParser(Parser): # $ANTLR start sectionmaterial - # XKBGrammar.g:97:1: sectionmaterial : LCURLY ( line_include | line_name | line_keytype | line_key )+ RCURLY SEMICOLON ; + # XKBGrammar.g:100:1: sectionmaterial : LCURLY ( line_include | line_name | line_keytype | line_key )+ RCURLY SEMICOLON ; def sectionmaterial(self, ): retval = self.sectionmaterial_return() @@ -477,18 +477,18 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:97:17: ( LCURLY ( line_include | line_name | line_keytype | line_key )+ RCURLY SEMICOLON ) - # XKBGrammar.g:97:19: LCURLY ( line_include | line_name | line_keytype | line_key )+ RCURLY SEMICOLON + # XKBGrammar.g:101:2: ( LCURLY ( line_include | line_name | line_keytype | line_key )+ RCURLY SEMICOLON ) + # XKBGrammar.g:101:4: LCURLY ( line_include | line_name | line_keytype | line_key )+ RCURLY SEMICOLON root_0 = self.adaptor.nil() LCURLY8 = self.input.LT(1) - self.match(self.input, LCURLY, self.FOLLOW_LCURLY_in_sectionmaterial485) + self.match(self.input, LCURLY, self.FOLLOW_LCURLY_in_sectionmaterial477) LCURLY8_tree = self.adaptor.createWithPayload(LCURLY8) self.adaptor.addChild(root_0, LCURLY8_tree) - # XKBGrammar.g:97:26: ( line_include | line_name | line_keytype | line_key )+ + # XKBGrammar.g:101:11: ( line_include | line_name | line_keytype | line_key )+ cnt4 = 0 while True: #loop4 alt4 = 5 @@ -503,8 +503,8 @@ class XKBGrammarParser(Parser): alt4 = 4 if alt4 == 1: - # XKBGrammar.g:97:27: line_include - self.following.append(self.FOLLOW_line_include_in_sectionmaterial488) + # XKBGrammar.g:101:12: line_include + self.following.append(self.FOLLOW_line_include_in_sectionmaterial480) line_include9 = self.line_include() self.following.pop() @@ -512,8 +512,8 @@ class XKBGrammarParser(Parser): elif alt4 == 2: - # XKBGrammar.g:98:5: line_name - self.following.append(self.FOLLOW_line_name_in_sectionmaterial495) + # XKBGrammar.g:102:4: line_name + self.following.append(self.FOLLOW_line_name_in_sectionmaterial486) line_name10 = self.line_name() self.following.pop() @@ -521,8 +521,8 @@ class XKBGrammarParser(Parser): elif alt4 == 3: - # XKBGrammar.g:99:5: line_keytype - self.following.append(self.FOLLOW_line_keytype_in_sectionmaterial502) + # XKBGrammar.g:103:4: line_keytype + self.following.append(self.FOLLOW_line_keytype_in_sectionmaterial492) line_keytype11 = self.line_keytype() self.following.pop() @@ -530,8 +530,8 @@ class XKBGrammarParser(Parser): elif alt4 == 4: - # XKBGrammar.g:100:5: line_key - self.following.append(self.FOLLOW_line_key_in_sectionmaterial509) + # XKBGrammar.g:104:4: line_key + self.following.append(self.FOLLOW_line_key_in_sectionmaterial498) line_key12 = self.line_key() self.following.pop() @@ -549,14 +549,14 @@ class XKBGrammarParser(Parser): RCURLY13 = self.input.LT(1) - self.match(self.input, RCURLY, self.FOLLOW_RCURLY_in_sectionmaterial517) + self.match(self.input, RCURLY, self.FOLLOW_RCURLY_in_sectionmaterial505) RCURLY13_tree = self.adaptor.createWithPayload(RCURLY13) self.adaptor.addChild(root_0, RCURLY13_tree) SEMICOLON14 = self.input.LT(1) - self.match(self.input, SEMICOLON, self.FOLLOW_SEMICOLON_in_sectionmaterial519) + self.match(self.input, SEMICOLON, self.FOLLOW_SEMICOLON_in_sectionmaterial507) SEMICOLON14_tree = self.adaptor.createWithPayload(SEMICOLON14) @@ -591,7 +591,7 @@ class XKBGrammarParser(Parser): # $ANTLR start line_include - # XKBGrammar.g:104:1: line_include : TOKEN_INCLUDE include= quotedstring ; + # XKBGrammar.g:108:1: line_include : TOKEN_INCLUDE include= quotedstring ; def line_include(self, ): retval = self.line_include_return() @@ -607,18 +607,18 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:105:2: ( TOKEN_INCLUDE include= quotedstring ) - # XKBGrammar.g:105:4: TOKEN_INCLUDE include= quotedstring + # XKBGrammar.g:109:2: ( TOKEN_INCLUDE include= quotedstring ) + # XKBGrammar.g:109:4: TOKEN_INCLUDE include= quotedstring root_0 = self.adaptor.nil() TOKEN_INCLUDE15 = self.input.LT(1) - self.match(self.input, TOKEN_INCLUDE, self.FOLLOW_TOKEN_INCLUDE_in_line_include531) + self.match(self.input, TOKEN_INCLUDE, self.FOLLOW_TOKEN_INCLUDE_in_line_include518) TOKEN_INCLUDE15_tree = self.adaptor.createWithPayload(TOKEN_INCLUDE15) self.adaptor.addChild(root_0, TOKEN_INCLUDE15_tree) - self.following.append(self.FOLLOW_quotedstring_in_line_include535) + self.following.append(self.FOLLOW_quotedstring_in_line_include522) include = self.quotedstring() self.following.pop() @@ -655,7 +655,7 @@ class XKBGrammarParser(Parser): # $ANTLR start line_name - # XKBGrammar.g:109:1: line_name : TOKEN_NAME LBRACKET name= NAME RBRACKET EQUAL nameval= quotedstring SEMICOLON ; + # XKBGrammar.g:113:1: line_name : TOKEN_NAME LBRACKET name= NAME RBRACKET EQUAL nameval= quotedstring SEMICOLON ; def line_name(self, ): retval = self.line_name_return() @@ -681,52 +681,52 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:110:2: ( TOKEN_NAME LBRACKET name= NAME RBRACKET EQUAL nameval= quotedstring SEMICOLON ) - # XKBGrammar.g:110:4: TOKEN_NAME LBRACKET name= NAME RBRACKET EQUAL nameval= quotedstring SEMICOLON + # XKBGrammar.g:114:2: ( TOKEN_NAME LBRACKET name= NAME RBRACKET EQUAL nameval= quotedstring SEMICOLON ) + # XKBGrammar.g:114:4: TOKEN_NAME LBRACKET name= NAME RBRACKET EQUAL nameval= quotedstring SEMICOLON root_0 = self.adaptor.nil() TOKEN_NAME16 = self.input.LT(1) - self.match(self.input, TOKEN_NAME, self.FOLLOW_TOKEN_NAME_in_line_name550) + self.match(self.input, TOKEN_NAME, self.FOLLOW_TOKEN_NAME_in_line_name537) TOKEN_NAME16_tree = self.adaptor.createWithPayload(TOKEN_NAME16) self.adaptor.addChild(root_0, TOKEN_NAME16_tree) LBRACKET17 = self.input.LT(1) - self.match(self.input, LBRACKET, self.FOLLOW_LBRACKET_in_line_name552) + self.match(self.input, LBRACKET, self.FOLLOW_LBRACKET_in_line_name539) LBRACKET17_tree = self.adaptor.createWithPayload(LBRACKET17) self.adaptor.addChild(root_0, LBRACKET17_tree) name = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_line_name556) + self.match(self.input, NAME, self.FOLLOW_NAME_in_line_name543) name_tree = self.adaptor.createWithPayload(name) self.adaptor.addChild(root_0, name_tree) RBRACKET18 = self.input.LT(1) - self.match(self.input, RBRACKET, self.FOLLOW_RBRACKET_in_line_name558) + self.match(self.input, RBRACKET, self.FOLLOW_RBRACKET_in_line_name545) RBRACKET18_tree = self.adaptor.createWithPayload(RBRACKET18) self.adaptor.addChild(root_0, RBRACKET18_tree) EQUAL19 = self.input.LT(1) - self.match(self.input, EQUAL, self.FOLLOW_EQUAL_in_line_name560) + self.match(self.input, EQUAL, self.FOLLOW_EQUAL_in_line_name547) EQUAL19_tree = self.adaptor.createWithPayload(EQUAL19) self.adaptor.addChild(root_0, EQUAL19_tree) - self.following.append(self.FOLLOW_quotedstring_in_line_name564) + self.following.append(self.FOLLOW_quotedstring_in_line_name551) nameval = self.quotedstring() self.following.pop() self.adaptor.addChild(root_0, nameval.tree) SEMICOLON20 = self.input.LT(1) - self.match(self.input, SEMICOLON, self.FOLLOW_SEMICOLON_in_line_name566) + self.match(self.input, SEMICOLON, self.FOLLOW_SEMICOLON_in_line_name553) SEMICOLON20_tree = self.adaptor.createWithPayload(SEMICOLON20) @@ -764,7 +764,7 @@ class XKBGrammarParser(Parser): # $ANTLR start line_keytype - # XKBGrammar.g:114:1: line_keytype : TOKEN_KEY_TYPE LBRACKET keytype= NAME RBRACKET EQUAL DQUOTE keytypevalue= NAME DQUOTE SEMICOLON ; + # XKBGrammar.g:118:1: line_keytype : TOKEN_KEY_TYPE LBRACKET keytype= NAME RBRACKET EQUAL DQUOTE keytypevalue= NAME DQUOTE SEMICOLON ; def line_keytype(self, ): retval = self.line_keytype_return() @@ -794,68 +794,68 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:115:2: ( TOKEN_KEY_TYPE LBRACKET keytype= NAME RBRACKET EQUAL DQUOTE keytypevalue= NAME DQUOTE SEMICOLON ) - # XKBGrammar.g:115:4: TOKEN_KEY_TYPE LBRACKET keytype= NAME RBRACKET EQUAL DQUOTE keytypevalue= NAME DQUOTE SEMICOLON + # XKBGrammar.g:119:2: ( TOKEN_KEY_TYPE LBRACKET keytype= NAME RBRACKET EQUAL DQUOTE keytypevalue= NAME DQUOTE SEMICOLON ) + # XKBGrammar.g:119:4: TOKEN_KEY_TYPE LBRACKET keytype= NAME RBRACKET EQUAL DQUOTE keytypevalue= NAME DQUOTE SEMICOLON root_0 = self.adaptor.nil() TOKEN_KEY_TYPE21 = self.input.LT(1) - self.match(self.input, TOKEN_KEY_TYPE, self.FOLLOW_TOKEN_KEY_TYPE_in_line_keytype580) + self.match(self.input, TOKEN_KEY_TYPE, self.FOLLOW_TOKEN_KEY_TYPE_in_line_keytype567) TOKEN_KEY_TYPE21_tree = self.adaptor.createWithPayload(TOKEN_KEY_TYPE21) self.adaptor.addChild(root_0, TOKEN_KEY_TYPE21_tree) LBRACKET22 = self.input.LT(1) - self.match(self.input, LBRACKET, self.FOLLOW_LBRACKET_in_line_keytype582) + self.match(self.input, LBRACKET, self.FOLLOW_LBRACKET_in_line_keytype569) LBRACKET22_tree = self.adaptor.createWithPayload(LBRACKET22) self.adaptor.addChild(root_0, LBRACKET22_tree) keytype = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_line_keytype586) + self.match(self.input, NAME, self.FOLLOW_NAME_in_line_keytype573) keytype_tree = self.adaptor.createWithPayload(keytype) self.adaptor.addChild(root_0, keytype_tree) RBRACKET23 = self.input.LT(1) - self.match(self.input, RBRACKET, self.FOLLOW_RBRACKET_in_line_keytype588) + self.match(self.input, RBRACKET, self.FOLLOW_RBRACKET_in_line_keytype575) RBRACKET23_tree = self.adaptor.createWithPayload(RBRACKET23) self.adaptor.addChild(root_0, RBRACKET23_tree) EQUAL24 = self.input.LT(1) - self.match(self.input, EQUAL, self.FOLLOW_EQUAL_in_line_keytype590) + self.match(self.input, EQUAL, self.FOLLOW_EQUAL_in_line_keytype577) EQUAL24_tree = self.adaptor.createWithPayload(EQUAL24) self.adaptor.addChild(root_0, EQUAL24_tree) DQUOTE25 = self.input.LT(1) - self.match(self.input, DQUOTE, self.FOLLOW_DQUOTE_in_line_keytype592) + self.match(self.input, DQUOTE, self.FOLLOW_DQUOTE_in_line_keytype579) DQUOTE25_tree = self.adaptor.createWithPayload(DQUOTE25) self.adaptor.addChild(root_0, DQUOTE25_tree) keytypevalue = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_line_keytype596) + self.match(self.input, NAME, self.FOLLOW_NAME_in_line_keytype583) keytypevalue_tree = self.adaptor.createWithPayload(keytypevalue) self.adaptor.addChild(root_0, keytypevalue_tree) DQUOTE26 = self.input.LT(1) - self.match(self.input, DQUOTE, self.FOLLOW_DQUOTE_in_line_keytype598) + self.match(self.input, DQUOTE, self.FOLLOW_DQUOTE_in_line_keytype585) DQUOTE26_tree = self.adaptor.createWithPayload(DQUOTE26) self.adaptor.addChild(root_0, DQUOTE26_tree) SEMICOLON27 = self.input.LT(1) - self.match(self.input, SEMICOLON, self.FOLLOW_SEMICOLON_in_line_keytype600) + self.match(self.input, SEMICOLON, self.FOLLOW_SEMICOLON_in_line_keytype587) SEMICOLON27_tree = self.adaptor.createWithPayload(SEMICOLON27) @@ -893,7 +893,7 @@ class XKBGrammarParser(Parser): # $ANTLR start line_key - # XKBGrammar.g:119:1: line_key : TOKEN_KEY keycode keysyms SEMICOLON ; + # XKBGrammar.g:123:1: line_key : TOKEN_KEY keycode keysyms SEMICOLON ; def line_key(self, ): retval = self.line_key_return() @@ -913,36 +913,36 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:120:2: ( TOKEN_KEY keycode keysyms SEMICOLON ) - # XKBGrammar.g:120:4: TOKEN_KEY keycode keysyms SEMICOLON + # XKBGrammar.g:124:2: ( TOKEN_KEY keycode keysyms SEMICOLON ) + # XKBGrammar.g:124:4: TOKEN_KEY keycode keysyms SEMICOLON root_0 = self.adaptor.nil() TOKEN_KEY28 = self.input.LT(1) - self.match(self.input, TOKEN_KEY, self.FOLLOW_TOKEN_KEY_in_line_key615) + self.match(self.input, TOKEN_KEY, self.FOLLOW_TOKEN_KEY_in_line_key602) TOKEN_KEY28_tree = self.adaptor.createWithPayload(TOKEN_KEY28) self.adaptor.addChild(root_0, TOKEN_KEY28_tree) - self.following.append(self.FOLLOW_keycode_in_line_key617) + self.following.append(self.FOLLOW_keycode_in_line_key604) keycode29 = self.keycode() self.following.pop() self.adaptor.addChild(root_0, keycode29.tree) - self.following.append(self.FOLLOW_keysyms_in_line_key619) + self.following.append(self.FOLLOW_keysyms_in_line_key606) keysyms30 = self.keysyms() self.following.pop() self.adaptor.addChild(root_0, keysyms30.tree) SEMICOLON31 = self.input.LT(1) - self.match(self.input, SEMICOLON, self.FOLLOW_SEMICOLON_in_line_key621) + self.match(self.input, SEMICOLON, self.FOLLOW_SEMICOLON_in_line_key608) SEMICOLON31_tree = self.adaptor.createWithPayload(SEMICOLON31) self.adaptor.addChild(root_0, SEMICOLON31_tree) #action start - print "\tkey %(keycode)s %(keysyms)s ;" % { "keycode": self.input.toString(keycode29.start,keycode29.stop), "keysyms": self.input.toString(keysyms30.start,keysyms30.stop) } + print '\tkey %(keycode)s %(keysyms)s;' % { "keycode": self.input.toString(keycode29.start,keycode29.stop), "keysyms": keysyms30.value } #action end @@ -973,7 +973,7 @@ class XKBGrammarParser(Parser): # $ANTLR start keycode - # XKBGrammar.g:124:1: keycode : LOWERTHAN NAME GREATERTHAN -> ^( INCLUDE NAME ) ; + # XKBGrammar.g:128:1: keycode : LOWERTHAN NAME GREATERTHAN -> ^( INCLUDE NAME ) ; def keycode(self, ): retval = self.keycode_return() @@ -994,18 +994,18 @@ class XKBGrammarParser(Parser): try: try: - # XKBGrammar.g:125:2: ( LOWERTHAN NAME GREATERTHAN -> ^( INCLUDE NAME ) ) - # XKBGrammar.g:125:4: LOWERTHAN NAME GREATERTHAN + # XKBGrammar.g:129:2: ( LOWERTHAN NAME GREATERTHAN -> ^( INCLUDE NAME ) ) + # XKBGrammar.g:129:4: LOWERTHAN NAME GREATERTHAN LOWERTHAN32 = self.input.LT(1) - self.match(self.input, LOWERTHAN, self.FOLLOW_LOWERTHAN_in_keycode637) + self.match(self.input, LOWERTHAN, self.FOLLOW_LOWERTHAN_in_keycode624) stream_LOWERTHAN.add(LOWERTHAN32) NAME33 = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_keycode639) + self.match(self.input, NAME, self.FOLLOW_NAME_in_keycode626) stream_NAME.add(NAME33) GREATERTHAN34 = self.input.LT(1) - self.match(self.input, GREATERTHAN, self.FOLLOW_GREATERTHAN_in_keycode641) + self.match(self.input, GREATERTHAN, self.FOLLOW_GREATERTHAN_in_keycode628) stream_GREATERTHAN.add(GREATERTHAN34) # AST Rewrite @@ -1024,8 +1024,8 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 126:2: -> ^( INCLUDE NAME ) - # XKBGrammar.g:126:5: ^( INCLUDE NAME ) + # 130:2: -> ^( INCLUDE NAME ) + # XKBGrammar.g:130:5: ^( INCLUDE NAME ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(INCLUDE, "INCLUDE"), root_1) @@ -1060,11 +1060,12 @@ class XKBGrammarParser(Parser): self.start = None self.stop = None + self.value = None self.tree = None # $ANTLR start keysyms - # XKBGrammar.g:129:1: keysyms : LCURLY LBRACKET NAME ( COMMA NAME )* RBRACKET RCURLY ; + # XKBGrammar.g:133:1: keysyms returns [value] : LCURLY LBRACKET keysym+= NAME ( COMMA keysym+= NAME )* RBRACKET RCURLY ; def keysyms(self, ): retval = self.keysyms_return() @@ -1074,48 +1075,51 @@ class XKBGrammarParser(Parser): LCURLY35 = None LBRACKET36 = None - NAME37 = None - COMMA38 = None - NAME39 = None - RBRACKET40 = None - RCURLY41 = None + COMMA37 = None + RBRACKET38 = None + RCURLY39 = None + keysym = None + list_keysym = None LCURLY35_tree = None LBRACKET36_tree = None - NAME37_tree = None - COMMA38_tree = None - NAME39_tree = None - RBRACKET40_tree = None - RCURLY41_tree = None + COMMA37_tree = None + RBRACKET38_tree = None + RCURLY39_tree = None + keysym_tree = None try: try: - # XKBGrammar.g:130:2: ( LCURLY LBRACKET NAME ( COMMA NAME )* RBRACKET RCURLY ) - # XKBGrammar.g:130:4: LCURLY LBRACKET NAME ( COMMA NAME )* RBRACKET RCURLY + # XKBGrammar.g:134:2: ( LCURLY LBRACKET keysym+= NAME ( COMMA keysym+= NAME )* RBRACKET RCURLY ) + # XKBGrammar.g:134:4: LCURLY LBRACKET keysym+= NAME ( COMMA keysym+= NAME )* RBRACKET RCURLY root_0 = self.adaptor.nil() LCURLY35 = self.input.LT(1) - self.match(self.input, LCURLY, self.FOLLOW_LCURLY_in_keysyms663) + self.match(self.input, LCURLY, self.FOLLOW_LCURLY_in_keysyms653) LCURLY35_tree = self.adaptor.createWithPayload(LCURLY35) self.adaptor.addChild(root_0, LCURLY35_tree) LBRACKET36 = self.input.LT(1) - self.match(self.input, LBRACKET, self.FOLLOW_LBRACKET_in_keysyms665) + self.match(self.input, LBRACKET, self.FOLLOW_LBRACKET_in_keysyms655) LBRACKET36_tree = self.adaptor.createWithPayload(LBRACKET36) self.adaptor.addChild(root_0, LBRACKET36_tree) - NAME37 = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_keysyms667) + keysym = self.input.LT(1) + self.match(self.input, NAME, self.FOLLOW_NAME_in_keysyms659) - NAME37_tree = self.adaptor.createWithPayload(NAME37) - self.adaptor.addChild(root_0, NAME37_tree) + keysym_tree = self.adaptor.createWithPayload(keysym) + self.adaptor.addChild(root_0, keysym_tree) - # XKBGrammar.g:130:25: ( COMMA NAME )* + if list_keysym is None: + list_keysym = [] + list_keysym.append(keysym) + + # XKBGrammar.g:134:33: ( COMMA keysym+= NAME )* while True: #loop5 alt5 = 2 LA5_0 = self.input.LA(1) @@ -1125,20 +1129,24 @@ class XKBGrammarParser(Parser): if alt5 == 1: - # XKBGrammar.g:130:26: COMMA NAME - COMMA38 = self.input.LT(1) - self.match(self.input, COMMA, self.FOLLOW_COMMA_in_keysyms670) + # XKBGrammar.g:134:34: COMMA keysym+= NAME + COMMA37 = self.input.LT(1) + self.match(self.input, COMMA, self.FOLLOW_COMMA_in_keysyms662) + + COMMA37_tree = self.adaptor.createWithPayload(COMMA37) + self.adaptor.addChild(root_0, COMMA37_tree) - COMMA38_tree = self.adaptor.createWithPayload(COMMA38) - self.adaptor.addChild(root_0, COMMA38_tree) + keysym = self.input.LT(1) + self.match(self.input, NAME, self.FOLLOW_NAME_in_keysyms666) - NAME39 = self.input.LT(1) - self.match(self.input, NAME, self.FOLLOW_NAME_in_keysyms672) + keysym_tree = self.adaptor.createWithPayload(keysym) + self.adaptor.addChild(root_0, keysym_tree) - NAME39_tree = self.adaptor.createWithPayload(NAME39) - self.adaptor.addChild(root_0, NAME39_tree) + if list_keysym is None: + list_keysym = [] + list_keysym.append(keysym) @@ -1146,20 +1154,35 @@ class XKBGrammarParser(Parser): break #loop5 - RBRACKET40 = self.input.LT(1) - self.match(self.input, RBRACKET, self.FOLLOW_RBRACKET_in_keysyms676) + RBRACKET38 = self.input.LT(1) + self.match(self.input, RBRACKET, self.FOLLOW_RBRACKET_in_keysyms670) - RBRACKET40_tree = self.adaptor.createWithPayload(RBRACKET40) - self.adaptor.addChild(root_0, RBRACKET40_tree) + RBRACKET38_tree = self.adaptor.createWithPayload(RBRACKET38) + self.adaptor.addChild(root_0, RBRACKET38_tree) - RCURLY41 = self.input.LT(1) - self.match(self.input, RCURLY, self.FOLLOW_RCURLY_in_keysyms678) + RCURLY39 = self.input.LT(1) + self.match(self.input, RCURLY, self.FOLLOW_RCURLY_in_keysyms672) - RCURLY41_tree = self.adaptor.createWithPayload(RCURLY41) - self.adaptor.addChild(root_0, RCURLY41_tree) + RCURLY39_tree = self.adaptor.createWithPayload(RCURLY39) + self.adaptor.addChild(root_0, RCURLY39_tree) + #action start + + qstring = ["{ [ "] + first_elem = list_keysym[0].getText() + qstring.append(first_elem) + for elem in list_keysym: + if first_elem != "": + first_elem = "" + continue + qstring.append(", ") + qstring.append(elem.getText()) + qstring.append(" ] }") + retval.value = "".join(qstring) + + #action end @@ -1189,7 +1212,7 @@ class XKBGrammarParser(Parser): # $ANTLR start attribute_xkb - # XKBGrammar.g:137:1: attribute_xkb : ( TOKEN_DEFAULT | TOKEN_HIDDEN | TOKEN_PARTIAL | TOKEN_ALPHANUMERIC_KEYS | TOKEN_ALTERNATE_GROUP | TOKEN_XKB_SYMBOLS -> ^( ATTRIBUTES ATTRIBUTE ) ); + # XKBGrammar.g:154:1: attribute_xkb : ( TOKEN_DEFAULT | TOKEN_HIDDEN | TOKEN_PARTIAL | TOKEN_ALPHANUMERIC_KEYS | TOKEN_ALTERNATE_GROUP | TOKEN_XKB_SYMBOLS -> ^( ATTRIBUTES ATTRIBUTE ) ); def attribute_xkb(self, ): retval = self.attribute_xkb_return() @@ -1197,24 +1220,24 @@ class XKBGrammarParser(Parser): root_0 = None - TOKEN_DEFAULT42 = None - TOKEN_HIDDEN43 = None - TOKEN_PARTIAL44 = None - TOKEN_ALPHANUMERIC_KEYS45 = None - TOKEN_ALTERNATE_GROUP46 = None - TOKEN_XKB_SYMBOLS47 = None - - TOKEN_DEFAULT42_tree = None - TOKEN_HIDDEN43_tree = None - TOKEN_PARTIAL44_tree = None - TOKEN_ALPHANUMERIC_KEYS45_tree = None - TOKEN_ALTERNATE_GROUP46_tree = None - TOKEN_XKB_SYMBOLS47_tree = None + TOKEN_DEFAULT40 = None + TOKEN_HIDDEN41 = None + TOKEN_PARTIAL42 = None + TOKEN_ALPHANUMERIC_KEYS43 = None + TOKEN_ALTERNATE_GROUP44 = None + TOKEN_XKB_SYMBOLS45 = None + + TOKEN_DEFAULT40_tree = None + TOKEN_HIDDEN41_tree = None + TOKEN_PARTIAL42_tree = None + TOKEN_ALPHANUMERIC_KEYS43_tree = None + TOKEN_ALTERNATE_GROUP44_tree = None + TOKEN_XKB_SYMBOLS45_tree = None stream_TOKEN_XKB_SYMBOLS = RewriteRuleTokenStream(self.adaptor, "token TOKEN_XKB_SYMBOLS") try: try: - # XKBGrammar.g:138:2: ( TOKEN_DEFAULT | TOKEN_HIDDEN | TOKEN_PARTIAL | TOKEN_ALPHANUMERIC_KEYS | TOKEN_ALTERNATE_GROUP | TOKEN_XKB_SYMBOLS -> ^( ATTRIBUTES ATTRIBUTE ) ) + # XKBGrammar.g:155:2: ( TOKEN_DEFAULT | TOKEN_HIDDEN | TOKEN_PARTIAL | TOKEN_ALPHANUMERIC_KEYS | TOKEN_ALTERNATE_GROUP | TOKEN_XKB_SYMBOLS -> ^( ATTRIBUTES ATTRIBUTE ) ) alt6 = 6 LA6 = self.input.LA(1) if LA6 == TOKEN_DEFAULT: @@ -1230,20 +1253,20 @@ class XKBGrammarParser(Parser): elif LA6 == TOKEN_XKB_SYMBOLS: alt6 = 6 else: - nvae = NoViableAltException("137:1: attribute_xkb : ( TOKEN_DEFAULT | TOKEN_HIDDEN | TOKEN_PARTIAL | TOKEN_ALPHANUMERIC_KEYS | TOKEN_ALTERNATE_GROUP | TOKEN_XKB_SYMBOLS -> ^( ATTRIBUTES ATTRIBUTE ) );", 6, 0, self.input) + nvae = NoViableAltException("154:1: attribute_xkb : ( TOKEN_DEFAULT | TOKEN_HIDDEN | TOKEN_PARTIAL | TOKEN_ALPHANUMERIC_KEYS | TOKEN_ALTERNATE_GROUP | TOKEN_XKB_SYMBOLS -> ^( ATTRIBUTES ATTRIBUTE ) );", 6, 0, self.input) raise nvae if alt6 == 1: - # XKBGrammar.g:138:4: TOKEN_DEFAULT + # XKBGrammar.g:155:4: TOKEN_DEFAULT root_0 = self.adaptor.nil() - TOKEN_DEFAULT42 = self.input.LT(1) - self.match(self.input, TOKEN_DEFAULT, self.FOLLOW_TOKEN_DEFAULT_in_attribute_xkb695) + TOKEN_DEFAULT40 = self.input.LT(1) + self.match(self.input, TOKEN_DEFAULT, self.FOLLOW_TOKEN_DEFAULT_in_attribute_xkb697) - TOKEN_DEFAULT42_tree = self.adaptor.createWithPayload(TOKEN_DEFAULT42) - self.adaptor.addChild(root_0, TOKEN_DEFAULT42_tree) + TOKEN_DEFAULT40_tree = self.adaptor.createWithPayload(TOKEN_DEFAULT40) + self.adaptor.addChild(root_0, TOKEN_DEFAULT40_tree) #action start print "default", @@ -1251,15 +1274,15 @@ class XKBGrammarParser(Parser): elif alt6 == 2: - # XKBGrammar.g:139:4: TOKEN_HIDDEN + # XKBGrammar.g:156:4: TOKEN_HIDDEN root_0 = self.adaptor.nil() - TOKEN_HIDDEN43 = self.input.LT(1) - self.match(self.input, TOKEN_HIDDEN, self.FOLLOW_TOKEN_HIDDEN_in_attribute_xkb703) + TOKEN_HIDDEN41 = self.input.LT(1) + self.match(self.input, TOKEN_HIDDEN, self.FOLLOW_TOKEN_HIDDEN_in_attribute_xkb705) - TOKEN_HIDDEN43_tree = self.adaptor.createWithPayload(TOKEN_HIDDEN43) - self.adaptor.addChild(root_0, TOKEN_HIDDEN43_tree) + TOKEN_HIDDEN41_tree = self.adaptor.createWithPayload(TOKEN_HIDDEN41) + self.adaptor.addChild(root_0, TOKEN_HIDDEN41_tree) #action start print "hidden", @@ -1267,15 +1290,15 @@ class XKBGrammarParser(Parser): elif alt6 == 3: - # XKBGrammar.g:140:4: TOKEN_PARTIAL + # XKBGrammar.g:157:4: TOKEN_PARTIAL root_0 = self.adaptor.nil() - TOKEN_PARTIAL44 = self.input.LT(1) - self.match(self.input, TOKEN_PARTIAL, self.FOLLOW_TOKEN_PARTIAL_in_attribute_xkb712) + TOKEN_PARTIAL42 = self.input.LT(1) + self.match(self.input, TOKEN_PARTIAL, self.FOLLOW_TOKEN_PARTIAL_in_attribute_xkb714) - TOKEN_PARTIAL44_tree = self.adaptor.createWithPayload(TOKEN_PARTIAL44) - self.adaptor.addChild(root_0, TOKEN_PARTIAL44_tree) + TOKEN_PARTIAL42_tree = self.adaptor.createWithPayload(TOKEN_PARTIAL42) + self.adaptor.addChild(root_0, TOKEN_PARTIAL42_tree) #action start print "partial", @@ -1283,15 +1306,15 @@ class XKBGrammarParser(Parser): elif alt6 == 4: - # XKBGrammar.g:141:4: TOKEN_ALPHANUMERIC_KEYS + # XKBGrammar.g:158:4: TOKEN_ALPHANUMERIC_KEYS root_0 = self.adaptor.nil() - TOKEN_ALPHANUMERIC_KEYS45 = self.input.LT(1) - self.match(self.input, TOKEN_ALPHANUMERIC_KEYS, self.FOLLOW_TOKEN_ALPHANUMERIC_KEYS_in_attribute_xkb721) + TOKEN_ALPHANUMERIC_KEYS43 = self.input.LT(1) + self.match(self.input, TOKEN_ALPHANUMERIC_KEYS, self.FOLLOW_TOKEN_ALPHANUMERIC_KEYS_in_attribute_xkb723) - TOKEN_ALPHANUMERIC_KEYS45_tree = self.adaptor.createWithPayload(TOKEN_ALPHANUMERIC_KEYS45) - self.adaptor.addChild(root_0, TOKEN_ALPHANUMERIC_KEYS45_tree) + TOKEN_ALPHANUMERIC_KEYS43_tree = self.adaptor.createWithPayload(TOKEN_ALPHANUMERIC_KEYS43) + self.adaptor.addChild(root_0, TOKEN_ALPHANUMERIC_KEYS43_tree) #action start print "alphanumeric_keys", @@ -1299,15 +1322,15 @@ class XKBGrammarParser(Parser): elif alt6 == 5: - # XKBGrammar.g:142:4: TOKEN_ALTERNATE_GROUP + # XKBGrammar.g:159:4: TOKEN_ALTERNATE_GROUP root_0 = self.adaptor.nil() - TOKEN_ALTERNATE_GROUP46 = self.input.LT(1) - self.match(self.input, TOKEN_ALTERNATE_GROUP, self.FOLLOW_TOKEN_ALTERNATE_GROUP_in_attribute_xkb730) + TOKEN_ALTERNATE_GROUP44 = self.input.LT(1) + self.match(self.input, TOKEN_ALTERNATE_GROUP, self.FOLLOW_TOKEN_ALTERNATE_GROUP_in_attribute_xkb732) - TOKEN_ALTERNATE_GROUP46_tree = self.adaptor.createWithPayload(TOKEN_ALTERNATE_GROUP46) - self.adaptor.addChild(root_0, TOKEN_ALTERNATE_GROUP46_tree) + TOKEN_ALTERNATE_GROUP44_tree = self.adaptor.createWithPayload(TOKEN_ALTERNATE_GROUP44) + self.adaptor.addChild(root_0, TOKEN_ALTERNATE_GROUP44_tree) #action start print "alternate_group", @@ -1315,11 +1338,11 @@ class XKBGrammarParser(Parser): elif alt6 == 6: - # XKBGrammar.g:143:4: TOKEN_XKB_SYMBOLS - TOKEN_XKB_SYMBOLS47 = self.input.LT(1) - self.match(self.input, TOKEN_XKB_SYMBOLS, self.FOLLOW_TOKEN_XKB_SYMBOLS_in_attribute_xkb737) + # XKBGrammar.g:160:4: TOKEN_XKB_SYMBOLS + TOKEN_XKB_SYMBOLS45 = self.input.LT(1) + self.match(self.input, TOKEN_XKB_SYMBOLS, self.FOLLOW_TOKEN_XKB_SYMBOLS_in_attribute_xkb739) - stream_TOKEN_XKB_SYMBOLS.add(TOKEN_XKB_SYMBOLS47) + stream_TOKEN_XKB_SYMBOLS.add(TOKEN_XKB_SYMBOLS45) #action start print "xkb_symbols", #action end @@ -1339,8 +1362,8 @@ class XKBGrammarParser(Parser): root_0 = self.adaptor.nil() - # 144:2: -> ^( ATTRIBUTES ATTRIBUTE ) - # XKBGrammar.g:144:5: ^( ATTRIBUTES ATTRIBUTE ) + # 161:2: -> ^( ATTRIBUTES ATTRIBUTE ) + # XKBGrammar.g:161:5: ^( ATTRIBUTES ATTRIBUTE ) root_1 = self.adaptor.nil() root_1 = self.adaptor.becomeRoot(self.adaptor.createFromType(ATTRIBUTES, "ATTRIBUTES"), root_1) @@ -1372,58 +1395,58 @@ class XKBGrammarParser(Parser): - FOLLOW_section_in_layout359 = frozenset([4, 5, 6, 7, 9, 10]) - FOLLOW_EOF_in_layout362 = frozenset([1]) - FOLLOW_preamble_in_section377 = frozenset([17]) - FOLLOW_sectionmaterial_in_section379 = frozenset([1]) - FOLLOW_attribute_xkb_in_preamble405 = frozenset([4, 5, 6, 7, 9, 10, 20]) - FOLLOW_quotedstring_in_preamble410 = frozenset([1]) - FOLLOW_DQUOTE_in_quotedstring438 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]) - FOLLOW_set_in_quotedstring442 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]) - FOLLOW_DQUOTE_in_quotedstring448 = frozenset([1]) - FOLLOW_LCURLY_in_sectionmaterial485 = frozenset([11, 12, 13, 14]) - FOLLOW_line_include_in_sectionmaterial488 = frozenset([11, 12, 13, 14, 18]) - FOLLOW_line_name_in_sectionmaterial495 = frozenset([11, 12, 13, 14, 18]) - FOLLOW_line_keytype_in_sectionmaterial502 = frozenset([11, 12, 13, 14, 18]) - FOLLOW_line_key_in_sectionmaterial509 = frozenset([11, 12, 13, 14, 18]) - FOLLOW_RCURLY_in_sectionmaterial517 = frozenset([23]) - FOLLOW_SEMICOLON_in_sectionmaterial519 = frozenset([1]) - FOLLOW_TOKEN_INCLUDE_in_line_include531 = frozenset([20]) - FOLLOW_quotedstring_in_line_include535 = frozenset([1]) - FOLLOW_TOKEN_NAME_in_line_name550 = frozenset([15]) - FOLLOW_LBRACKET_in_line_name552 = frozenset([35]) - FOLLOW_NAME_in_line_name556 = frozenset([16]) - FOLLOW_RBRACKET_in_line_name558 = frozenset([24]) - FOLLOW_EQUAL_in_line_name560 = frozenset([20]) - FOLLOW_quotedstring_in_line_name564 = frozenset([23]) - FOLLOW_SEMICOLON_in_line_name566 = frozenset([1]) - FOLLOW_TOKEN_KEY_TYPE_in_line_keytype580 = frozenset([15]) - FOLLOW_LBRACKET_in_line_keytype582 = frozenset([35]) - FOLLOW_NAME_in_line_keytype586 = frozenset([16]) - FOLLOW_RBRACKET_in_line_keytype588 = frozenset([24]) - FOLLOW_EQUAL_in_line_keytype590 = frozenset([20]) - FOLLOW_DQUOTE_in_line_keytype592 = frozenset([35]) - FOLLOW_NAME_in_line_keytype596 = frozenset([20]) - FOLLOW_DQUOTE_in_line_keytype598 = frozenset([23]) - FOLLOW_SEMICOLON_in_line_keytype600 = frozenset([1]) - FOLLOW_TOKEN_KEY_in_line_key615 = frozenset([25]) - FOLLOW_keycode_in_line_key617 = frozenset([17]) - FOLLOW_keysyms_in_line_key619 = frozenset([23]) - FOLLOW_SEMICOLON_in_line_key621 = frozenset([1]) - FOLLOW_LOWERTHAN_in_keycode637 = frozenset([35]) - FOLLOW_NAME_in_keycode639 = frozenset([26]) - FOLLOW_GREATERTHAN_in_keycode641 = frozenset([1]) - FOLLOW_LCURLY_in_keysyms663 = frozenset([15]) - FOLLOW_LBRACKET_in_keysyms665 = frozenset([35]) - FOLLOW_NAME_in_keysyms667 = frozenset([16, 19]) - FOLLOW_COMMA_in_keysyms670 = frozenset([35]) - FOLLOW_NAME_in_keysyms672 = frozenset([16, 19]) - FOLLOW_RBRACKET_in_keysyms676 = frozenset([18]) - FOLLOW_RCURLY_in_keysyms678 = frozenset([1]) - FOLLOW_TOKEN_DEFAULT_in_attribute_xkb695 = frozenset([1]) - FOLLOW_TOKEN_HIDDEN_in_attribute_xkb703 = frozenset([1]) - FOLLOW_TOKEN_PARTIAL_in_attribute_xkb712 = frozenset([1]) - FOLLOW_TOKEN_ALPHANUMERIC_KEYS_in_attribute_xkb721 = frozenset([1]) - FOLLOW_TOKEN_ALTERNATE_GROUP_in_attribute_xkb730 = frozenset([1]) - FOLLOW_TOKEN_XKB_SYMBOLS_in_attribute_xkb737 = frozenset([1]) + FOLLOW_section_in_layout361 = frozenset([4, 5, 6, 7, 9, 10]) + FOLLOW_EOF_in_layout364 = frozenset([1]) + FOLLOW_preamble_in_section380 = frozenset([17]) + FOLLOW_sectionmaterial_in_section382 = frozenset([1]) + FOLLOW_attribute_xkb_in_preamble407 = frozenset([4, 5, 6, 7, 9, 10, 20]) + FOLLOW_quotedstring_in_preamble412 = frozenset([1]) + FOLLOW_DQUOTE_in_quotedstring437 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]) + FOLLOW_set_in_quotedstring441 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]) + FOLLOW_DQUOTE_in_quotedstring447 = frozenset([1]) + FOLLOW_LCURLY_in_sectionmaterial477 = frozenset([11, 12, 13, 14]) + FOLLOW_line_include_in_sectionmaterial480 = frozenset([11, 12, 13, 14, 18]) + FOLLOW_line_name_in_sectionmaterial486 = frozenset([11, 12, 13, 14, 18]) + FOLLOW_line_keytype_in_sectionmaterial492 = frozenset([11, 12, 13, 14, 18]) + FOLLOW_line_key_in_sectionmaterial498 = frozenset([11, 12, 13, 14, 18]) + FOLLOW_RCURLY_in_sectionmaterial505 = frozenset([23]) + FOLLOW_SEMICOLON_in_sectionmaterial507 = frozenset([1]) + FOLLOW_TOKEN_INCLUDE_in_line_include518 = frozenset([20]) + FOLLOW_quotedstring_in_line_include522 = frozenset([1]) + FOLLOW_TOKEN_NAME_in_line_name537 = frozenset([15]) + FOLLOW_LBRACKET_in_line_name539 = frozenset([35]) + FOLLOW_NAME_in_line_name543 = frozenset([16]) + FOLLOW_RBRACKET_in_line_name545 = frozenset([24]) + FOLLOW_EQUAL_in_line_name547 = frozenset([20]) + FOLLOW_quotedstring_in_line_name551 = frozenset([23]) + FOLLOW_SEMICOLON_in_line_name553 = frozenset([1]) + FOLLOW_TOKEN_KEY_TYPE_in_line_keytype567 = frozenset([15]) + FOLLOW_LBRACKET_in_line_keytype569 = frozenset([35]) + FOLLOW_NAME_in_line_keytype573 = frozenset([16]) + FOLLOW_RBRACKET_in_line_keytype575 = frozenset([24]) + FOLLOW_EQUAL_in_line_keytype577 = frozenset([20]) + FOLLOW_DQUOTE_in_line_keytype579 = frozenset([35]) + FOLLOW_NAME_in_line_keytype583 = frozenset([20]) + FOLLOW_DQUOTE_in_line_keytype585 = frozenset([23]) + FOLLOW_SEMICOLON_in_line_keytype587 = frozenset([1]) + FOLLOW_TOKEN_KEY_in_line_key602 = frozenset([25]) + FOLLOW_keycode_in_line_key604 = frozenset([17]) + FOLLOW_keysyms_in_line_key606 = frozenset([23]) + FOLLOW_SEMICOLON_in_line_key608 = frozenset([1]) + FOLLOW_LOWERTHAN_in_keycode624 = frozenset([35]) + FOLLOW_NAME_in_keycode626 = frozenset([26]) + FOLLOW_GREATERTHAN_in_keycode628 = frozenset([1]) + FOLLOW_LCURLY_in_keysyms653 = frozenset([15]) + FOLLOW_LBRACKET_in_keysyms655 = frozenset([35]) + FOLLOW_NAME_in_keysyms659 = frozenset([16, 19]) + FOLLOW_COMMA_in_keysyms662 = frozenset([35]) + FOLLOW_NAME_in_keysyms666 = frozenset([16, 19]) + FOLLOW_RBRACKET_in_keysyms670 = frozenset([18]) + FOLLOW_RCURLY_in_keysyms672 = frozenset([1]) + FOLLOW_TOKEN_DEFAULT_in_attribute_xkb697 = frozenset([1]) + FOLLOW_TOKEN_HIDDEN_in_attribute_xkb705 = frozenset([1]) + FOLLOW_TOKEN_PARTIAL_in_attribute_xkb714 = frozenset([1]) + FOLLOW_TOKEN_ALPHANUMERIC_KEYS_in_attribute_xkb723 = frozenset([1]) + FOLLOW_TOKEN_ALTERNATE_GROUP_in_attribute_xkb732 = frozenset([1]) + FOLLOW_TOKEN_XKB_SYMBOLS_in_attribute_xkb739 = frozenset([1]) diff --git a/XKBGrammar/XKBGrammarParser.pyc b/XKBGrammar/XKBGrammarParser.pyc Binary files differ. diff --git a/XKBGrammar/XKBGrammar__.g b/XKBGrammar/XKBGrammar__.g @@ -29,28 +29,29 @@ LOWERTHAN : '<' ; GREATERTHAN : '>' ; DOT : '.' ; -// $ANTLR src "XKBGrammar.g" 147 +// $ANTLR src "XKBGrammar.g" 164 fragment GENERIC_NAME : ('a'..'z'|'A'..'Z'|'_')('a'..'z'|'A'..'Z'|'_'|'0'..'9') ; -// $ANTLR src "XKBGrammar.g" 151 +// $ANTLR src "XKBGrammar.g" 168 NAME : ('a'..'z'|'A'..'Z'|'_'|'('|')'|'0'..'9')* ; // Comments are currently ignored. -// $ANTLR src "XKBGrammar.g" 156 -COMMENT : '//' (~('\n'|'\r'))* +// $ANTLR src "XKBGrammar.g" 173 +COMMENT + : '//' (~('\n'|'\r'))* { $channel = HIDDEN; } ; -// $ANTLR src "XKBGrammar.g" 160 +// $ANTLR src "XKBGrammar.g" 178 WS : ('\t'|' '|NEWLINE)+ { $channel=HIDDEN; } ; -// $ANTLR src "XKBGrammar.g" 164 +// $ANTLR src "XKBGrammar.g" 182 fragment NEWLINE : '\r'|'\n' ;