UNPKG

esfuzz

Version:

JS fuzzer for generative testing of parsers that implement the SpiderMonkey Reflect.parse API

49 lines (48 loc) 1.64 kB
// Generated by CoffeeScript 2.0.0-beta7 void function () { var cache$, construct, Identifier, identifierPart, identifierStart, Node, PROBLEMATIC_NAMES, randomElement, randomInt, RESERVED, UNRESERVED; Node = require('../node'); RESERVED = require('../reserved'); UNRESERVED = require('../unreserved'); cache$ = require('../random'); randomInt = cache$.randomInt; randomElement = cache$.randomElement; construct = require('../combinators').construct; PROBLEMATIC_NAMES = [].slice.call(RESERVED).concat([].slice.call(UNRESERVED)); identifierStart = identifierPart = function () { return String.fromCharCode(97 + randomInt(25)); }; Identifier = function (super$) { extends$(Identifier, super$); Identifier.prototype.type = Identifier.name; function Identifier() { if (Math.random() < 1 / 10) { this.name = randomElement(PROBLEMATIC_NAMES); } else { this.name = [identifierStart()].concat([].slice.call(function (accum$) { while (Math.random() < .8) { accum$.push(identifierPart()); } return accum$; }.call(this, []))).join(''); } } return Identifier; }(Node); module.exports = construct(Identifier); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } function extends$(child, parent) { for (var key in parent) if (isOwn$(parent, key)) child[key] = parent[key]; function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; } }.call(this);