Comparing version
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var bundle, coffee, defaultOpts, dependsRecur, detective, findPackageJson, fs, funclet, isExternal, loglet, nocomment, path, resolve, topsort, transform, _; | ||
var builtin, bundle, coffee, defaultOpts, dependsRecur, findPackageJson, fs, funclet, isExternal, loglet, parser, path, resolve, topsort, transform, _; | ||
@@ -11,16 +11,14 @@ resolve = require('browser-resolve'); | ||
fs = require('fs'); | ||
fs = require('graceful-fs'); | ||
funclet = require('funclet'); | ||
detective = require('detective'); | ||
parser = require('./parser'); | ||
nocomment = require('./nocomment'); | ||
coffee = require('coffee-script'); | ||
findPackageJson = require('witwip'); | ||
_ = require('underscore'); | ||
builtin = require('./builtin'); | ||
defaultOpts = { | ||
@@ -35,2 +33,45 @@ basedir: process.cwd(), | ||
findPackageJson = function(filePath, cb) { | ||
var helper; | ||
helper = function(filePath, cb) { | ||
var packageJson; | ||
packageJson = path.join(filePath, 'package.json'); | ||
return fs.stat(packageJson, function(err, stat) { | ||
var parentPath; | ||
if (err) { | ||
parentPath = path.dirname(filePath); | ||
if (parentPath === filePath) { | ||
return cb(err); | ||
} else { | ||
return helper(parentPath, cb); | ||
} | ||
} else if (stat.isFile()) { | ||
return fs.readFile(packageJson, 'utf8', function(err, data) { | ||
var parsed; | ||
if (err) { | ||
return cb(err); | ||
} else { | ||
try { | ||
parsed = JSON.parse(data); | ||
return cb(null, filePath, parsed); | ||
} catch (e) { | ||
return cb(e); | ||
} | ||
} | ||
}); | ||
} else { | ||
parentPath = path.dirname(filePath); | ||
if (parentPath === filePath) { | ||
return cb({ | ||
error: 'package.json.not.found' | ||
}); | ||
} else { | ||
return helper(parentPath, cb); | ||
} | ||
} | ||
}); | ||
}; | ||
return helper(path.resolve(filePath), cb); | ||
}; | ||
dependsRecur = function(spec, options, cb) { | ||
@@ -58,5 +99,5 @@ var compile, depends, detect, normalize, normalizeName, parse, sourceMap; | ||
compiled = path.extname(filePath) === '.coffee' ? coffee.compile(data) : data; | ||
return nocomment.parse(compiled); | ||
return parser.parse(compiled); | ||
}; | ||
detect = function(content) { | ||
detect = function(filePath, content) { | ||
var required; | ||
@@ -66,5 +107,16 @@ required = _.filter(content, function(item) { | ||
}); | ||
return _.map(required, function(item) { | ||
return item.require; | ||
}); | ||
return _.uniq(_.map(required, function(item) { | ||
if (item.global) { | ||
if (builtin.hasOwnProperty(item.global)) { | ||
return builtin[item.global]; | ||
} else { | ||
throw { | ||
error: 'unknown_global', | ||
global: item.global | ||
}; | ||
} | ||
} else { | ||
return item.require; | ||
} | ||
})); | ||
}; | ||
@@ -81,3 +133,3 @@ normalizeName = function(key, relPath) { | ||
content = compile(filePath, data); | ||
return next(null, detect(content)); | ||
return next(null, detect(filePath, content)); | ||
})["catch"](cb).done(function(required) { | ||
@@ -97,3 +149,16 @@ var result; | ||
depends = function(spec, options, cb) { | ||
var filePath, key, relPath, result; | ||
var filePath, key, parent, relPath, result, tabLevel, tabMe; | ||
tabLevel = options.tabLevel || 0; | ||
tabMe = function() { | ||
var i; | ||
return ((function() { | ||
var _i, _results; | ||
_results = []; | ||
for (i = _i = 0; 0 <= tabLevel ? _i < tabLevel : _i > tabLevel; i = 0 <= tabLevel ? ++_i : --_i) { | ||
_results.push(' '); | ||
} | ||
return _results; | ||
})()).join(''); | ||
}; | ||
parent = options.parent || null; | ||
if (sourceMap.hasOwnProperty(spec)) { | ||
@@ -116,3 +181,3 @@ return cb(null, sourceMap[spec]); | ||
return cb(null, sourceMap[key]); | ||
} else if (filePath === spec) { | ||
} else if (filePath === spec && isExternal(filePath)) { | ||
return next({ | ||
@@ -136,9 +201,12 @@ error: 'core_module_unimplemented', | ||
result = val; | ||
sourceMap[result.key] = result; | ||
return next(null, result.depends); | ||
}).thenMap(function(spec, next) { | ||
}).thenMap(function(childSpec, next) { | ||
var opts; | ||
opts = _.extend({}, options, { | ||
basedir: path.dirname(filePath) | ||
basedir: path.dirname(filePath), | ||
tabLevel: tabLevel + 1, | ||
parent: spec | ||
}); | ||
return depends(spec, opts, function(err, mod) { | ||
return depends(childSpec, opts, function(err, mod) { | ||
if (err) { | ||
@@ -148,3 +216,3 @@ return next(err); | ||
return next(null, { | ||
spec: spec, | ||
spec: childSpec, | ||
module: mod | ||
@@ -156,3 +224,2 @@ }); | ||
result.depends = required; | ||
sourceMap[result.key] = result; | ||
return cb(null, result); | ||
@@ -168,2 +235,3 @@ }); | ||
options.shims = _.extend({}, options.shims || {}, ((_ref = data.bundlet) != null ? _ref.shims : void 0) || {}); | ||
options.modules = builtin; | ||
return depends(spec, options, cb); | ||
@@ -200,2 +268,4 @@ }); | ||
buffer.push(item); | ||
} else if (item.global) { | ||
buffer.push(item.global); | ||
} else if (item.require) { | ||
@@ -212,5 +282,8 @@ mapped = _.find(mod.depends, function(dep) { | ||
relPath: mod.relPath, | ||
spec: item.require | ||
spec: item.require, | ||
depends: mod.depends | ||
}; | ||
} | ||
} else if (item.comment) { | ||
buffer.push(item.comment); | ||
} else { | ||
@@ -217,0 +290,0 @@ throw { |
1143
lib/nocomment.js
@@ -36,60 +36,65 @@ module.exports = (function() { | ||
peg$c0 = [], | ||
peg$c1 = void 0, | ||
peg$c2 = peg$FAILED, | ||
peg$c3 = { type: "any", description: "any character" }, | ||
peg$c4 = "\r\n", | ||
peg$c5 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" }, | ||
peg$c6 = "\r", | ||
peg$c7 = { type: "literal", value: "\r", description: "\"\\r\"" }, | ||
peg$c8 = "\n", | ||
peg$c9 = { type: "literal", value: "\n", description: "\"\\n\"" }, | ||
peg$c10 = "\u2028", | ||
peg$c11 = { type: "literal", value: "\u2028", description: "\"\\u2028\"" }, | ||
peg$c12 = "\u2029", | ||
peg$c13 = { type: "literal", value: "\u2029", description: "\"\\u2029\"" }, | ||
peg$c14 = "/", | ||
peg$c15 = { type: "literal", value: "/", description: "\"/\"" }, | ||
peg$c16 = function(chars) { return '/' + chars.join('') + '/'; }, | ||
peg$c17 = "\\/", | ||
peg$c18 = { type: "literal", value: "\\/", description: "\"\\\\/\"" }, | ||
peg$c19 = /^[^\/]/, | ||
peg$c20 = { type: "class", value: "[^\\/]", description: "[^\\/]" }, | ||
peg$c21 = "//", | ||
peg$c22 = { type: "literal", value: "//", description: "\"//\"" }, | ||
peg$c23 = function(chars) { return {comment: "//" + chars.join('') } }, | ||
peg$c24 = "#", | ||
peg$c25 = { type: "literal", value: "#", description: "\"#\"" }, | ||
peg$c26 = function(chars) { return {comment: "#" + chars.join('') } }, | ||
peg$c27 = /^[^\r\n\u2028\u2029]/, | ||
peg$c28 = { type: "class", value: "[^\\r\\n\\u2028\\u2029]", description: "[^\\r\\n\\u2028\\u2029]" }, | ||
peg$c29 = "/*", | ||
peg$c30 = { type: "literal", value: "/*", description: "\"/*\"" }, | ||
peg$c31 = "*/", | ||
peg$c32 = { type: "literal", value: "*/", description: "\"*/\"" }, | ||
peg$c33 = function(chars) { return { comment: "/*" + chars.join('') + "*/" } }, | ||
peg$c34 = "*", | ||
peg$c35 = { type: "literal", value: "*", description: "\"*\"" }, | ||
peg$c36 = /^[^*]/, | ||
peg$c37 = { type: "class", value: "[^*]", description: "[^*]" }, | ||
peg$c38 = "\\", | ||
peg$c39 = { type: "literal", value: "\\", description: "\"\\\\\"" }, | ||
peg$c40 = function(seq) { return "\\"+seq; }, | ||
peg$c41 = "'", | ||
peg$c42 = { type: "literal", value: "'", description: "\"'\"" }, | ||
peg$c43 = function(char_) { return char_; }, | ||
peg$c44 = function(parts) { return "'" + parts[1].join('') + "'" }, | ||
peg$c45 = function(seq) { return "\\" + seq; }, | ||
peg$c46 = "\"", | ||
peg$c47 = { type: "literal", value: "\"", description: "\"\\\"\"" }, | ||
peg$c48 = function(parts) { return '"' + parts[1].join('') + '"' }, | ||
peg$c49 = function(chars) { return chars.join(''); }, | ||
peg$c50 = "require", | ||
peg$c51 = { type: "literal", value: "require", description: "\"require\"" }, | ||
peg$c52 = "(", | ||
peg$c53 = { type: "literal", value: "(", description: "\"(\"" }, | ||
peg$c54 = ")", | ||
peg$c55 = { type: "literal", value: ")", description: "\")\"" }, | ||
peg$c56 = function(spec) { return { require: spec } }, | ||
peg$c57 = /^[ \r\n\t]/, | ||
peg$c58 = { type: "class", value: "[ \\r\\n\\t]", description: "[ \\r\\n\\t]" }, | ||
peg$c1 = peg$FAILED, | ||
peg$c2 = function(chars) { return chars.join(''); }, | ||
peg$c3 = void 0, | ||
peg$c4 = { type: "any", description: "any character" }, | ||
peg$c5 = function(c) { return c; }, | ||
peg$c6 = "\r\n", | ||
peg$c7 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" }, | ||
peg$c8 = "\r", | ||
peg$c9 = { type: "literal", value: "\r", description: "\"\\r\"" }, | ||
peg$c10 = "\n", | ||
peg$c11 = { type: "literal", value: "\n", description: "\"\\n\"" }, | ||
peg$c12 = "\u2028", | ||
peg$c13 = { type: "literal", value: "\u2028", description: "\"\\u2028\"" }, | ||
peg$c14 = "\u2029", | ||
peg$c15 = { type: "literal", value: "\u2029", description: "\"\\u2029\"" }, | ||
peg$c16 = "//", | ||
peg$c17 = { type: "literal", value: "//", description: "\"//\"" }, | ||
peg$c18 = function(chars, t) { return {comment: "//" + chars.join('') + t }; }, | ||
peg$c19 = "#", | ||
peg$c20 = { type: "literal", value: "#", description: "\"#\"" }, | ||
peg$c21 = function(chars, t) { return {comment: "#" + chars.join('') + t }; }, | ||
peg$c22 = "/*", | ||
peg$c23 = { type: "literal", value: "/*", description: "\"/*\"" }, | ||
peg$c24 = "*/", | ||
peg$c25 = { type: "literal", value: "*/", description: "\"*/\"" }, | ||
peg$c26 = function(chars) { return { comment: "/*" + chars.join('') + "*/" }; }, | ||
peg$c27 = "'", | ||
peg$c28 = { type: "literal", value: "'", description: "\"'\"" }, | ||
peg$c29 = function(chars) { return "'" + chars.join('') + "'"; }, | ||
peg$c30 = "\"", | ||
peg$c31 = { type: "literal", value: "\"", description: "\"\\\"\"" }, | ||
peg$c32 = function(chars) { return '"' + chars.join('') + '"'; }, | ||
peg$c33 = { type: "other", description: "regular expression" }, | ||
peg$c34 = "/", | ||
peg$c35 = { type: "literal", value: "/", description: "\"/\"" }, | ||
peg$c36 = function(pattern, flags) { | ||
var value = new RegExp(pattern, flags); | ||
return "/" + pattern + "/" + flags; | ||
}, | ||
peg$c37 = /^[*\\\/[]/, | ||
peg$c38 = { type: "class", value: "[*\\\\\\/[]", description: "[*\\\\\\/[]" }, | ||
peg$c39 = /^[\\\/[]/, | ||
peg$c40 = { type: "class", value: "[\\\\\\/[]", description: "[\\\\\\/[]" }, | ||
peg$c41 = "\\", | ||
peg$c42 = { type: "literal", value: "\\", description: "\"\\\\\"" }, | ||
peg$c43 = "[", | ||
peg$c44 = { type: "literal", value: "[", description: "\"[\"" }, | ||
peg$c45 = "]", | ||
peg$c46 = { type: "literal", value: "]", description: "\"]\"" }, | ||
peg$c47 = /^[\]\\]/, | ||
peg$c48 = { type: "class", value: "[\\]\\\\]", description: "[\\]\\\\]" }, | ||
peg$c49 = /^[a-z]/, | ||
peg$c50 = { type: "class", value: "[a-z]", description: "[a-z]" }, | ||
peg$c51 = function(s) { return s.substring(1, s.length - 1); }, | ||
peg$c52 = "require", | ||
peg$c53 = { type: "literal", value: "require", description: "\"require\"" }, | ||
peg$c54 = "(", | ||
peg$c55 = { type: "literal", value: "(", description: "\"(\"" }, | ||
peg$c56 = ")", | ||
peg$c57 = { type: "literal", value: ")", description: "\")\"" }, | ||
peg$c58 = function(spec) { return { require: spec } }, | ||
peg$c59 = /^[ \r\n\t]/, | ||
peg$c60 = { type: "class", value: "[ \\r\\n\\t]", description: "[ \\r\\n\\t]" }, | ||
@@ -275,21 +280,24 @@ peg$currPos = 0, | ||
function peg$parseEOF() { | ||
var s0, s1; | ||
function peg$parsetoken() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
peg$silentFails++; | ||
if (input.length > peg$currPos) { | ||
s1 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c3); } | ||
s0 = peg$parsenonSourceCharExp(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parsesourceChar(); | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
s2 = peg$parsesourceChar(); | ||
} | ||
} else { | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c2(s1); | ||
} | ||
s0 = s1; | ||
} | ||
peg$silentFails--; | ||
if (s1 === peg$FAILED) { | ||
s0 = peg$c1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
@@ -299,3 +307,3 @@ return s0; | ||
function peg$parsetoken() { | ||
function peg$parsenonSourceCharExp() { | ||
var s0; | ||
@@ -305,8 +313,5 @@ | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseregex(); | ||
s0 = peg$parsecomment(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parserequire_exp(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsesource_char(); | ||
} | ||
s0 = peg$parserequireExp(); | ||
} | ||
@@ -318,43 +323,81 @@ } | ||
function peg$parseline_term() { | ||
function peg$parsesourceChar() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = peg$currPos; | ||
peg$silentFails++; | ||
s2 = peg$parsenonSourceCharExp(); | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c3; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
if (input.length > peg$currPos) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c4); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c5(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
return s0; | ||
} | ||
function peg$parselineTerm() { | ||
var s0; | ||
if (input.substr(peg$currPos, 2) === peg$c4) { | ||
s0 = peg$c4; | ||
if (input.substr(peg$currPos, 2) === peg$c6) { | ||
s0 = peg$c6; | ||
peg$currPos += 2; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c5); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 13) { | ||
s0 = peg$c6; | ||
s0 = peg$c8; | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 10) { | ||
s0 = peg$c8; | ||
s0 = peg$c10; | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c11); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 8232) { | ||
s0 = peg$c10; | ||
s0 = peg$c12; | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c11); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c13); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 8233) { | ||
s0 = peg$c12; | ||
s0 = peg$c14; | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c13); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
} | ||
@@ -369,47 +412,167 @@ } | ||
function peg$parseregex() { | ||
function peg$parsecomment() { | ||
var s0; | ||
s0 = peg$parsesingleLineComment(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsemultiLineComment(); | ||
} | ||
return s0; | ||
} | ||
function peg$parsesingleLineComment() { | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 47) { | ||
s1 = peg$c14; | ||
peg$currPos++; | ||
if (input.substr(peg$currPos, 2) === peg$c16) { | ||
s1 = peg$c16; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c17); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parseregex_char(); | ||
if (s3 !== peg$FAILED) { | ||
s3 = peg$parsesingleLineCommentChar(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsesingleLineCommentChar(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parselineTerm(); | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c18(s2, s3); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 35) { | ||
s1 = peg$c19; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parsesingleLineCommentChar(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parseregex_char(); | ||
s3 = peg$parsesingleLineCommentChar(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parselineTerm(); | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c21(s2, s3); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
s2 = peg$c2; | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} | ||
return s0; | ||
} | ||
function peg$parsesingleLineCommentChar() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = peg$currPos; | ||
peg$silentFails++; | ||
s2 = peg$parselineTerm(); | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c3; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
if (input.length > peg$currPos) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c4); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 47) { | ||
s3 = peg$c14; | ||
peg$currPos++; | ||
peg$reportedPos = s0; | ||
s1 = peg$c5(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
return s0; | ||
} | ||
function peg$parsemultiLineComment() { | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c22) { | ||
s1 = peg$c22; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c23); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parsemultiLineCommentChar(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsemultiLineCommentChar(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 2) === peg$c24) { | ||
s3 = peg$c24; | ||
peg$currPos += 2; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c25); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c16(s2); | ||
s1 = peg$c26(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
@@ -420,20 +583,41 @@ | ||
function peg$parseregex_char() { | ||
var s0; | ||
function peg$parsemultiLineCommentChar() { | ||
var s0, s1, s2; | ||
if (input.substr(peg$currPos, 2) === peg$c17) { | ||
s0 = peg$c17; | ||
s0 = peg$currPos; | ||
s1 = peg$currPos; | ||
peg$silentFails++; | ||
if (input.substr(peg$currPos, 2) === peg$c24) { | ||
s2 = peg$c24; | ||
peg$currPos += 2; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c25); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
if (peg$c19.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c3; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
if (input.length > peg$currPos) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c4); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c5(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
@@ -444,8 +628,11 @@ | ||
function peg$parsecomment() { | ||
function peg$parsestring() { | ||
var s0; | ||
s0 = peg$parsesingleline_comment(); | ||
s0 = peg$parsesqString(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsemultiline_comment(); | ||
s0 = peg$parsedqString(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseRegularExpressionLiteral(); | ||
} | ||
} | ||
@@ -456,60 +643,43 @@ | ||
function peg$parsesingleline_comment() { | ||
function peg$parsesqString() { | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c21) { | ||
s1 = peg$c21; | ||
peg$currPos += 2; | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s1 = peg$c27; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c28); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parsesingleline_comment_char(); | ||
s3 = peg$parsesqChar(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsesingleline_comment_char(); | ||
s3 = peg$parsesqChar(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c23(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 35) { | ||
s1 = peg$c24; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c25); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parsesingleline_comment_char(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsesingleline_comment_char(); | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s3 = peg$c27; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c28); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c26(s2); | ||
s1 = peg$c29(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
@@ -520,12 +690,42 @@ | ||
function peg$parsesingleline_comment_char() { | ||
var s0; | ||
function peg$parsesqChar() { | ||
var s0, s1, s2; | ||
if (peg$c27.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
s0 = peg$currPos; | ||
s1 = peg$currPos; | ||
peg$silentFails++; | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s2 = peg$c27; | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c28); } | ||
} | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c3; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
if (input.length > peg$currPos) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c4); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c5(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
@@ -535,43 +735,43 @@ return s0; | ||
function peg$parsemultiline_comment() { | ||
function peg$parsedqString() { | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c29) { | ||
s1 = peg$c29; | ||
peg$currPos += 2; | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s1 = peg$c30; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c30); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parsemultiline_comment_char(); | ||
s3 = peg$parsedqChar(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsemultiline_comment_char(); | ||
s3 = peg$parsedqChar(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 2) === peg$c31) { | ||
s3 = peg$c31; | ||
peg$currPos += 2; | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s3 = peg$c30; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c33(s2); | ||
s1 = peg$c32(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
@@ -582,50 +782,105 @@ | ||
function peg$parsemultiline_comment_char() { | ||
var s0, s1, s2, s3; | ||
function peg$parsedqChar() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 42) { | ||
s1 = peg$c34; | ||
s1 = peg$currPos; | ||
peg$silentFails++; | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s2 = peg$c30; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
} | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c3; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$currPos; | ||
peg$silentFails++; | ||
if (input.charCodeAt(peg$currPos) === 47) { | ||
s3 = peg$c14; | ||
if (input.length > peg$currPos) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c4); } | ||
} | ||
peg$silentFails--; | ||
if (s3 === peg$FAILED) { | ||
s2 = peg$c1; | ||
} else { | ||
peg$currPos = s2; | ||
s2 = peg$c2; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s1 = [s1, s2]; | ||
peg$reportedPos = s0; | ||
s1 = peg$c5(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
if (s0 === peg$FAILED) { | ||
if (peg$c36.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
return s0; | ||
} | ||
function peg$parseRegularExpressionLiteral() { | ||
var s0, s1, s2, s3, s4, s5; | ||
peg$silentFails++; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 47) { | ||
s1 = peg$c34; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$currPos; | ||
s3 = peg$parseRegularExpressionBody(); | ||
if (s3 !== peg$FAILED) { | ||
s3 = input.substring(s2, peg$currPos); | ||
} | ||
s2 = s3; | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 47) { | ||
s3 = peg$c34; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$currPos; | ||
s5 = peg$parseRegularExpressionFlags(); | ||
if (s5 !== peg$FAILED) { | ||
s5 = input.substring(s4, peg$currPos); | ||
} | ||
s4 = s5; | ||
if (s4 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c36(s2, s4); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
peg$silentFails--; | ||
if (s0 === peg$FAILED) { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
} | ||
@@ -635,8 +890,24 @@ return s0; | ||
function peg$parsestring() { | ||
var s0; | ||
function peg$parseRegularExpressionBody() { | ||
var s0, s1, s2, s3; | ||
s0 = peg$parsesinglequote_string(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsedoublequote_string(); | ||
s0 = peg$currPos; | ||
s1 = peg$parseRegularExpressionFirstChar(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parseRegularExpressionChar(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parseRegularExpressionChar(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s1 = [s1, s2]; | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
@@ -647,71 +918,40 @@ | ||
function peg$parsesinglequote_char() { | ||
function peg$parseRegularExpressionFirstChar() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
s1 = peg$c38; | ||
s1 = peg$currPos; | ||
peg$silentFails++; | ||
if (peg$c37.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
} | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c3; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parsesource_char(); | ||
s2 = peg$parseRegularExpressionNonTerminator(); | ||
if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c40(s2); | ||
s1 = [s1, s2]; | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$currPos; | ||
peg$silentFails++; | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s2 = peg$c41; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
s0 = peg$parseRegularExpressionBackslashSequence(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseRegularExpressionClass(); | ||
} | ||
if (s2 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
s2 = peg$c38; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
} | ||
if (s2 === peg$FAILED) { | ||
s2 = peg$parseline_term(); | ||
} | ||
} | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c1; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c2; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parsesource_char(); | ||
if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c43(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} | ||
@@ -722,49 +962,41 @@ | ||
function peg$parsesinglequote_string() { | ||
var s0, s1, s2, s3, s4; | ||
function peg$parseRegularExpressionChar() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s2 = peg$c41; | ||
peg$silentFails++; | ||
if (peg$c39.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parsesinglequote_char(); | ||
while (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
s4 = peg$parsesinglequote_char(); | ||
} | ||
if (s3 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s4 = peg$c41; | ||
peg$currPos++; | ||
} else { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
s2 = [s2, s3, s4]; | ||
s1 = s2; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c2; | ||
} | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c3; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c2; | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c44(s1); | ||
s2 = peg$parseRegularExpressionNonTerminator(); | ||
if (s2 !== peg$FAILED) { | ||
s1 = [s1, s2]; | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseRegularExpressionBackslashSequence(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseRegularExpressionClass(); | ||
} | ||
} | ||
@@ -774,3 +1006,3 @@ return s0; | ||
function peg$parsedoublequote_char() { | ||
function peg$parseRegularExpressionBackslashSequence() { | ||
var s0, s1, s2; | ||
@@ -780,67 +1012,21 @@ | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
s1 = peg$c38; | ||
s1 = peg$c41; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parsesource_char(); | ||
s2 = peg$parseRegularExpressionNonTerminator(); | ||
if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c45(s2); | ||
s1 = [s1, s2]; | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$currPos; | ||
peg$silentFails++; | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s2 = peg$c46; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
} | ||
if (s2 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
s2 = peg$c38; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
} | ||
if (s2 === peg$FAILED) { | ||
s2 = peg$parseline_term(); | ||
} | ||
} | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c1; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c2; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parsesource_char(); | ||
if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c43(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} | ||
@@ -850,49 +1036,35 @@ return s0; | ||
function peg$parsedoublequote_string() { | ||
var s0, s1, s2, s3, s4; | ||
function peg$parseRegularExpressionNonTerminator() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s2 = peg$c46; | ||
peg$currPos++; | ||
peg$silentFails++; | ||
s2 = peg$parselineTerm(); | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c3; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
peg$currPos = s1; | ||
s1 = peg$c1; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parsedoublequote_char(); | ||
while (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
s4 = peg$parsedoublequote_char(); | ||
if (s1 !== peg$FAILED) { | ||
if (input.length > peg$currPos) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c4); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s4 = peg$c46; | ||
peg$currPos++; | ||
} else { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
s2 = [s2, s3, s4]; | ||
s1 = s2; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c2; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s1 = [s1, s2]; | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c2; | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c2; | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c48(s1); | ||
} | ||
s0 = s1; | ||
@@ -902,84 +1074,107 @@ return s0; | ||
function peg$parserspec_string() { | ||
function peg$parseRegularExpressionClass() { | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s1 = peg$c41; | ||
if (input.charCodeAt(peg$currPos) === 91) { | ||
s1 = peg$c43; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parsesinglequote_char(); | ||
s3 = peg$parseRegularExpressionClassChar(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsesinglequote_char(); | ||
s3 = peg$parseRegularExpressionClassChar(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s3 = peg$c41; | ||
if (input.charCodeAt(peg$currPos) === 93) { | ||
s3 = peg$c45; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c46); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c49(s2); | ||
s1 = [s1, s2, s3]; | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
return s0; | ||
} | ||
function peg$parseRegularExpressionClassChar() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = peg$currPos; | ||
peg$silentFails++; | ||
if (peg$c47.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c48); } | ||
} | ||
peg$silentFails--; | ||
if (s2 === peg$FAILED) { | ||
s1 = peg$c3; | ||
} else { | ||
peg$currPos = s1; | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseRegularExpressionNonTerminator(); | ||
if (s2 !== peg$FAILED) { | ||
s1 = [s1, s2]; | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c1; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s1 = peg$c46; | ||
s0 = peg$parseRegularExpressionBackslashSequence(); | ||
} | ||
return s0; | ||
} | ||
function peg$parseRegularExpressionFlags() { | ||
var s0, s1; | ||
s0 = []; | ||
if (peg$c49.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c50); } | ||
} | ||
while (s1 !== peg$FAILED) { | ||
s0.push(s1); | ||
if (peg$c49.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c50); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parsedoublequote_char(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsedoublequote_char(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s3 = peg$c46; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c49(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} | ||
@@ -990,12 +1185,26 @@ | ||
function peg$parserequire_exp() { | ||
function peg$parserequireExpSpec() { | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
s1 = peg$parsestring(); | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c51(s1); | ||
} | ||
s0 = s1; | ||
return s0; | ||
} | ||
function peg$parserequireExp() { | ||
var s0, s1, s2, s3, s4, s5, s6, s7, s8; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 7) === peg$c50) { | ||
s1 = peg$c50; | ||
if (input.substr(peg$currPos, 7) === peg$c52) { | ||
s1 = peg$c52; | ||
peg$currPos += 7; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c51); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
} | ||
@@ -1006,7 +1215,7 @@ if (s1 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 40) { | ||
s3 = peg$c52; | ||
s3 = peg$c54; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c55); } | ||
} | ||
@@ -1016,3 +1225,3 @@ if (s3 !== peg$FAILED) { | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parserspec_string(); | ||
s5 = peg$parserequireExpSpec(); | ||
if (s5 !== peg$FAILED) { | ||
@@ -1022,7 +1231,7 @@ s6 = peg$parse_(); | ||
if (input.charCodeAt(peg$currPos) === 41) { | ||
s7 = peg$c54; | ||
s7 = peg$c56; | ||
peg$currPos++; | ||
} else { | ||
s7 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c55); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c57); } | ||
} | ||
@@ -1033,35 +1242,35 @@ if (s7 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c56(s5); | ||
s1 = peg$c58(s5); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
s0 = peg$c1; | ||
} | ||
@@ -1075,3 +1284,3 @@ | ||
if (peg$c57.test(input.charAt(peg$currPos))) { | ||
if (peg$c59.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1081,3 +1290,3 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c58); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c60); } | ||
} | ||
@@ -1107,16 +1316,2 @@ | ||
function peg$parsesource_char() { | ||
var s0; | ||
if (input.length > peg$currPos) { | ||
s0 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c3); } | ||
} | ||
return s0; | ||
} | ||
peg$result = peg$startRuleFunction(); | ||
@@ -1123,0 +1318,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "client-side Javascript packager.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": { | ||
@@ -29,4 +29,24 @@ "type": "git", | ||
"browser-resolve": "=1.5.0", | ||
"detective": "=4.0.0", | ||
"witwip": "=1.0.3" | ||
"graceful-fs": "=3.0.5", | ||
"process": "=0.10.0", | ||
"native-buffer-browserify": "=2.1.4", | ||
"console-browserify": "=1.1.0", | ||
"constants-browserify": "=0.0.1", | ||
"crypto-browserify": "=3.9.2", | ||
"events": "=1.0.2", | ||
"domain-browser": "=1.1.3", | ||
"http-browserify": "=1.7.0", | ||
"https-browserify": "=0.0.0", | ||
"os-browserify": "=0.1.2", | ||
"path-browserify": "=0.0.0", | ||
"punycode": "=1.3.2", | ||
"querystring": "=0.2.0", | ||
"stream-browserify": "=1.0.0", | ||
"string_decoder": "=0.10.31", | ||
"timers-browserify": "=1.2.0", | ||
"tty-browserify": "=0.0.0", | ||
"url": "=0.10.2", | ||
"util": "=0.10.3", | ||
"vm-browserify": "=0.0.4", | ||
"zlib-browserify": "=0.0.3" | ||
}, | ||
@@ -33,0 +53,0 @@ "devDependencies": { |
@@ -15,6 +15,6 @@ # Bundlet - a simple client-side Javascript bundler. | ||
jquery: false | ||
,,,, | ||
....v | ||
} | ||
bundlet { | ||
bundlet: { | ||
shim: { | ||
@@ -59,9 +59,9 @@ jquery: { | ||
// module: jquery | ||
_Module_jquery = window.$; | ||
var _Module_jquery = window.$; | ||
// module: ./baz.js | ||
_Module___baz_js = (function () { | ||
var _Module___baz_js = (function () { | ||
... | ||
})(); | ||
// module: ./bar.js | ||
_Module___bar_js = (function() { | ||
var _Module___bar_js = (function() { | ||
var jquery = _Module_jquery; | ||
@@ -72,3 +72,3 @@ var Baz = _Module_baz_js; | ||
// module: ./foo.js | ||
_Module___foo_js = (function () { | ||
var _Module___foo_js = (function () { | ||
var jquery = _Module_jquery; | ||
@@ -75,0 +75,0 @@ var Bar = _Module___bar_js; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
137581
62.79%19
46.15%4050
69.24%28
250%4
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed