mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
update Espree and LICENSE file
This commit is contained in:
parent
65f307322a
commit
cc4ffc762e
@ -116,9 +116,9 @@ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com>.
|
||||
The source code for escape-string-regexp is available at:
|
||||
https://github.com/sindresorhus/escape-string-regexp
|
||||
|
||||
## Esprima ##
|
||||
## Espree ##
|
||||
|
||||
Esprima is distributed under the BSD 2-clause license:
|
||||
Espree is distributed under the BSD 2-clause license:
|
||||
|
||||
> Redistribution and use in source and binary forms, with or without
|
||||
> modification, are permitted provided that the following conditions are met:
|
||||
@ -140,10 +140,10 @@ Esprima is distributed under the BSD 2-clause license:
|
||||
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
> THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Copyright (c) 2011-2013 Ariya Hidayat and other Esprima contributors.
|
||||
Copyright (c) 2011-2015 by the Espree contributors.
|
||||
|
||||
The source code for Esprima is available at:
|
||||
https://github.com/ariya/esprima
|
||||
https://github.com/eslint/espree
|
||||
|
||||
## events ##
|
||||
|
||||
|
||||
@ -53,6 +53,35 @@ var acceptsLeadingComments = (function() {
|
||||
|
||||
return accepts;
|
||||
})();
|
||||
var espreeOpts = {
|
||||
comment: true,
|
||||
loc: true,
|
||||
range: true,
|
||||
tokens: true,
|
||||
ecmaFeatures: {
|
||||
arrowFunctions: true,
|
||||
binaryLiterals: true,
|
||||
blockBindings: true,
|
||||
defaultParams: true,
|
||||
destructuring: true,
|
||||
forOf: true,
|
||||
generators: true,
|
||||
globalReturn: true,
|
||||
jsx: false,
|
||||
objectLiteralComputedProperties: true,
|
||||
objectLiteralDuplicateProperties: true,
|
||||
objectLiteralShorthandMethods: true,
|
||||
objectLiteralShorthandProperties: true,
|
||||
octalLiterals: true,
|
||||
regexUFlag: true,
|
||||
regexYFlag: true,
|
||||
restParams: true,
|
||||
spread: true,
|
||||
superInFunctions: true,
|
||||
templateStrings: true,
|
||||
unicodeCodePointEscapes: true
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: docs
|
||||
function canAcceptComment(node) {
|
||||
@ -119,7 +148,7 @@ function scrubComments(comments) {
|
||||
// TODO: docs
|
||||
var AstBuilder = exports.AstBuilder = function() {};
|
||||
|
||||
function parse(source, filename, espreeOpts) {
|
||||
function parse(source, filename) {
|
||||
var ast;
|
||||
|
||||
try {
|
||||
@ -134,33 +163,7 @@ function parse(source, filename, espreeOpts) {
|
||||
|
||||
// TODO: docs
|
||||
AstBuilder.prototype.build = function(source, filename) {
|
||||
var ast;
|
||||
|
||||
var espreeOpts = {
|
||||
comment: true,
|
||||
loc: true,
|
||||
range: true,
|
||||
tokens: true,
|
||||
ecmaFeatures: {
|
||||
binaryLiterals: true,
|
||||
blockBindings: true,
|
||||
defaultParams: true,
|
||||
forOf: true,
|
||||
generators: true,
|
||||
jsx: false,
|
||||
objectLiteralComputedProperties: true,
|
||||
objectLiteralDuplicateProperties: true,
|
||||
objectLiteralShorthandMethods: true,
|
||||
objectLiteralShorthandProperties: true,
|
||||
octalLiterals: true,
|
||||
regexUFlag: true,
|
||||
regexYFlag: true,
|
||||
templateStrings: true,
|
||||
unicodeCodePointEscapes: true
|
||||
}
|
||||
};
|
||||
|
||||
ast = parse(source, filename, espreeOpts);
|
||||
var ast = parse(source, filename);
|
||||
|
||||
if (ast) {
|
||||
this._postProcess(filename, ast);
|
||||
|
||||
648
node_modules/espree/espree.js
generated
vendored
648
node_modules/espree/espree.js
generated
vendored
File diff suppressed because it is too large
Load Diff
36
node_modules/espree/lib/ast-node-factory.js
generated
vendored
36
node_modules/espree/lib/ast-node-factory.js
generated
vendored
@ -51,6 +51,30 @@ module.exports = {
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Create an Arrow Function Expression ASTNode
|
||||
* @param {ASTNode} params The function arguments
|
||||
* @param {ASTNode} defaults Any default arguments
|
||||
* @param {ASTNode} body The function body
|
||||
* @param {ASTNode} rest The rest parameter
|
||||
* @param {boolean} expression True if the arrow function is created via an expression.
|
||||
* Always false for declarations, but kept here to be in sync with
|
||||
* FunctionExpression objects.
|
||||
* @returns {ASTNode} An ASTNode representing the entire arrow function expression
|
||||
*/
|
||||
createArrowFunctionExpression: function (params, defaults, body, rest, expression) {
|
||||
return {
|
||||
type: astNodeTypes.ArrowFunctionExpression,
|
||||
id: null,
|
||||
params: params,
|
||||
defaults: defaults,
|
||||
body: body,
|
||||
rest: rest,
|
||||
generator: false,
|
||||
expression: expression
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Create an ASTNode representation of an assignment expression
|
||||
* @param {ASTNode} operator The assignment operator
|
||||
@ -419,6 +443,18 @@ module.exports = {
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Create an ASTNode representation of a spread element
|
||||
* @param {ASTNode} argument The array being spread
|
||||
* @returns {ASTNode} An ASTNode representing a spread element
|
||||
*/
|
||||
createSpreadElement: function (argument) {
|
||||
return {
|
||||
type: astNodeTypes.SpreadElement,
|
||||
argument: argument
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Create an ASTNode tagged template expression
|
||||
* @param {ASTNode} tag The tag expression
|
||||
|
||||
4
node_modules/espree/lib/ast-node-types.js
generated
vendored
4
node_modules/espree/lib/ast-node-types.js
generated
vendored
@ -40,6 +40,8 @@
|
||||
module.exports = {
|
||||
AssignmentExpression: "AssignmentExpression",
|
||||
ArrayExpression: "ArrayExpression",
|
||||
ArrayPattern: "ArrayPattern",
|
||||
ArrowFunctionExpression: "ArrowFunctionExpression",
|
||||
BlockStatement: "BlockStatement",
|
||||
BinaryExpression: "BinaryExpression",
|
||||
BreakStatement: "BreakStatement",
|
||||
@ -64,10 +66,12 @@ module.exports = {
|
||||
MemberExpression: "MemberExpression",
|
||||
NewExpression: "NewExpression",
|
||||
ObjectExpression: "ObjectExpression",
|
||||
ObjectPattern: "ObjectPattern",
|
||||
Program: "Program",
|
||||
Property: "Property",
|
||||
ReturnStatement: "ReturnStatement",
|
||||
SequenceExpression: "SequenceExpression",
|
||||
SpreadElement: "SpreadElement",
|
||||
SwitchCase: "SwitchCase",
|
||||
SwitchStatement: "SwitchStatement",
|
||||
TaggedTemplateExpression: "TaggedTemplateExpression",
|
||||
|
||||
20
node_modules/espree/lib/features.js
generated
vendored
20
node_modules/espree/lib/features.js
generated
vendored
@ -40,9 +40,15 @@
|
||||
|
||||
module.exports = {
|
||||
|
||||
// enable parsing of arrow functions
|
||||
arrowFunctions: false,
|
||||
|
||||
// enable parsing of let and const
|
||||
blockBindings: true,
|
||||
|
||||
// enable parsing of destructured arrays and objects
|
||||
destructuring: false,
|
||||
|
||||
// enable parsing of regex u flag
|
||||
regexUFlag: false,
|
||||
|
||||
@ -64,6 +70,9 @@ module.exports = {
|
||||
// enable parsing of default parameters
|
||||
defaultParams: false,
|
||||
|
||||
// enable parsing of rest parameters
|
||||
restParams: false,
|
||||
|
||||
// enable parsing of for-of statements
|
||||
forOf: false,
|
||||
|
||||
@ -82,6 +91,15 @@ module.exports = {
|
||||
// enable parsing of generators/yield
|
||||
generators: false,
|
||||
|
||||
// support the spread operator
|
||||
spread: false,
|
||||
|
||||
// enable super in functions
|
||||
superInFunctions: false,
|
||||
|
||||
// React JSX parsing
|
||||
jsx: false
|
||||
jsx: false,
|
||||
|
||||
// allow return statement in global scope
|
||||
globalReturn: false
|
||||
};
|
||||
|
||||
8
node_modules/espree/lib/messages.js
generated
vendored
8
node_modules/espree/lib/messages.js
generated
vendored
@ -51,20 +51,28 @@ module.exports = {
|
||||
InvalidRegExpFlag: "Invalid regular expression flag",
|
||||
UnterminatedRegExp: "Invalid regular expression: missing /",
|
||||
InvalidLHSInAssignment: "Invalid left-hand side in assignment",
|
||||
InvalidLHSInFormalsList: "Invalid left-hand side in formals list",
|
||||
InvalidLHSInForIn: "Invalid left-hand side in for-in",
|
||||
MultipleDefaultsInSwitch: "More than one default clause in switch statement",
|
||||
NoCatchOrFinally: "Missing catch or finally after try",
|
||||
NoUnintializedConst: "Const must be initialized",
|
||||
UnknownLabel: "Undefined label '%0'",
|
||||
Redeclaration: "%0 '%1' has already been declared",
|
||||
IllegalContinue: "Illegal continue statement",
|
||||
IllegalBreak: "Illegal break statement",
|
||||
IllegalReturn: "Illegal return statement",
|
||||
IllegalYield: "Illegal yield expression",
|
||||
IllegalSpread: "Illegal spread element",
|
||||
StrictModeWith: "Strict mode code may not include a with statement",
|
||||
StrictCatchVariable: "Catch variable may not be eval or arguments in strict mode",
|
||||
StrictVarName: "Variable name may not be eval or arguments in strict mode",
|
||||
StrictParamName: "Parameter name eval or arguments is not allowed in strict mode",
|
||||
StrictParamDupe: "Strict mode function may not have duplicate parameter names",
|
||||
ParameterAfterRestParameter: "Rest parameter must be final parameter of an argument list",
|
||||
DefaultRestParameter: "Rest parameter can not have a default value",
|
||||
ElementAfterSpreadElement: "Spread must be the final element of an element list",
|
||||
ObjectPatternAsRestParameter: "Invalid rest parameter",
|
||||
ObjectPatternAsSpread: "Invalid spread argument",
|
||||
StrictFunctionName: "Function name may not be eval or arguments in strict mode",
|
||||
StrictOctalLiteral: "Octal literals are not allowed in strict mode.",
|
||||
StrictDelete: "Delete of an unqualified identifier in strict mode.",
|
||||
|
||||
55
node_modules/espree/lib/string-map.js
generated
vendored
Normal file
55
node_modules/espree/lib/string-map.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @fileoverview A simple map that helps avoid collisions on the Object prototype.
|
||||
* @author Jamund Ferguson
|
||||
* @copyright 2015 Jamund Ferguson. All rights reserved.
|
||||
* @copyright 2011-2013 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
function StringMap() {
|
||||
this.$data = {};
|
||||
}
|
||||
|
||||
StringMap.prototype.get = function (key) {
|
||||
key = "$" + key;
|
||||
return this.$data[key];
|
||||
};
|
||||
|
||||
StringMap.prototype.set = function (key, value) {
|
||||
key = "$" + key;
|
||||
this.$data[key] = value;
|
||||
return this;
|
||||
};
|
||||
|
||||
StringMap.prototype.has = function (key) {
|
||||
key = "$" + key;
|
||||
return Object.prototype.hasOwnProperty.call(this.$data, key);
|
||||
};
|
||||
|
||||
StringMap.prototype.delete = function (key) {
|
||||
key = "$" + key;
|
||||
return delete this.$data[key];
|
||||
};
|
||||
|
||||
module.exports = StringMap;
|
||||
12
node_modules/espree/package.json
generated
vendored
12
node_modules/espree/package.json
generated
vendored
File diff suppressed because one or more lines are too long
@ -16,7 +16,7 @@
|
||||
"async": "~0.9.0",
|
||||
"catharsis": "~0.8.6",
|
||||
"escape-string-regexp": "~1.0.2",
|
||||
"espree": "1.7.1",
|
||||
"espree": "~1.9.1",
|
||||
"js2xmlparser": "~0.1.7",
|
||||
"marked": "~0.3.2",
|
||||
"requizzle": "~0.2.0",
|
||||
|
||||
@ -36,7 +36,7 @@ describe('jsdoc/src/astbuilder', function() {
|
||||
|
||||
it('should log (not throw) an error when a file cannot be parsed', function() {
|
||||
function parse() {
|
||||
builder.build('if (true) { return; }', 'bad.js');
|
||||
builder.build('qwerty!!!!!', 'bad.js');
|
||||
}
|
||||
|
||||
expect(parse).not.toThrow();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user