jade-rails 1.10.0.0 → 1.11.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1893958aef2aee34af1f261f2f49a3f68fa3942
4
- data.tar.gz: 3ee3fceb59778a80cdd78497e755b63646c86d87
3
+ metadata.gz: ea5675355be3294f2c41a542b0903f7dce8a2892
4
+ data.tar.gz: 06585d018f271cbeb6b721c29053232699898ff5
5
5
  SHA512:
6
- metadata.gz: f35de914f6e170425d5debaaf6d61afe5542f531d175c2967773c49186a39590695ad8ac27950e6f067312743e4923aa5cf65bca2c8828d9ecca57279cb11f6d
7
- data.tar.gz: 28419c2adb76ead91612278b0a5139f89f56e66c16b8a5cb6a32ac6f4366068abcbd57dd024ece00ea34b3d3f41891cb0e19c368711ae656b96fd01885de650b
6
+ metadata.gz: 33a213e6b54f6b6e70f914c4e40c0849cc05e937ad6e980e5b52ec27b213666d147de6212e942da5a62b316933cdf9ee77653ecb76a82f9c9f3297c4f9b61e56
7
+ data.tar.gz: 26a32286e9e082a316de221e17d918fc1134cc3ca013983ca86f6f0a8f9346591c096dc7691dca8d1d3692a074c50173a0e90f72cb695e06ef332a8a1119d5ed
data/README.md CHANGED
@@ -11,7 +11,7 @@ to render Jade templates anywhere on the front end of your Rails app.
11
11
  Add to your Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'jade-rails', '~> 1.10.0.0'
