Socket
Socket
Sign inDemoInstall

esprima

Package Overview
Dependencies
0
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.0 to 0.9.1

assets/codemirror/codemirror.css

170

esprima.js

@@ -41,11 +41,11 @@ /*

Token = {
BooleanLiteral: 'BooleanLiteral',
EOF: 'EOF',
FutureReservedWord: 'FutureReservedWord',
Identifier: 'Identifier',
Keyword: 'Keyword',
NullLiteral: 'NullLiteral',
NumericLiteral: 'NumericLiteral',
Punctuator: 'Punctuator',
StringLiteral: 'StringLiteral'
BooleanLiteral: 1,
EOF: 2,
FutureReservedWord: 3,
Identifier: 4,
Keyword: 5,
NullLiteral: 6,
NumericLiteral: 7,
Punctuator: 8,
StringLiteral: 9
};

@@ -705,14 +705,20 @@

// Expect the next token to match the specified one.
// Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.
function expect(type, value) {
var token;
function expect(value) {
var token = lex();
if (token.type !== Token.Punctuator || token.value !== value) {
throwUnexpected(token);
}
}
token = lex();
if (token.type !== type || token.value !== value) {
// Expect the next token to match the specified keyword.
// If not, an exception will be thrown.
function expectKeyword(keyword) {
var token = lex();
if (token.type !== Token.Keyword || token.value !== keyword) {
throwUnexpected(token);
}
return token;
}

@@ -770,3 +776,3 @@

expect(Token.Punctuator, '[');
expect('[');

@@ -790,3 +796,3 @@ while (index < length) {

expect(Token.Punctuator, ',');
expect(',');
}

@@ -812,3 +818,3 @@ }

expect(Token.Punctuator, '{');
expect('{');

@@ -826,3 +832,3 @@ // TODO handle 'get' and 'set'

property.key = {
type: 'Identifier',
type: Syntax.Identifier,
name: token.value

@@ -832,3 +838,3 @@ };

property.key = {
type: 'Literal',
type: Syntax.Literal,
value: token.value

@@ -838,3 +844,3 @@ };

expect(Token.Punctuator, ':');
expect(':');
property.value = parseAssignmentExpression();

@@ -852,3 +858,3 @@

}
expect(Token.Punctuator, ',');
expect(',');
}

@@ -878,3 +884,3 @@

expr = parseExpression();
expect(Token.Punctuator, ')');
expect(')');
return expr.expression;

@@ -946,3 +952,3 @@ }

expect(Token.Punctuator, '(');
expect('(');

@@ -955,7 +961,7 @@ if (!match(')')) {

}
expect(Token.Punctuator, ',');
expect(',');
}
}
expect(Token.Punctuator, ')');
expect(')');

@@ -992,3 +998,3 @@ return args;

property = parseExpression();
if (property.type === 'ExpressionStatement') {
if (property.type === Syntax.ExpressionStatement) {
property = property.expression;

@@ -1002,3 +1008,3 @@ }

};
expect(Token.Punctuator, ']');
expect(']');
} else if (match('(')) {

@@ -1317,3 +1323,3 @@ expr = {

expr.consequent = parseAssignmentExpression();
expect(Token.Punctuator, ':');
expect(':');
expr.alternate = parseAssignmentExpression();

@@ -1387,7 +1393,7 @@ }

expect(Token.Punctuator, '{');
expect('{');
block = parseStatementList();
expect(Token.Punctuator, '}');
expect('}');

@@ -1446,3 +1452,3 @@ return {

expect(Token.Keyword, 'var');
expectKeyword('var');

@@ -1463,3 +1469,3 @@ declarations = parseVariableDeclarationList();

function parseEmptyStatement() {
expect(Token.Punctuator, ';');
expect(';');

@@ -1486,9 +1492,9 @@ return {

expect(Token.Keyword, 'if');
expectKeyword('if');
expect(Token.Punctuator, '(');
expect('(');
test = parseExpression().expression;
expect(Token.Punctuator, ')');
expect(')');

@@ -1517,13 +1523,13 @@ consequent = parseStatement();

expect(Token.Keyword, 'do');
expectKeyword('do');
body = parseStatement();
expect(Token.Keyword, 'while');
expectKeyword('while');
expect(Token.Punctuator, '(');
expect('(');
test = parseExpression().expression;
expect(Token.Punctuator, ')');
expect(')');

@@ -1542,9 +1548,9 @@ consumeSemicolon();

expect(Token.Keyword, 'while');
expectKeyword('while');
expect(Token.Punctuator, '(');
expect('(');
test = parseExpression().expression;
expect(Token.Punctuator, ')');
expect(')');

@@ -1565,5 +1571,5 @@ body = parseStatement();

expect(Token.Keyword, 'for');
expectKeyword('for');
expect(Token.Punctuator, '(');
expect('(');

@@ -1597,3 +1603,3 @@ if (match(';')) {

} else {
expect(Token.Punctuator, ';');
expect(';');
}

@@ -1608,3 +1614,3 @@ }

}
expect(Token.Punctuator, ';');
expect(';');

@@ -1616,3 +1622,3 @@ if (!match(')')) {

expect(Token.Punctuator, ')');
expect(')');

@@ -1645,3 +1651,3 @@ body = parseStatement();

expect(Token.Keyword, 'continue');
expectKeyword('continue');

@@ -1670,3 +1676,3 @@ token = lookahead();

expect(Token.Keyword, 'break');
expectKeyword('break');

@@ -1695,3 +1701,3 @@ token = lookahead();

expect(Token.Keyword, 'return');
expectKeyword('return');

@@ -1718,9 +1724,9 @@ if (!match(';')) {

expect(Token.Keyword, 'with');
expectKeyword('with');
expect(Token.Punctuator, '(');
expect('(');
object = parseExpression().expression;
expect(Token.Punctuator, ')');
expect(')');

@@ -1741,11 +1747,11 @@ body = parseStatement();

expect(Token.Keyword, 'switch');
expectKeyword('switch');
expect(Token.Punctuator, '(');
expect('(');
discriminant = parseExpression().expression;
expect(Token.Punctuator, ')');
expect(')');
expect(Token.Punctuator, '{');
expect('{');

@@ -1771,6 +1777,6 @@ if (match('}')) {

} else {
expect(Token.Keyword, 'case');
expectKeyword('case');
test = parseExpression().expression;
}
expect(Token.Punctuator, ':');
expect(':');

@@ -1793,3 +1799,3 @@ consequent = [];

expect(Token.Punctuator, '}');
expect('}');

@@ -1808,3 +1814,3 @@ return {

expect(Token.Keyword, 'throw');
expectKeyword('throw');

@@ -1831,3 +1837,3 @@ if (!match(';')) {

expect(Token.Keyword, 'try');
expectKeyword('try');

@@ -1838,7 +1844,7 @@ block = parseBlock();

lex();
expect(Token.Punctuator, '(');
expect('(');
if (!match(')')) {
param = parseExpression().expression;
}
expect(Token.Punctuator, ')');
expect(')');

@@ -1869,3 +1875,3 @@ handlers.push({

function parseDebuggerStatement() {
expect(Token.Keyword, 'debugger');
expectKeyword('debugger');

@@ -1966,6 +1972,6 @@ consumeSemicolon();

expect(Token.Keyword, 'function');
expectKeyword('function');
token = lex();
if (token.type !== 'Identifier') {
if (token.type !== Token.Identifier) {
throwUnexpected(token);

@@ -1978,3 +1984,3 @@ }

expect(Token.Punctuator, '(');
expect('(');

@@ -1984,7 +1990,7 @@ if (!match(')')) {

token = lex();
if (token.type !== 'Identifier') {
if (token.type !== Token.Identifier) {
throwUnexpected(token);
}
params.push({
type: 'Identifier',
type: Syntax.Identifier,
name: token.value

@@ -1995,7 +2001,7 @@ });

}
expect(Token.Punctuator, ',');
expect(',');
}
}
expect(Token.Punctuator, ')');
expect(')');

@@ -2015,7 +2021,7 @@ body = parseBlock();

expect(Token.Keyword, 'function');
expectKeyword('function');
if (!match('(')) {
token = lex();
if (token.type !== 'Identifier') {
if (token.type !== Token.Identifier) {
throwUnexpected(token);

@@ -2029,3 +2035,3 @@ }

expect(Token.Punctuator, '(');
expect('(');

@@ -2035,7 +2041,7 @@ if (!match(')')) {

token = lex();
if (token.type !== 'Identifier') {
if (token.type !== Token.Identifier) {
throwUnexpected(token);
}
params.push({
type: 'Identifier',
type: Syntax.Identifier,
name: token.value

@@ -2046,7 +2052,7 @@ });

}
expect(Token.Punctuator, ',');
expect(',');
}
}
expect(Token.Punctuator, ')');
expect(')');

@@ -2109,4 +2115,4 @@ body = parseBlock();

// Sync with package.json.
exports.version = '0.9.0';
exports.version = '0.9.1';
}(typeof exports === 'undefined' ? (esprima = {}) : exports));

@@ -9,3 +9,3 @@ {

},
"version": "0.9.0",
"version": "0.9.1",
"engines": {

@@ -12,0 +12,0 @@ "node": ">=0.4.0"

@@ -29,3 +29,4 @@ Esprima ([esprima.org](http://esprima.org)) is an experimental ECMAScript

Feedback and contribution are welcomed! Please read the
Feedback and contribution are welcomed! Please join the
[mailing list](http://groups.google.com/group/esprima) and read the
[contribution guide](http://code.google.com/p/esprima/wiki/ContributionGuide)

@@ -32,0 +33,0 @@ for further info.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc