Nicolas Petton 12 роки тому
батько
коміт
a860ee83f2
2 змінених файлів з 7 додано та 7 видалено
  1. 6 6
      js/parser.js
  2. 1 1
      js/parser.pegjs

+ 6 - 6
js/parser.js

@@ -1474,26 +1474,26 @@ smalltalk.parser = (function(){
         
         
         var savedPos0 = pos;
-        if (input.substr(pos).match(/^[+*\/=><,@%~|&\-]/) !== null) {
+        if (input.substr(pos).match(/^[+*\/=><,@%~|&-\\]/) !== null) {
           var result3 = input.charAt(pos);
           pos++;
         } else {
           var result3 = null;
           if (reportMatchFailures) {
-            matchFailed("[+*\\/=><,@%~|&\\-]");
+            matchFailed("[+*\\/=><,@%~|&-\\\\]");
           }
         }
         if (result3 !== null) {
           var result1 = [];
           while (result3 !== null) {
             result1.push(result3);
-            if (input.substr(pos).match(/^[+*\/=><,@%~|&\-]/) !== null) {
+            if (input.substr(pos).match(/^[+*\/=><,@%~|&-\\]/) !== null) {
               var result3 = input.charAt(pos);
               pos++;
             } else {
               var result3 = null;
               if (reportMatchFailures) {
-                matchFailed("[+*\\/=><,@%~|&\\-]");
+                matchFailed("[+*\\/=><,@%~|&-\\\\]");
               }
             }
           }
@@ -1501,7 +1501,7 @@ smalltalk.parser = (function(){
           var result1 = null;
         }
         var result2 = result1 !== null
-          ? (function(bin) {return bin.join("")})(result1)
+          ? (function(bin) {return bin.join("").replace(/\\/g, '\\\\')})(result1)
           : null;
         if (result2 !== null) {
           var result0 = result2;
@@ -3895,4 +3895,4 @@ smalltalk.parser = (function(){
   result.SyntaxError.prototype = Error.prototype;
   
   return result;
-})();
+})();

+ 1 - 1
js/parser.pegjs

@@ -49,7 +49,7 @@ reference      = variable / classReference
 
 keywordPair    = key:keyword ws arg:binarySend ws {return {key:key, arg: arg}}
 
-binarySelector = bin:[+*/=><,@%~|&-]+ {return bin.join("")}
+binarySelector = bin:[+*/=><,@%~|&-\\]+ {return bin.join("").replace(/\\/g, '\\\\')}
 unarySelector  = identifier
 
 keywordPattern = pairs:(ws key:keyword ws arg:identifier {return {key:key, arg: arg}})+ {