14
+ gem 'jade-rails', '~> 1.11.0.0'
15
15
  ```
16
16
 
17
17
  In your `application.js`, require the Jade runtime before any files that include
data/lib/jade/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jade
2
- VERSION = '1.10.0.0'
2
+ VERSION = '1.11.0.0'
3
3
  end
@@ -827,7 +827,9 @@ Compiler.prototype = {
827
827
  if (args.length && /^\.\.\./.test(args[args.length - 1].trim())) {
828
828
  rest = args.pop().trim().replace(/^\.\.\./, '');
829
829
  }
830
- this.buf.push(name + ' = function(' + args.join(',') + '){');
830
+ // we need use jade_interp here for v8: https://code.google.com/p/v8/issues/detail?id=4165
831
+ // once fixed, use this: this.buf.push(name + ' = function(' + args.join(',') + '){');
832
+ this.buf.push(name + ' = jade_interp = function(' + args.join(',') + '){');
831
833
  this.buf.push('var block = (this && this.block), attributes = (this && this.attributes) || {};');
832
834
  if (rest) {
833
835
  this.buf.push('var ' + rest + ' = [];');
@@ -1781,6 +1783,21 @@ Lexer.prototype = {
1781
1783
  }
1782
1784
  },
1783
1785
 
1786
+
1787
+ /**
1788
+ * Block code.
1789
+ */
1790
+
1791
+ blockCode: function() {
1792
+ var captures;
1793
+ if (captures = /^-\n/.exec(this.input)) {
1794
+ this.consume(captures[0].length - 1);
1795
+ var tok = this.tok('blockCode');
1796
+ this.pipeless = true;
1797
+ return tok;
1798
+ }
1799
+ },
1800
+
1784
1801
  /**
1785
1802
  * Attributes.
1786
1803
  */
@@ -2040,6 +2057,7 @@ Lexer.prototype = {
2040
2057
  if (isMatch) {
2041
2058
  // consume test along with `\n` prefix if match
2042
2059
  this.consume(str.length + 1);
2060
+ ++this.lineno;
2043
2061
  tokens.push(str.substr(indent.length));
2044
2062
  }
2045
2063
  } while(this.input.length && isMatch);
@@ -2111,6 +2129,7 @@ Lexer.prototype = {
2111
2129
  || this["while"]()
2112
2130
  || this.tag()
2113
2131
  || this.filter()
2132
+ || this.blockCode()
2114
2133
  || this.code()
2115
2134
  || this.id()
2116
2135
  || this.className()
@@ -2982,6 +3001,8 @@ Parser.prototype = {
2982
3001
  return this.parseEach();
2983
3002
  case 'code':
2984
3003
  return this.parseCode();
3004
+ case 'blockCode':
3005
+ return this.parseBlockCode();
2985
3006
  case 'call':
2986
3007
  return this.parseCall();
2987
3008
  case 'interpolation':
@@ -3125,6 +3146,25 @@ Parser.prototype = {
3125
3146
  return node;
3126
3147
  },
3127
3148
 
3149
+ /**
3150
+ * block code
3151
+ */
3152
+
3153
+ parseBlockCode: function(){
3154
+ var tok = this.expect('blockCode');
3155
+ var node;
3156
+ var body = this.peek();
3157
+ var text;
3158
+ if (body.type === 'pipeless-text') {
3159
+ this.advance();
3160
+ text = body.val.join('\n');
3161
+ } else {
3162
+ text = '';
3163
+ }
3164
+ node = new nodes.Code(text, false, false);
3165
+ return node;
3166
+ },
3167
+
3128
3168
  /**
3129
3169
  * comment
3130
3170
  */
@@ -3755,12 +3795,21 @@ exports.attrs = function attrs(obj, terse){
3755
3795
  * @api private
3756
3796
  */
3757
3797
 
3758
- exports.escape = function escape(html){
3759
- var result = String(html)
3760
- .replace(/&/g, '&')
3761
- .replace(/</g, '&lt;')
3762
- .replace(/>/g, '&gt;')
3763
- .replace(/"/g, '&quot;');
3798
+ var jade_encode_html_rules = {
3799
+ '&': '&amp;',
3800
+ '<': '&lt;',
3801
+ '>': '&gt;',
3802
+ '"': '&quot;'
3803
+ };
3804
+ var jade_match_html = /[&<>"]/g;
3805
+
3806
+ function jade_encode_char(c) {
3807
+ return jade_encode_html_rules[c] || c;
3808
+ }
3809
+
3810
+ exports.escape = jade_escape;
3811
+ function jade_escape(html){
3812
+ var result = String(html).replace(jade_match_html, jade_encode_char);
3764
3813
  if (result === '' + html) return html;
3765
3814
  else return result;
3766
3815
  };
@@ -4148,7 +4197,7 @@ process.nextTick = function (fun) {
4148
4197
  }
4149
4198
  }
4150
4199
  queue.push(new Item(fun, args));
4151
- if (!draining) {
4200
+ if (queue.length === 1 && !draining) {
4152
4201
  setTimeout(drainQueue, 0);
4153
4202
  }
4154
4203
  };
@@ -4718,7 +4767,7 @@ var _whitespace = _dereq_("./whitespace");
4718
4767
  exports.isNewLine = _whitespace.isNewLine;
4719
4768
  exports.lineBreak = _whitespace.lineBreak;
4720
4769
  exports.lineBreakG = _whitespace.lineBreakG;
4721
- var version = "1.1.0";exports.version = version;
4770
+ var version = "1.2.2";exports.version = version;
4722
4771
 
4723
4772
  function parse(input, options) {
4724
4773
  var p = parser(options, input);
@@ -4742,7 +4791,689 @@ function parser(options, input) {
4742
4791
  return new Parser(getOptions(options), String(input));
4743
4792
  }
4744
4793
 
4745
- },{"./expression":2,"./identifier":3,"./location":4,"./lval":5,"./node":6,"./options":7,"./parseutil":8,"./state":9,"./statement":10,"./tokencontext":11,"./tokenize":12,"./tokentype":13,"./whitespace":15}],2:[function(_dereq_,module,exports){
4794
+ },{"./expression":6,"./identifier":7,"./location":8,"./lval":9,"./node":10,"./options":11,"./parseutil":12,"./state":13,"./statement":14,"./tokencontext":15,"./tokenize":16,"./tokentype":17,"./whitespace":19}],2:[function(_dereq_,module,exports){
4795
+ if (typeof Object.create === 'function') {
4796
+ // implementation from standard node.js 'util' module
4797
+ module.exports = function inherits(ctor, superCtor) {
4798
+ ctor.super_ = superCtor
4799
+ ctor.prototype = Object.create(superCtor.prototype, {
4800
+ constructor: {
4801
+ value: ctor,
4802
+ enumerable: false,
4803
+ writable: true,
4804
+ configurable: true
4805
+ }
4806
+ });
4807
+ };
4808
+ } else {
4809
+ // old school shim for old browsers
4810
+ module.exports = function inherits(ctor, superCtor) {
4811
+ ctor.super_ = superCtor
4812
+ var TempCtor = function () {}
4813
+ TempCtor.prototype = superCtor.prototype
4814
+ ctor.prototype = new TempCtor()
4815
+ ctor.prototype.constructor = ctor
4816
+ }
4817
+ }
4818
+
4819
+ },{}],3:[function(_dereq_,module,exports){
4820
+ // shim for using process in browser
4821
+
4822
+ var process = module.exports = {};
4823
+ var queue = [];
4824
+ var draining = false;
4825
+
4826
+ function drainQueue() {
4827
+ if (draining) {
4828
+ return;
4829
+ }
4830
+ draining = true;
4831
+ var currentQueue;
4832
+ var len = queue.length;
4833
+ while(len) {
4834
+ currentQueue = queue;
4835
+ queue = [];
4836
+ var i = -1;
4837
+ while (++i < len) {
4838
+ currentQueue[i]();
4839
+ }
4840
+ len = queue.length;
4841
+ }
4842
+ draining = false;
4843
+ }
4844
+ process.nextTick = function (fun) {
4845
+ queue.push(fun);
4846
+ if (!draining) {
4847
+ setTimeout(drainQueue, 0);
4848
+ }
4849
+ };
4850
+
4851
+ process.title = 'browser';
4852
+ process.browser = true;
4853
+ process.env = {};
4854
+ process.argv = [];
4855
+ process.version = ''; // empty string to avoid regexp issues
4856
+ process.versions = {};
4857
+
4858
+ function noop() {}
4859
+
4860
+ process.on = noop;
4861
+ process.addListener = noop;
4862
+ process.once = noop;
4863
+ process.off = noop;
4864
+ process.removeListener = noop;
4865
+ process.removeAllListeners = noop;
4866
+ process.emit = noop;
4867
+
4868
+ process.binding = function (name) {
4869
+ throw new Error('process.binding is not supported');
4870
+ };
4871
+
4872
+ // TODO(shtylman)
4873
+ process.cwd = function () { return '/' };
4874
+ process.chdir = function (dir) {
4875
+ throw new Error('process.chdir is not supported');
4876
+ };
4877
+ process.umask = function() { return 0; };
4878
+
4879
+ },{}],4:[function(_dereq_,module,exports){
4880
+ module.exports = function isBuffer(arg) {
4881
+ return arg && typeof arg === 'object'
4882
+ && typeof arg.copy === 'function'
4883
+ && typeof arg.fill === 'function'
4884
+ && typeof arg.readUInt8 === 'function';
4885
+ }
4886
+ },{}],5:[function(_dereq_,module,exports){
4887
+ (function (process,global){
4888
+ // Copyright Joyent, Inc. and other Node contributors.
4889
+ //
4890
+ // Permission is hereby granted, free of charge, to any person obtaining a
4891
+ // copy of this software and associated documentation files (the
4892
+ // "Software"), to deal in the Software without restriction, including
4893
+ // without limitation the rights to use, copy, modify, merge, publish,
4894
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
4895
+ // persons to whom the Software is furnished to do so, subject to the
4896
+ // following conditions:
4897
+ //
4898
+ // The above copyright notice and this permission notice shall be included
4899
+ // in all copies or substantial portions of the Software.
4900
+ //
4901
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4902
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4903
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4904
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4905
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4906
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4907
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
4908
+
4909
+ var formatRegExp = /%[sdj%]/g;
4910
+ exports.format = function(f) {
4911
+ if (!isString(f)) {
4912
+ var objects = [];
4913
+ for (var i = 0; i < arguments.length; i++) {
4914
+ objects.push(inspect(arguments[i]));
4915
+ }
4916
+ return objects.join(' ');
4917
+ }
4918
+
4919
+ var i = 1;
4920
+ var args = arguments;
4921
+ var len = args.length;
4922
+ var str = String(f).replace(formatRegExp, function(x) {
4923
+ if (x === '%%') return '%';
4924
+ if (i >= len) return x;
4925
+ switch (x) {
4926
+ case '%s': return String(args[i++]);
4927
+ case '%d': return Number(args[i++]);
4928
+ case '%j':
4929
+ try {
4930
+ return JSON.stringify(args[i++]);
4931
+ } catch (_) {
4932
+ return '[Circular]';
4933
+ }
4934
+ default:
4935
+ return x;
4936
+ }
4937
+ });
4938
+ for (var x = args[i]; i < len; x = args[++i]) {
4939
+ if (isNull(x) || !isObject(x)) {
4940
+ str += ' ' + x;
4941
+ } else {
4942
+ str += ' ' + inspect(x);
4943
+ }
4944
+ }
4945
+ return str;
4946
+ };
4947
+
4948
+
4949
+ // Mark that a method should not be used.
4950
+ // Returns a modified function which warns once by default.
4951
+ // If --no-deprecation is set, then it is a no-op.
4952
+ exports.deprecate = function(fn, msg) {
4953
+ // Allow for deprecating things in the process of starting up.
4954
+ if (isUndefined(global.process)) {
4955
+ return function() {
4956
+ return exports.deprecate(fn, msg).apply(this, arguments);
4957
+ };
4958
+ }
4959
+
4960
+ if (process.noDeprecation === true) {
4961
+ return fn;
4962
+ }
4963
+
4964
+ var warned = false;
4965
+ function deprecated() {
4966
+ if (!warned) {
4967
+ if (process.throwDeprecation) {
4968
+ throw new Error(msg);
4969
+ } else if (process.traceDeprecation) {
4970
+ console.trace(msg);
4971
+ } else {
4972
+ console.error(msg);
4973
+ }
4974
+ warned = true;
4975
+ }
4976
+ return fn.apply(this, arguments);
4977
+ }
4978
+
4979
+ return deprecated;
4980
+ };
4981
+
4982
+
4983
+ var debugs = {};
4984
+ var debugEnviron;
4985
+ exports.debuglog = function(set) {
4986
+ if (isUndefined(debugEnviron))
4987
+ debugEnviron = process.env.NODE_DEBUG || '';
4988
+ set = set.toUpperCase();
4989
+ if (!debugs[set]) {
4990
+ if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
4991
+ var pid = process.pid;
4992
+ debugs[set] = function() {
4993
+ var msg = exports.format.apply(exports, arguments);
4994
+ console.error('%s %d: %s', set, pid, msg);
4995
+ };
4996
+ } else {
4997
+ debugs[set] = function() {};
4998
+ }
4999
+ }
5000
+ return debugs[set];
5001
+ };
5002
+
5003
+
5004
+ /**
5005
+ * Echos the value of a value. Trys to print the value out
5006
+ * in the best way possible given the different types.
5007
+ *
5008
+ * @param {Object} obj The object to print out.
5009
+ * @param {Object} opts Optional options object that alters the output.
5010
+ */
5011
+ /* legacy: obj, showHidden, depth, colors*/
5012
+ function inspect(obj, opts) {
5013
+ // default options
5014
+ var ctx = {
5015
+ seen: [],
5016
+ stylize: stylizeNoColor
5017
+ };
5018
+ // legacy...
5019
+ if (arguments.length >= 3) ctx.depth = arguments[2];
5020
+ if (arguments.length >= 4) ctx.colors = arguments[3];
5021
+ if (isBoolean(opts)) {
5022
+ // legacy...
5023
+ ctx.showHidden = opts;
5024
+ } else if (opts) {
5025
+ // got an "options" object
5026
+ exports._extend(ctx, opts);
5027
+ }
5028
+ // set default options
5029
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
5030
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
5031
+ if (isUndefined(ctx.colors)) ctx.colors = false;
5032
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
5033
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
5034
+ return formatValue(ctx, obj, ctx.depth);
5035
+ }
5036
+ exports.inspect = inspect;
5037
+
5038
+
5039
+ // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
5040
+ inspect.colors = {
5041
+ 'bold' : [1, 22],
5042
+ 'italic' : [3, 23],
5043
+ 'underline' : [4, 24],
5044
+ 'inverse' : [7, 27],
5045
+ 'white' : [37, 39],
5046
+ 'grey' : [90, 39],
5047
+ 'black' : [30, 39],
5048
+ 'blue' : [34, 39],
5049
+ 'cyan' : [36, 39],
5050
+ 'green' : [32, 39],
5051
+ 'magenta' : [35, 39],
5052
+ 'red' : [31, 39],
5053
+ 'yellow' : [33, 39]
5054
+ };
5055
+
5056
+ // Don't use 'blue' not visible on cmd.exe
5057
+ inspect.styles = {
5058
+ 'special': 'cyan',
5059
+ 'number': 'yellow',
5060
+ 'boolean': 'yellow',
5061
+ 'undefined': 'grey',
5062
+ 'null': 'bold',
5063
+ 'string': 'green',
5064
+ 'date': 'magenta',
5065
+ // "name": intentionally not styling
5066
+ 'regexp': 'red'
5067
+ };
5068
+
5069
+
5070
+ function stylizeWithColor(str, styleType) {
5071
+ var style = inspect.styles[styleType];
5072
+
5073
+ if (style) {
5074
+ return '\u001b[' + inspect.colors[style][0] + 'm' + str +
5075
+ '\u001b[' + inspect.colors[style][1] + 'm';
5076
+ } else {
5077
+ return str;
5078
+ }
5079
+ }
5080
+
5081
+
5082
+ function stylizeNoColor(str, styleType) {
5083
+ return str;
5084
+ }
5085
+
5086
+
5087
+ function arrayToHash(array) {
5088
+ var hash = {};
5089
+
5090
+ array.forEach(function(val, idx) {
5091
+ hash[val] = true;
5092
+ });
5093
+
5094
+ return hash;
5095
+ }
5096
+
5097
+
5098
+ function formatValue(ctx, value, recurseTimes) {
5099
+ // Provide a hook for user-specified inspect functions.
5100
+ // Check that value is an object with an inspect function on it
5101
+ if (ctx.customInspect &&
5102
+ value &&
5103
+ isFunction(value.inspect) &&
5104
+ // Filter out the util module, it's inspect function is special
5105
+ value.inspect !== exports.inspect &&
5106
+ // Also filter out any prototype objects using the circular check.
5107
+ !(value.constructor && value.constructor.prototype === value)) {
5108
+ var ret = value.inspect(recurseTimes, ctx);
5109
+ if (!isString(ret)) {
5110
+ ret = formatValue(ctx, ret, recurseTimes);
5111
+ }
5112
+ return ret;
5113
+ }
5114
+
5115
+ // Primitive types cannot have properties
5116
+ var primitive = formatPrimitive(ctx, value);
5117
+ if (primitive) {
5118
+ return primitive;
5119
+ }
5120
+
5121
+ // Look up the keys of the object.
5122
+ var keys = Object.keys(value);
5123
+ var visibleKeys = arrayToHash(keys);
5124
+
5125
+ if (ctx.showHidden) {
5126
+ keys = Object.getOwnPropertyNames(value);
5127
+ }
5128
+
5129
+ // IE doesn't make error fields non-enumerable
5130
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
5131
+ if (isError(value)
5132
+ && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
5133
+ return formatError(value);
5134
+ }
5135
+
5136
+ // Some type of object without properties can be shortcutted.
5137
+ if (keys.length === 0) {
5138
+ if (isFunction(value)) {
5139
+ var name = value.name ? ': ' + value.name : '';
5140
+ return ctx.stylize('[Function' + name + ']', 'special');
5141
+ }
5142
+ if (isRegExp(value)) {
5143
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
5144
+ }
5145
+ if (isDate(value)) {
5146
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
5147
+ }
5148
+ if (isError(value)) {
5149
+ return formatError(value);
5150
+ }
5151
+ }
5152
+
5153
+ var base = '', array = false, braces = ['{', '}'];
5154
+
5155
+ // Make Array say that they are Array
5156
+ if (isArray(value)) {
5157
+ array = true;
5158
+ braces = ['[', ']'];
5159
+ }
5160
+
5161
+ // Make functions say that they are functions
5162
+ if (isFunction(value)) {
5163
+ var n = value.name ? ': ' + value.name : '';
5164
+ base = ' [Function' + n + ']';
5165
+ }
5166
+
5167
+ // Make RegExps say that they are RegExps
5168
+ if (isRegExp(value)) {
5169
+ base = ' ' + RegExp.prototype.toString.call(value);
5170
+ }
5171
+
5172
+ // Make dates with properties first say the date
5173
+ if (isDate(value)) {
5174
+ base = ' ' + Date.prototype.toUTCString.call(value);
5175
+ }
5176
+
5177
+ // Make error with message first say the error
5178
+ if (isError(value)) {
5179
+ base = ' ' + formatError(value);
5180
+ }
5181
+
5182
+ if (keys.length === 0 && (!array || value.length == 0)) {
5183
+ return braces[0] + base + braces[1];
5184
+ }
5185
+
5186
+ if (recurseTimes < 0) {
5187
+ if (isRegExp(value)) {
5188
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
5189
+ } else {
5190
+ return ctx.stylize('[Object]', 'special');
5191
+ }
5192
+ }
5193
+
5194
+ ctx.seen.push(value);
5195
+
5196
+ var output;
5197
+ if (array) {
5198
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
5199
+ } else {
5200
+ output = keys.map(function(key) {
5201
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
5202
+ });
5203
+ }
5204
+
5205
+ ctx.seen.pop();
5206
+
5207
+ return reduceToSingleString(output, base, braces);
5208
+ }
5209
+
5210
+
5211
+ function formatPrimitive(ctx, value) {
5212
+ if (isUndefined(value))
5213
+ return ctx.stylize('undefined', 'undefined');
5214
+ if (isString(value)) {
5215
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
5216
+ .replace(/'/g, "\\'")
5217
+ .replace(/\\"/g, '"') + '\'';
5218
+ return ctx.stylize(simple, 'string');
5219
+ }
5220
+ if (isNumber(value))
5221
+ return ctx.stylize('' + value, 'number');
5222
+ if (isBoolean(value))
5223
+ return ctx.stylize('' + value, 'boolean');
5224
+ // For some reason typeof null is "object", so special case here.
5225
+ if (isNull(value))
5226
+ return ctx.stylize('null', 'null');
5227
+ }
5228
+
5229
+
5230
+ function formatError(value) {
5231
+ return '[' + Error.prototype.toString.call(value) + ']';
5232
+ }
5233
+
5234
+
5235
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
5236
+ var output = [];
5237
+ for (var i = 0, l = value.length; i < l; ++i) {
5238
+ if (hasOwnProperty(value, String(i))) {
5239
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
5240
+ String(i), true));
5241
+ } else {
5242
+ output.push('');
5243
+ }
5244
+ }
5245
+ keys.forEach(function(key) {
5246
+ if (!key.match(/^\d+$/)) {
5247
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
5248
+ key, true));
5249
+ }
5250
+ });
5251
+ return output;
5252
+ }
5253
+
5254
+
5255
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
5256
+ var name, str, desc;
5257
+ desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
5258
+ if (desc.get) {
5259
+ if (desc.set) {
5260
+ str = ctx.stylize('[Getter/Setter]', 'special');
5261
+ } else {
5262
+ str = ctx.stylize('[Getter]', 'special');
5263
+ }
5264
+ } else {
5265
+ if (desc.set) {
5266
+ str = ctx.stylize('[Setter]', 'special');
5267
+ }
5268
+ }
5269
+ if (!hasOwnProperty(visibleKeys, key)) {
5270
+ name = '[' + key + ']';
5271
+ }
5272
+ if (!str) {
5273
+ if (ctx.seen.indexOf(desc.value) < 0) {
5274
+ if (isNull(recurseTimes)) {
5275
+ str = formatValue(ctx, desc.value, null);
5276
+ } else {
5277
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
5278
+ }
5279
+ if (str.indexOf('\n') > -1) {
5280
+ if (array) {
5281
+ str = str.split('\n').map(function(line) {
5282
+ return ' ' + line;
5283
+ }).join('\n').substr(2);
5284
+ } else {
5285
+ str = '\n' + str.split('\n').map(function(line) {
5286
+ return ' ' + line;
5287
+ }).join('\n');
5288
+ }
5289
+ }
5290
+ } else {
5291
+ str = ctx.stylize('[Circular]', 'special');
5292
+ }
5293
+ }
5294
+ if (isUndefined(name)) {
5295
+ if (array && key.match(/^\d+$/)) {
5296
+ return str;
5297
+ }
5298
+ name = JSON.stringify('' + key);
5299
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
5300
+ name = name.substr(1, name.length - 2);
5301
+ name = ctx.stylize(name, 'name');
5302
+ } else {
5303
+ name = name.replace(/'/g, "\\'")
5304
+ .replace(/\\"/g, '"')
5305
+ .replace(/(^"|"$)/g, "'");
5306
+ name = ctx.stylize(name, 'string');
5307
+ }
5308
+ }
5309
+
5310
+ return name + ': ' + str;
5311
+ }
5312
+
5313
+
5314
+ function reduceToSingleString(output, base, braces) {
5315
+ var numLinesEst = 0;
5316
+ var length = output.reduce(function(prev, cur) {
5317
+ numLinesEst++;
5318
+ if (cur.indexOf('\n') >= 0) numLinesEst++;
5319
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
5320
+ }, 0);
5321
+
5322
+ if (length > 60) {
5323
+ return braces[0] +
5324
+ (base === '' ? '' : base + '\n ') +
5325
+ ' ' +
5326
+ output.join(',\n ') +
5327
+ ' ' +
5328
+ braces[1];
5329
+ }
5330
+
5331
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
5332
+ }
5333
+
5334
+
5335
+ // NOTE: These type checking functions intentionally don't use `instanceof`
5336
+ // because it is fragile and can be easily faked with `Object.create()`.
5337
+ function isArray(ar) {
5338
+ return Array.isArray(ar);
5339
+ }
5340
+ exports.isArray = isArray;
5341
+
5342
+ function isBoolean(arg) {
5343
+ return typeof arg === 'boolean';
5344
+ }
5345
+ exports.isBoolean = isBoolean;
5346
+
5347
+ function isNull(arg) {
5348
+ return arg === null;
5349
+ }
5350
+ exports.isNull = isNull;
5351
+
5352
+ function isNullOrUndefined(arg) {
5353
+ return arg == null;
5354
+ }
5355
+ exports.isNullOrUndefined = isNullOrUndefined;
5356
+
5357
+ function isNumber(arg) {
5358
+ return typeof arg === 'number';
5359
+ }
5360
+ exports.isNumber = isNumber;
5361
+
5362
+ function isString(arg) {
5363
+ return typeof arg === 'string';
5364
+ }
5365
+ exports.isString = isString;
5366
+
5367
+ function isSymbol(arg) {
5368
+ return typeof arg === 'symbol';
5369
+ }
5370
+ exports.isSymbol = isSymbol;
5371
+
5372
+ function isUndefined(arg) {
5373
+ return arg === void 0;
5374
+ }
5375
+ exports.isUndefined = isUndefined;
5376
+
5377
+ function isRegExp(re) {
5378
+ return isObject(re) && objectToString(re) === '[object RegExp]';
5379
+ }
5380
+ exports.isRegExp = isRegExp;
5381
+
5382
+ function isObject(arg) {
5383
+ return typeof arg === 'object' && arg !== null;
5384
+ }
5385
+ exports.isObject = isObject;
5386
+
5387
+ function isDate(d) {
5388
+ return isObject(d) && objectToString(d) === '[object Date]';
5389
+ }
5390
+ exports.isDate = isDate;
5391
+
5392
+ function isError(e) {
5393
+ return isObject(e) &&
5394
+ (objectToString(e) === '[object Error]' || e instanceof Error);
5395
+ }
5396
+ exports.isError = isError;
5397
+
5398
+ function isFunction(arg) {
5399
+ return typeof arg === 'function';
5400
+ }
5401
+ exports.isFunction = isFunction;
5402
+
5403
+ function isPrimitive(arg) {
5404
+ return arg === null ||
5405
+ typeof arg === 'boolean' ||
5406
+ typeof arg === 'number' ||
5407
+ typeof arg === 'string' ||
5408
+ typeof arg === 'symbol' || // ES6 symbol
5409
+ typeof arg === 'undefined';
5410
+ }
5411
+ exports.isPrimitive = isPrimitive;
5412
+
5413
+ exports.isBuffer = _dereq_('./support/isBuffer');
5414
+
5415
+ function objectToString(o) {
5416
+ return Object.prototype.toString.call(o);
5417
+ }
5418
+
5419
+
5420
+ function pad(n) {
5421
+ return n < 10 ? '0' + n.toString(10) : n.toString(10);
5422
+ }
5423
+
5424
+
5425
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
5426
+ 'Oct', 'Nov', 'Dec'];
5427
+
5428
+ // 26 Feb 16:19:34
5429
+ function timestamp() {
5430
+ var d = new Date();
5431
+ var time = [pad(d.getHours()),
5432
+ pad(d.getMinutes()),
5433
+ pad(d.getSeconds())].join(':');
5434
+ return [d.getDate(), months[d.getMonth()], time].join(' ');
5435
+ }
5436
+
5437
+
5438
+ // log is just a thin wrapper to console.log that prepends a timestamp
5439
+ exports.log = function() {
5440
+ console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
5441
+ };
5442
+
5443
+
5444
+ /**
5445
+ * Inherit the prototype methods from one constructor into another.
5446
+ *
5447
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
5448
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
5449
+ * during bootstrapping this function needs to be rewritten using some native
5450
+ * functions as prototype setup using normal JavaScript does not work as
5451
+ * expected during bootstrapping (see mirror.js in r114903).
5452
+ *
5453
+ * @param {function} ctor Constructor function which needs to inherit the
5454
+ * prototype.
5455
+ * @param {function} superCtor Constructor function to inherit prototype from.
5456
+ */
5457
+ exports.inherits = _dereq_('inherits');
5458
+
5459
+ exports._extend = function(origin, add) {
5460
+ // Don't do anything if add isn't an object
5461
+ if (!add || !isObject(add)) return origin;
5462
+
5463
+ var keys = Object.keys(add);
5464
+ var i = keys.length;
5465
+ while (i--) {
5466
+ origin[keys[i]] = add[keys[i]];
5467
+ }
5468
+ return origin;
5469
+ };
5470
+
5471
+ function hasOwnProperty(obj, prop) {
5472
+ return Object.prototype.hasOwnProperty.call(obj, prop);
5473
+ }
5474
+
5475
+ }).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5476
+ },{"./support/isBuffer":4,"_process":3,"inherits":2}],6:[function(_dereq_,module,exports){
4746
5477
  // A recursive descent parser operates by defining functions for all
4747
5478
  // syntactic elements, and recursively calling those, each function
4748
5479
  // advancing the input stream and returning an AST node. Precedence
@@ -4903,6 +5634,16 @@ pp.parseExprOps = function (noIn, refShorthandDefaultPos) {
4903
5634
 
4904
5635
  pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) {
4905
5636
  var prec = this.type.binop;
5637
+ if (Array.isArray(leftStartPos)) {
5638
+ if (this.options.locations && noIn === undefined) {
5639
+ // shift arguments to left by one
5640
+ noIn = minPrec;
5641
+ minPrec = leftStartLoc;
5642
+ // flatten leftStartPos
5643
+ leftStartLoc = leftStartPos[1];
5644
+ leftStartPos = leftStartPos[0];
5645
+ }
5646
+ }
4906
5647
  if (prec != null && (!noIn || this.type !== tt._in)) {
4907
5648
  if (prec > minPrec) {
4908
5649
  var node = this.startNodeAt(leftStartPos, leftStartLoc);
@@ -4961,6 +5702,15 @@ pp.parseExprSubscripts = function (refShorthandDefaultPos) {
4961
5702
  };
4962
5703
 
4963
5704
  pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
5705
+ if (Array.isArray(startPos)) {
5706
+ if (this.options.locations && noCalls === undefined) {
5707
+ // shift arguments to left by one
5708
+ noCalls = startLoc;
5709
+ // flatten startPos
5710
+ startLoc = startPos[1];
5711
+ startPos = startPos[0];
5712
+ }
5713
+ }
4964
5714
  for (;;) {
4965
5715
  if (this.eat(tt.dot)) {
4966
5716
  var node = this.startNodeAt(startPos, startLoc);
@@ -5276,12 +6026,12 @@ pp.parsePropertyName = function (prop) {
5276
6026
  prop.computed = true;
5277
6027
  prop.key = this.parseMaybeAssign();
5278
6028
  this.expect(tt.bracketR);
5279
- return;
6029
+ return prop.key;
5280
6030
  } else {
5281
6031
  prop.computed = false;
5282
6032
  }
5283
6033
  }
5284
- prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true);
6034
+ return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true);
5285
6035
  };
5286
6036
 
5287
6037
  // Initialize empty function node.
@@ -5435,7 +6185,7 @@ pp.parseComprehension = function (node, isGenerator) {
5435
6185
  return this.finishNode(node, "ComprehensionExpression");
5436
6186
  };
5437
6187
 
5438
- },{"./identifier":3,"./state":9,"./tokentype":13,"./util":14}],3:[function(_dereq_,module,exports){
6188
+ },{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],7:[function(_dereq_,module,exports){
5439
6189
 
5440
6190
 
5441
6191
  // Test whether a given character code starts an identifier.
@@ -5598,7 +6348,7 @@ function isIdentifierChar(code, astral) {
5598
6348
  }return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
5599
6349
  }
5600
6350
 
5601
- },{}],4:[function(_dereq_,module,exports){
6351
+ },{}],8:[function(_dereq_,module,exports){
5602
6352
  "use strict";
5603
6353
 
5604
6354
  var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
@@ -5616,6 +6366,8 @@ var Parser = _dereq_("./state").Parser;
5616
6366
 
5617
6367
  var lineBreakG = _dereq_("./whitespace").lineBreakG;
5618
6368
 
6369
+ var deprecate = _dereq_("util").deprecate;
6370
+
5619
6371
  // These are used when `options.locations` is on, for the
5620
6372
  // `startLoc` and `endLoc` properties.
5621
6373
 
@@ -5675,7 +6427,11 @@ pp.curPosition = function () {
5675
6427
  return new Position(this.curLine, this.pos - this.lineStart);
5676
6428
  };
5677
6429
 
5678
- },{"./state":9,"./whitespace":15}],5:[function(_dereq_,module,exports){
6430
+ pp.markPosition = function () {
6431
+ return this.options.locations ? [this.start, this.startLoc] : this.start;
6432
+ };
6433
+
6434
+ },{"./state":13,"./whitespace":19,"util":5}],9:[function(_dereq_,module,exports){
5679
6435
  "use strict";
5680
6436
 
5681
6437
  var tt = _dereq_("./tokentype").types;
@@ -5828,6 +6584,15 @@ pp.parseBindingListItem = function (param) {
5828
6584
  // Parses assignment pattern around given atom if possible.
5829
6585
 
5830
6586
  pp.parseMaybeDefault = function (startPos, startLoc, left) {
6587
+ if (Array.isArray(startPos)) {
6588
+ if (this.options.locations && noCalls === undefined) {
6589
+ // shift arguments to left by one
6590
+ left = startLoc;
6591
+ // flatten startPos
6592
+ startLoc = startPos[1];
6593
+ startPos = startPos[0];
6594
+ }
6595
+ }
5831
6596
  left = left || this.parseBindingAtom();
5832
6597
  if (!this.eat(tt.eq)) return left;
5833
6598
  var node = this.startNodeAt(startPos, startLoc);
@@ -5883,7 +6648,7 @@ pp.checkLVal = function (expr, isBinding, checkClashes) {
5883
6648
  }
5884
6649
  };
5885
6650
 
5886
- },{"./identifier":3,"./state":9,"./tokentype":13,"./util":14}],6:[function(_dereq_,module,exports){
6651
+ },{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],10:[function(_dereq_,module,exports){
5887
6652
  "use strict";
5888
6653
 
5889
6654
  var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
@@ -5913,6 +6678,13 @@ pp.startNode = function () {
5913
6678
 
5914
6679
  pp.startNodeAt = function (pos, loc) {
5915
6680
  var node = new Node();
6681
+ if (Array.isArray(pos)) {
6682
+ if (this.options.locations && loc === undefined) {
6683
+ // flatten pos
6684
+ loc = pos[1];
6685
+ pos = pos[0];
6686
+ }
6687
+ }
5916
6688
  node.start = pos;
5917
6689
  if (this.options.locations) node.loc = new SourceLocation(this, loc);
5918
6690
  if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;
@@ -5934,13 +6706,20 @@ pp.finishNode = function (node, type) {
5934
6706
 
5935
6707
  pp.finishNodeAt = function (node, type, pos, loc) {
5936
6708
  node.type = type;
6709
+ if (Array.isArray(pos)) {
6710
+ if (this.options.locations && loc === undefined) {
6711
+ // flatten pos
6712
+ loc = pos[1];
6713
+ pos = pos[0];
6714
+ }
6715
+ }
5937
6716
  node.end = pos;
5938
6717
  if (this.options.locations) node.loc.end = loc;
5939
6718
  if (this.options.ranges) node.range[1] = pos;
5940
6719
  return node;
5941
6720
  };
5942
6721
 
5943
- },{"./location":4,"./state":9}],7:[function(_dereq_,module,exports){
6722
+ },{"./location":8,"./state":13}],11:[function(_dereq_,module,exports){
5944
6723
 
5945
6724
 
5946
6725
  // Interpret and default an options object
@@ -6071,7 +6850,7 @@ function pushComment(options, array) {
6071
6850
  };
6072
6851
  }
6073
6852
 
6074
- },{"./location":4,"./util":14}],8:[function(_dereq_,module,exports){
6853
+ },{"./location":8,"./util":18}],12:[function(_dereq_,module,exports){
6075
6854
  "use strict";
6076
6855
 
6077
6856
  var tt = _dereq_("./tokentype").types;
@@ -6161,7 +6940,7 @@ pp.unexpected = function (pos) {
6161
6940
  this.raise(pos != null ? pos : this.start, "Unexpected token");
6162
6941
  };
6163
6942
 
6164
- },{"./state":9,"./tokentype":13,"./whitespace":15}],9:[function(_dereq_,module,exports){
6943
+ },{"./state":13,"./tokentype":17,"./whitespace":19}],13:[function(_dereq_,module,exports){
6165
6944
  "use strict";
6166
6945
 
6167
6946
  exports.Parser = Parser;
@@ -6172,19 +6951,20 @@ var _identifier = _dereq_("./identifier");
6172
6951
  var reservedWords = _identifier.reservedWords;
6173
6952
  var keywords = _identifier.keywords;
6174
6953
 
6175
- var _tokentype = _dereq_("./tokentype");
6954
+ var tt = _dereq_("./tokentype").types;
6176
6955
 
6177
- var tt = _tokentype.types;
6178
- var lineBreak = _tokentype.lineBreak;
6956
+ var lineBreak = _dereq_("./whitespace").lineBreak;
6179
6957
 
6180
6958
  function Parser(options, input, startPos) {
6181
6959
  this.options = options;
6182
- this.loadPlugins(this.options.plugins);
6183
6960
  this.sourceFile = this.options.sourceFile || null;
6184
6961
  this.isKeyword = keywords[this.options.ecmaVersion >= 6 ? 6 : 5];
6185
6962
  this.isReservedWord = reservedWords[this.options.ecmaVersion];
6186
6963
  this.input = input;
6187
6964
 
6965
+ // Load plugins
6966
+ this.loadPlugins(this.options.plugins);
6967
+
6188
6968
  // Set up token state
6189
6969
 
6190
6970
  // The current position of the tokenizer in the input.
@@ -6250,7 +7030,7 @@ Parser.prototype.loadPlugins = function (plugins) {
6250
7030
  }
6251
7031
  };
6252
7032
 
6253
- },{"./identifier":3,"./tokentype":13}],10:[function(_dereq_,module,exports){
7033
+ },{"./identifier":7,"./tokentype":17,"./whitespace":19}],14:[function(_dereq_,module,exports){
6254
7034
  "use strict";
6255
7035
 
6256
7036
  var tt = _dereq_("./tokentype").types;
@@ -6680,32 +7460,37 @@ pp.parseClass = function (node, isStatement) {
6680
7460
  this.parseClassId(node, isStatement);
6681
7461
  this.parseClassSuper(node);
6682
7462
  var classBody = this.startNode();
7463
+ var hadConstructor = false;
6683
7464
  classBody.body = [];
6684
7465
  this.expect(tt.braceL);
6685
7466
  while (!this.eat(tt.braceR)) {
6686
7467
  if (this.eat(tt.semi)) continue;
6687
7468
  var method = this.startNode();
6688
7469
  var isGenerator = this.eat(tt.star);
7470
+ var isMaybeStatic = this.type === tt.name && this.value === "static";
6689
7471
  this.parsePropertyName(method);
6690
- if (this.type !== tt.parenL && !method.computed && method.key.type === "Identifier" && method.key.name === "static") {
7472
+ method["static"] = isMaybeStatic && this.type !== tt.parenL;
7473
+ if (method["static"]) {
6691
7474
  if (isGenerator) this.unexpected();
6692
- method["static"] = true;
6693
7475
  isGenerator = this.eat(tt.star);
6694
7476
  this.parsePropertyName(method);
6695
- } else {
6696
- method["static"] = false;
6697
7477
  }
6698
7478
  method.kind = "method";
6699
- if (!method.computed && !isGenerator) {
6700
- if (method.key.type === "Identifier") {
6701
- if (this.type !== tt.parenL && (method.key.name === "get" || method.key.name === "set")) {
6702
- method.kind = method.key.name;
6703
- this.parsePropertyName(method);
6704
- } else if (!method["static"] && method.key.name === "constructor") {
6705
- method.kind = "constructor";
6706
- }
6707
- } else if (!method["static"] && method.key.type === "Literal" && method.key.value === "constructor") {
7479
+ if (!method.computed) {
7480
+ var key = method.key;
7481
+
7482
+ var isGetSet = false;
7483
+ if (!isGenerator && key.type === "Identifier" && this.type !== tt.parenL && (key.name === "get" || key.name === "set")) {
7484
+ isGetSet = true;
7485
+ method.kind = key.name;
7486
+ key = this.parsePropertyName(method);
7487
+ }
7488
+ if (!method["static"] && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) {
7489
+ if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class");
7490
+ if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier");
7491
+ if (isGenerator) this.raise(key.start, "Constructor can't be a generator");
6708
7492
  method.kind = "constructor";
7493
+ hadConstructor = true;
6709
7494
  }
6710
7495
  }
6711
7496
  this.parseClassMethod(classBody, method, isGenerator);
@@ -6852,7 +7637,7 @@ pp.parseImportSpecifiers = function () {
6852
7637
  return nodes;
6853
7638
  };
6854
7639
 
6855
- },{"./state":9,"./tokentype":13,"./whitespace":15}],11:[function(_dereq_,module,exports){
7640
+ },{"./state":13,"./tokentype":17,"./whitespace":19}],15:[function(_dereq_,module,exports){
6856
7641
  "use strict";
6857
7642
 
6858
7643
  var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
@@ -6959,7 +7744,7 @@ tt.backQuote.updateContext = function () {
6959
7744
 
6960
7745
  // tokExprAllowed stays unchanged
6961
7746
 
6962
- },{"./state":9,"./tokentype":13,"./whitespace":15}],12:[function(_dereq_,module,exports){
7747
+ },{"./state":13,"./tokentype":17,"./whitespace":19}],16:[function(_dereq_,module,exports){
6963
7748
  "use strict";
6964
7749
 
6965
7750
  var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
@@ -7006,6 +7791,9 @@ var Token = exports.Token = function Token(p) {
7006
7791
 
7007
7792
  var pp = Parser.prototype;
7008
7793
 
7794
+ // Are we running under Rhino?
7795
+ var isRhino = typeof Packages !== "undefined";
7796
+
7009
7797
  // Move to the next token
7010
7798
 
7011
7799
  pp.next = function () {
@@ -7425,19 +8213,21 @@ pp.readRegexp = function () {
7425
8213
  }
7426
8214
  }
7427
8215
  // Detect invalid regular expressions.
7428
- try {
7429
- new RegExp(tmp);
7430
- } catch (e) {
7431
- if (e instanceof SyntaxError) this.raise(start, "Error parsing regular expression: " + e.message);
7432
- this.raise(e);
7433
- }
7434
- // Get a regular expression object for this pattern-flag pair, or `null` in
7435
- // case the current environment doesn't support the flags it uses.
7436
- var value = undefined;
7437
- try {
7438
- value = new RegExp(content, mods);
7439
- } catch (err) {
7440
- value = null;
8216
+ var value = null;
8217
+ // Rhino's regular expression parser is flaky and throws uncatchable exceptions,
8218
+ // so don't do detection if we are running under Rhino
8219
+ if (!isRhino) {
8220
+ try {
8221
+ new RegExp(tmp);
8222
+ } catch (e) {
8223
+ if (e instanceof SyntaxError) this.raise(start, "Error parsing regular expression: " + e.message);
8224
+ this.raise(e);
8225
+ }
8226
+ // Get a regular expression object for this pattern-flag pair, or `null` in
8227
+ // case the current environment doesn't support the flags it uses.
8228
+ try {
8229
+ value = new RegExp(content, mods);
8230
+ } catch (err) {}
7441
8231
  }
7442
8232
  return this.finishToken(tt.regexp, { pattern: content, flags: mods, value: value });
7443
8233
  };
@@ -7701,7 +8491,7 @@ pp.readWord = function () {
7701
8491
  return this.finishToken(type, word);
7702
8492
  };
7703
8493
 
7704
- },{"./identifier":3,"./location":4,"./state":9,"./tokentype":13,"./whitespace":15}],13:[function(_dereq_,module,exports){
8494
+ },{"./identifier":7,"./location":8,"./state":13,"./tokentype":17,"./whitespace":19}],17:[function(_dereq_,module,exports){
7705
8495
  "use strict";
7706
8496
 
7707
8497
  var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
@@ -7857,7 +8647,7 @@ kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true });
7857
8647
  kw("void", { beforeExpr: true, prefix: true, startsExpr: true });
7858
8648
  kw("delete", { beforeExpr: true, prefix: true, startsExpr: true });
7859
8649
 
7860
- },{}],14:[function(_dereq_,module,exports){
8650
+ },{}],18:[function(_dereq_,module,exports){
7861
8651
  "use strict";
7862
8652
 
7863
8653
  exports.isArray = isArray;
@@ -7875,7 +8665,7 @@ function has(obj, propName) {
7875
8665
  return Object.prototype.hasOwnProperty.call(obj, propName);
7876
8666
  }
7877
8667
 
7878
- },{}],15:[function(_dereq_,module,exports){
8668
+ },{}],19:[function(_dereq_,module,exports){
7879
8669
  "use strict";
7880
8670
 
7881
8671
  exports.isNewLine = isNewLine;
@@ -7957,13 +8747,13 @@ exports.findNodeBefore = findNodeBefore;
7957
8747
  exports.make = make;
7958
8748
  exports.__esModule = true;
7959
8749
 
7960
- function simple(node, visitors, base, state, override) {
8750
+ function simple(node, visitors, base, state) {
7961
8751
  if (!base) base = exports.base;(function c(node, st, override) {
7962
8752
  var type = override || node.type,
7963
8753
  found = visitors[type];
7964
8754
  base[type](node, st, c);
7965
8755
  if (found) found(node, st);
7966
- })(node, state, override);
8756
+ })(node, state);
7967
8757
  }
7968
8758
 
7969
8759
  function ancestor(node, visitors, base, state) {
@@ -7980,10 +8770,10 @@ function ancestor(node, visitors, base, state) {
7980
8770
  })(node, state);
7981
8771
  }
7982
8772
 
7983
- function recursive(node, state, funcs, base, override) {
8773
+ function recursive(node, state, funcs, base) {
7984
8774
  var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) {
7985
8775
  visitor[override || node.type](node, st, c);
7986
- })(node, state, override);
8776
+ })(node, state);
7987
8777
  }
7988
8778
 
7989
8779
  function makeTest(test) {
@@ -8125,15 +8915,12 @@ base.SwitchStatement = function (node, st, c) {
8125
8915
  base.ReturnStatement = base.YieldExpression = function (node, st, c) {
8126
8916
  if (node.argument) c(node.argument, st, "Expression");
8127
8917
  };
8128
- base.ThrowStatement = base.SpreadElement = function (node, st, c) {
8918
+ base.ThrowStatement = base.SpreadElement = base.RestElement = function (node, st, c) {
8129
8919
  return c(node.argument, st, "Expression");
8130
8920
  };
8131
8921
  base.TryStatement = function (node, st, c) {
8132
8922
  c(node.block, st, "Statement");
8133
- if (node.handler) {
8134
- c(node.handler.param, st, "Pattern");
8135
- c(node.handler.body, st, "ScopeBody");
8136
- }
8923
+ if (node.handler) c(node.handler.body, st, "ScopeBody");
8137
8924
  if (node.finalizer) c(node.finalizer, st, "Statement");
8138
8925
  };
8139
8926
  base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
@@ -8162,49 +8949,26 @@ base.FunctionDeclaration = function (node, st, c) {
8162
8949
  base.VariableDeclaration = function (node, st, c) {
8163
8950
  for (var i = 0; i < node.declarations.length; ++i) {
8164
8951
  var decl = node.declarations[i];
8165
- c(decl.id, st, "Pattern");
8166
8952
  if (decl.init) c(decl.init, st, "Expression");
8167
8953
  }
8168
8954
  };
8169
8955
 
8170
8956
  base.Function = function (node, st, c) {
8171
- for (var i = 0; i < node.params.length; i++) {
8172
- c(node.params[i], st, "Pattern");
8173
- }c(node.body, st, "ScopeBody");
8957
+ return c(node.body, st, "ScopeBody");
8174
8958
  };
8175
8959
  base.ScopeBody = function (node, st, c) {
8176
8960
  return c(node, st, "Statement");
8177
8961
  };
8178
8962
 
8179
- base.Pattern = function (node, st, c) {
8180
- if (node.type == "Identifier") c(node, st, "VariablePattern");else if (node.type == "MemberExpression") c(node, st, "MemberPattern");else c(node, st);
8181
- };
8182
- base.VariablePattern = ignore;
8183
- base.MemberPattern = skipThrough;
8184
- base.RestElement = function (node, st, c) {
8185
- return c(node.argument, st, "Pattern");
8186
- };
8187
- base.ArrayPattern = function (node, st, c) {
8188
- for (var i = 0; i < node.elements.length; ++i) {
8189
- var elt = node.elements[i];
8190
- if (elt) c(elt, st, "Pattern");
8191
- }
8192
- };
8193
- base.ObjectPattern = function (node, st, c) {
8194
- for (var i = 0; i < node.properties.length; ++i) {
8195
- c(node.properties[i].value, st, "Pattern");
8196
- }
8197
- };
8198
-
8199
8963
  base.Expression = skipThrough;
8200
8964
  base.ThisExpression = base.Super = base.MetaProperty = ignore;
8201
- base.ArrayExpression = function (node, st, c) {
8965
+ base.ArrayExpression = base.ArrayPattern = function (node, st, c) {
8202
8966
  for (var i = 0; i < node.elements.length; ++i) {
8203
8967
  var elt = node.elements[i];
8204
8968
  if (elt) c(elt, st, "Expression");
8205
8969
  }
8206
8970
  };
8207
- base.ObjectExpression = function (node, st, c) {
8971
+ base.ObjectExpression = base.ObjectPattern = function (node, st, c) {
8208
8972
  for (var i = 0; i < node.properties.length; ++i) {
8209
8973
  c(node.properties[i], st);
8210
8974
  }
@@ -8218,14 +8982,10 @@ base.SequenceExpression = base.TemplateLiteral = function (node, st, c) {
8218
8982
  base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
8219
8983
  c(node.argument, st, "Expression");
8220
8984
  };
8221
- base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
8985
+ base.BinaryExpression = base.AssignmentExpression = base.AssignmentPattern = base.LogicalExpression = function (node, st, c) {
8222
8986
  c(node.left, st, "Expression");
8223
8987
  c(node.right, st, "Expression");
8224
8988
  };
8225
- base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
8226
- c(node.left, st, "Pattern");
8227
- c(node.right, st, "Expression");
8228
- };
8229
8989
  base.ConditionalExpression = function (node, st, c) {
8230
8990
  c(node.test, st, "Expression");
8231
8991
  c(node.consequent, st, "Expression");
@@ -8242,7 +9002,7 @@ base.MemberExpression = function (node, st, c) {
8242
9002
  if (node.computed) c(node.property, st, "Expression");
8243
9003
  };
8244
9004
  base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
8245
- if (node.declaration) c(node.declaration, st);
9005
+ return c(node.declaration, st);
8246
9006
  };
8247
9007
  base.ImportDeclaration = function (node, st, c) {
8248
9008
  for (var i = 0; i < node.specifiers.length; i++) {
@@ -8256,10 +9016,6 @@ base.TaggedTemplateExpression = function (node, st, c) {
8256
9016
  c(node.quasi, st);
8257
9017
  };
8258
9018
  base.ClassDeclaration = base.ClassExpression = function (node, st, c) {
8259
- return c(node, st, "Class");
8260
- };
8261
- base.Class = function (node, st, c) {
8262
- c(node.id, st, "Pattern");
8263
9019
  if (node.superClass) c(node.superClass, st, "Expression");
8264
9020
  for (var i = 0; i < node.body.body.length; i++) {
8265
9021
  c(node.body.body[i], st);
@@ -180,12 +180,21 @@ exports.attrs = function attrs(obj, terse){
180
180
  * @api private
181
181
  */
182
182
 
183
- exports.escape = function escape(html){
184
- var result = String(html)
185
- .replace(/&/g, '&amp;')
186
- .replace(/</g, '&lt;')
187
- .replace(/>/g, '&gt;')
188
- .replace(/"/g, '&quot;');
183
+ var jade_encode_html_rules = {
184
+ '&': '&amp;',
185
+ '<': '&lt;',
186
+ '>': '&gt;',
187
+ '"': '&quot;'
188
+ };
189
+ var jade_match_html = /[&<>"]/g;
190
+
191
+ function jade_encode_char(c) {
192
+ return jade_encode_html_rules[c] || c;
193
+ }
194
+
195
+ exports.escape = jade_escape;
196
+ function jade_escape(html){
197
+ var result = String(html).replace(jade_match_html, jade_encode_char);
189
198
  if (result === '' + html) return html;
190
199
  else return result;
191
200
  };
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jade-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0.0
4
+ version: 1.11.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Raythattha