From 8afed34cf99e891a59774ac6bbebad18aa027480 Mon Sep 17 00:00:00 2001 From: Marco Herrn Date: Thu, 6 Dec 2018 14:58:10 +0100 Subject: [PATCH] Correctly read files that include a 'replace' directive - Closes #23 - This commit only fixes the Exception occurring when reading a file that contains a 'replace' directive. However it does nothing to actually process it! Therefore another commit is necessary to actually handle 'replace' (in addition to 'override'). --- XKBGrammar.g | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/XKBGrammar.g b/XKBGrammar.g index a7e3e78..ebb1f5e 100644 --- a/XKBGrammar.g +++ b/XKBGrammar.g @@ -38,6 +38,7 @@ tokens ELEM_VIRTUALMODS; KEYELEMENTS; OVERRIDE; + REPLACE; OVERLAY; } @@ -97,7 +98,7 @@ line_keytype ; line_key - : OVERRIDE? 'key' '<' NAME '>' '{' keyelements (',' keyelements)* '}' + : (OVERRIDE|REPLACE)? 'key' '<' NAME '>' '{' keyelements (',' keyelements)* '}' -> ^(TOKEN_KEY OVERRIDE? ^(KEYCODEX NAME) keyelements+) ; @@ -120,6 +121,10 @@ override : 'override' ; +replace + : 'replace' + ; + keyelements : elem_keysyms | elem_keysymgroup @@ -174,6 +179,10 @@ OVERRIDE : 'override' ; +REPLACE + : 'replace' + ; + NAME : ( 'a'..'z' | 'A'..'Z' | '_' | '0'..'9' | '+' | '-' )* ;