scratch – Diff between revs 75 and 125

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 75 Rev 125
1 // Generated by CoffeeScript 1.10.0 1 // Generated by CoffeeScript 1.12.4
2 var Pattern, Unescaper, Utils; 2 var Pattern, Unescaper, Utils;
3   3  
4 Utils = require('./Utils'); 4 Utils = require('./Utils');
5   5  
6 Pattern = require('./Pattern'); 6 Pattern = require('./Pattern');
7   7  
8 Unescaper = (function() { 8 Unescaper = (function() {
9 function Unescaper() {} 9 function Unescaper() {}
10   10  
11 Unescaper.PATTERN_ESCAPED_CHARACTER = new Pattern('\\\\([0abt\tnvfre "\\/\\\\N_LP]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})'); 11 Unescaper.PATTERN_ESCAPED_CHARACTER = new Pattern('\\\\([0abt\tnvfre "\\/\\\\N_LP]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})');
12   12  
13 Unescaper.unescapeSingleQuotedString = function(value) { 13 Unescaper.unescapeSingleQuotedString = function(value) {
14 return value.replace(/\'\'/g, '\''); 14 return value.replace(/\'\'/g, '\'');
15 }; 15 };
16   16  
17 Unescaper.unescapeDoubleQuotedString = function(value) { 17 Unescaper.unescapeDoubleQuotedString = function(value) {
18 if (this._unescapeCallback == null) { 18 if (this._unescapeCallback == null) {
19 this._unescapeCallback = (function(_this) { 19 this._unescapeCallback = (function(_this) {
20 return function(str) { 20 return function(str) {
21 return _this.unescapeCharacter(str); 21 return _this.unescapeCharacter(str);
22 }; 22 };
23 })(this); 23 })(this);
24 } 24 }
25 return this.PATTERN_ESCAPED_CHARACTER.replace(value, this._unescapeCallback); 25 return this.PATTERN_ESCAPED_CHARACTER.replace(value, this._unescapeCallback);
26 }; 26 };
27   27  
28 Unescaper.unescapeCharacter = function(value) { 28 Unescaper.unescapeCharacter = function(value) {
29 var ch; 29 var ch;
30 ch = String.fromCharCode; 30 ch = String.fromCharCode;
31 switch (value.charAt(1)) { 31 switch (value.charAt(1)) {
32 case '0': 32 case '0':
33 return ch(0); 33 return ch(0);
34 case 'a': 34 case 'a':
35 return ch(7); 35 return ch(7);
36 case 'b': 36 case 'b':
37 return ch(8); 37 return ch(8);
38 case 't': 38 case 't':
39 return "\t"; 39 return "\t";
40 case "\t": 40 case "\t":
41 return "\t"; 41 return "\t";
42 case 'n': 42 case 'n':
43 return "\n"; 43 return "\n";
44 case 'v': 44 case 'v':
45 return ch(11); 45 return ch(11);
46 case 'f': 46 case 'f':
47 return ch(12); 47 return ch(12);
48 case 'r': 48 case 'r':
49 return ch(13); 49 return ch(13);
50 case 'e': 50 case 'e':
51 return ch(27); 51 return ch(27);
52 case ' ': 52 case ' ':
53 return ' '; 53 return ' ';
54 case '"': 54 case '"':
55 return '"'; 55 return '"';
56 case '/': 56 case '/':
57 return '/'; 57 return '/';
58 case '\\': 58 case '\\':
59 return '\\'; 59 return '\\';
60 case 'N': 60 case 'N':
61 return ch(0x0085); 61 return ch(0x0085);
62 case '_': 62 case '_':
63 return ch(0x00A0); 63 return ch(0x00A0);
64 case 'L': 64 case 'L':
65 return ch(0x2028); 65 return ch(0x2028);
66 case 'P': 66 case 'P':
67 return ch(0x2029); 67 return ch(0x2029);
68 case 'x': 68 case 'x':
69 return Utils.utf8chr(Utils.hexDec(value.substr(2, 2))); 69 return Utils.utf8chr(Utils.hexDec(value.substr(2, 2)));
70 case 'u': 70 case 'u':
71 return Utils.utf8chr(Utils.hexDec(value.substr(2, 4))); 71 return Utils.utf8chr(Utils.hexDec(value.substr(2, 4)));
72 case 'U': 72 case 'U':
73 return Utils.utf8chr(Utils.hexDec(value.substr(2, 8))); 73 return Utils.utf8chr(Utils.hexDec(value.substr(2, 8)));
74 default: 74 default:
75 return ''; 75 return '';
76 } 76 }
77 }; 77 };
78   78  
79 return Unescaper; 79 return Unescaper;
80   80  
81 })(); 81 })();
82   82  
83 module.exports = Unescaper; 83 module.exports = Unescaper;
84   84