Support verbatim keys/values in QueryCreator

Change-Id: I8c13f2429b41b1ecab9099dd206eae3701c7daca
diff --git a/dev/js/src/match/querycreator.js b/dev/js/src/match/querycreator.js
index 72c672e..42a0b62 100644
--- a/dev/js/src/match/querycreator.js
+++ b/dev/js/src/match/querycreator.js
@@ -19,6 +19,16 @@
   const loc = KorAP.Locale;
   loc.NEW_QUERY = loc.NEW_QUERY || 'New Query';
 
+  var esc = RegExp("[ \.\'\\\\]");
+  
+  function _getKeyValue (keyValue) {
+    if (keyValue.match(esc) != null) {
+      return "'" + keyValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'") + "'";
+    };
+    return keyValue;
+  };
+
+  
   function _getAnnotation (prefix, target) {
 
     // Complex annotation
@@ -28,7 +38,7 @@
       // Iterate over alternative annotations
       target.childNodes.forEach(function (item) {
         if (item.nodeType === 3)
-          orGroup.push(prefix + item.data);
+          orGroup.push(prefix + _getKeyValue(item.data));
       });
       return '(' + orGroup.sort().join(' | ') + ')';
     }
@@ -38,7 +48,7 @@
       if (target.innerText == '')
         return '';
 
-      return prefix + target.innerText;
+      return prefix + _getKeyValue(target.innerText);
     };
   };