Comparing version 0.1.0 to 0.1.1
@@ -90,2 +90,11 @@ import { Token } from './token'; | ||
} | ||
export declare const enum ParseFunctionFlag { | ||
None = 0, | ||
DisallowGenerator = 1, | ||
RequireIdentifier = 2 | ||
} | ||
export declare const enum LabelledFunctionStatement { | ||
Disallow = 0, | ||
Allow = 1 | ||
} | ||
export interface ParserState { | ||
@@ -92,0 +101,0 @@ source: string; |
import { Token } from './token'; | ||
import * as ESTree from './estree'; | ||
import { Context, ParserState, Kind, BindingOrigin, BindingType } from './common'; | ||
export declare const enum LabelledFunctionStatement { | ||
Disallow = 0, | ||
Allow = 1 | ||
} | ||
export declare const enum ParseFunctionFlag { | ||
IsNormal = 0, | ||
DisAllowGenerator = 1, | ||
RequireIdentifier = 2 | ||
} | ||
export declare const enum DecoratorFlag { | ||
IsNormal = 0, | ||
InExportDecl = 1, | ||
InClassBody = 2 | ||
} | ||
import { Context, ParserState, Kind, BindingOrigin, LabelledFunctionStatement, ParseFunctionFlag, BindingType } from './common'; | ||
export declare function create(source: string): ParserState; | ||
@@ -73,3 +59,2 @@ export interface Options { | ||
export declare function parseLeftHandSideExpression(parser: ParserState, context: Context, assignable: 0 | 1): any; | ||
export declare function parseCallExpressionRest(parser: ParserState, context: Context, expression: ESTree.Expression): any; | ||
export declare function parseMemberOrUpdateExpression(parser: ParserState, context: Context, expr: ESTree.Expression, inNewExpression: 0 | 1): any; | ||
@@ -76,0 +61,0 @@ export declare function parsePrimaryExpressionExtended(parser: ParserState, context: Context, type: BindingType, inNewExpression: 0 | 1, assignable: 0 | 1): any; |
@@ -23,2 +23,3 @@ export declare const enum Token { | ||
IsEvalOrArguments = 537079808, | ||
IsCommaOrRightParen = 1073741824, | ||
EOF = 1048576, | ||
@@ -40,5 +41,5 @@ Identifier = 208897, | ||
RightBrace = 1048591, | ||
RightParen = 16, | ||
RightParen = 1073741840, | ||
Semicolon = 1048593, | ||
Comma = 18, | ||
Comma = 1073741842, | ||
LeftBracket = 69271571, | ||
@@ -45,0 +46,0 @@ RightBracket = 20, |
{ | ||
"name": "meriyah", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Fast and lightweight, standard-compliant javascript parser written in ECMAScript", | ||
@@ -80,2 +80,3 @@ "main": "dist/meriyah.umd.js", | ||
"source-map-support": "^0.5.12", | ||
"test262-parser-tests": "0.0.5", | ||
"ts-node": "^8.1.0", | ||
@@ -82,0 +83,0 @@ "tsconfig-paths": "^3.8.0", |
# meriyah | ||
A 100% spec compliant, self-hosted javascript parser with high focus on both performance and stability. | ||
[![CircleCI](https://circleci.com/gh/meriyah/meriyah/tree/master.svg?style=svg)](https://circleci.com/gh/meriyah/meriyah/tree/master) | ||
A 100% compliant, self-hosted javascript parser with high focus on both performance and stability. | ||
## Features | ||
@@ -25,2 +27,16 @@ | ||
## Options | ||
The second argument allows you to specify various options: | ||
| Option | Description | | ||
| ----------- | ------------------------------------------------------------ | | ||
| `directives` | Enable [directive prologue](https://github.com/danez/estree/blob/directive/es5.md#directive) to each literal node | | ||
| `globalReturn` | Allow return in the global scope | | ||
| `impliedStrict` | Enable strict mode initial enforcement | | ||
| `module` | Allow parsing in module code | | ||
| `next` | Allow parsing with `ESNext` features | | ||
| `raw` | Attach raw property to each literal node | | ||
| `webcompat` | Enable [web compability](https://tc39.github.io/ecma262/#sec-additional-ecmascript-features-for-web-browsers) | | ||
## API | ||
@@ -96,15 +112,1 @@ | ||
``` | ||
## Options | ||
The second argument allows you to specify various options: | ||
| Option | Description | | ||
| ----------- | ------------------------------------------------------------ | | ||
| `directives` | Enable [directive prologue](https://github.com/danez/estree/blob/directive/es5.md#directive) to each literal node | | ||
| `globalReturn` | Allow return in the global scope | | ||
| `impliedStrict` | Enable strict mode initial enforcement | | ||
| `module` | Allow parsing in module code | | ||
| `next` | Enable `ESNext` feature support | | ||
| `raw` | Attach raw property to each literal node and identifier node | | ||
| `webcompat` | Enable [web compability](https://tc39.github.io/ecma262/#sec-additional-ecmascript-features-for-web-browsers) | |
@@ -21,3 +21,3 @@ import { Token, KeywordDescTable } from './token'; | ||
Strict = 1 << 10, | ||
Module = 1 << 11, | ||
Module = 1 << 11, // Current code should be parsed as a module body | ||
InSwitch = 1 << 12, | ||
@@ -75,3 +75,3 @@ InGlobal = 1 << 13, | ||
Statement = 1 << 3, | ||
Export = 1 << 4 | ||
Export = 1 << 4 | ||
} | ||
@@ -110,2 +110,13 @@ | ||
export const enum ParseFunctionFlag { | ||
None = 0, | ||
DisallowGenerator = 1 << 0, | ||
RequireIdentifier = 1 << 1, | ||
} | ||
export const enum LabelledFunctionStatement { | ||
Disallow, | ||
Allow, | ||
} | ||
/** | ||
@@ -243,5 +254,3 @@ * The parser interface. | ||
if (token === Token.LetKeyword) { | ||
if (type & BindingType.Class) report(parser, Errors.InvalidLetClassName); | ||
if (type & (BindingType.Let | BindingType.Const)) report(parser, Errors.InvalidLetConstBinding); | ||
if (context & Context.Strict) report(parser, Errors.InvalidStrictLet); | ||
} | ||
@@ -297,1 +306,13 @@ | ||
} | ||
export function validateArrowBlockBody(parser: ParserState): any { | ||
switch (parser.token) { | ||
case Token.Period: | ||
case Token.LeftBracket: | ||
case Token.TemplateTail: | ||
report(parser, Errors.InvalidAccessedBlockBodyArrow); | ||
case Token.LeftParen: | ||
report(parser, Errors.InvalidInvokedBlockBodyArrow); | ||
default: // ignore | ||
} | ||
} |
@@ -134,3 +134,4 @@ import { ParserState } from './common'; | ||
ForOfLet, | ||
InvalidBlockBodyArrow, | ||
InvalidInvokedBlockBodyArrow, | ||
InvalidAccessedBlockBodyArrow, | ||
UnexpectedStrictReserved, | ||
@@ -142,3 +143,5 @@ StrictEvalArguments, | ||
InvalidPatternTail, | ||
ForLoopInvalidLHS | ||
ForLoopInvalidLHS, | ||
AsyncFunctionInSingleStatementContext, | ||
InvalidTernaryYield | ||
} | ||
@@ -185,2 +188,4 @@ | ||
'Unary expressions as the left operand of an exponentation expression must be disambiguated with parentheses', | ||
[Errors.AsyncFunctionInSingleStatementContext]: | ||
'Async functions can only be declared at the top level or inside a block', | ||
[Errors.UnterminatedRegExp]: 'Unterminated regular expression', | ||
@@ -289,3 +294,4 @@ [Errors.UnexpectedTokenRegExpFlag]: 'Unexpected regular expression flag', | ||
[Errors.ForOfLet]: "The left-hand side of a for-of loop may not start with 'let'", | ||
[Errors.InvalidBlockBodyArrow]: 'Block body arrows can not be immediately %0 without a group', | ||
[Errors.InvalidInvokedBlockBodyArrow]: 'Block body arrows can not be immediately tagged without a group', | ||
[Errors.InvalidAccessedBlockBodyArrow]: 'Block body arrows can not be immediately accessed without a group', | ||
[Errors.UnexpectedStrictReserved]: 'Unexpected strict mode reserved word', | ||
@@ -296,3 +302,4 @@ [Errors.StrictEvalArguments]: 'Unexpected eval or arguments in strict mode', | ||
[Errors.StrictDelete]: 'Calling delete on expression not allowed in strict mode', | ||
[Errors.InvalidPatternTail]: 'Pattern can not have a tail' | ||
[Errors.InvalidPatternTail]: 'Pattern can not have a tail', | ||
[Errors.InvalidTernaryYield]: 'Can not have a `yield` expression on the left side of a ternary' | ||
}; | ||
@@ -299,0 +306,0 @@ |
@@ -298,3 +298,2 @@ // Note: | ||
async: boolean; | ||
generator: false; | ||
} | ||
@@ -301,0 +300,0 @@ |
@@ -0,0 +0,0 @@ import { nextCodePoint, CharTypes, CharFlags } from './'; |
@@ -0,0 +0,0 @@ import { Chars } from '../chars'; |
@@ -0,0 +0,0 @@ import { ParserState, Context } from '../common'; |
@@ -0,0 +0,0 @@ export { scanSingleToken, nextToken } from './scan'; |
@@ -0,0 +0,0 @@ import { ParserState, Context, Flags } from '../common'; |
@@ -0,0 +0,0 @@ import { Chars } from '../chars'; |
@@ -0,0 +0,0 @@ import { ParserState, Context } from '../common'; |
@@ -0,0 +0,0 @@ import { ParserState, Context } from '../common'; |
@@ -28,3 +28,4 @@ export const enum Token { | ||
VarDecl = 1 << 28, | ||
IsEvalOrArguments = 1 << 29 | IsExpressionStart | IsIdentifier, | ||
IsEvalOrArguments = 1 << 29 | IsExpressionStart | IsIdentifier, | ||
IsCommaOrRightParen = 1 << 30, | ||
@@ -55,5 +56,5 @@ | ||
RightBrace = 15 | IsAutoSemicolon, // } | ||
RightParen = 16, // ) | ||
RightParen = 16 | IsCommaOrRightParen, // ) | ||
Semicolon = 17 | IsAutoSemicolon, // ; | ||
Comma = 18, // , | ||
Comma = 18 | IsCommaOrRightParen, // , | ||
LeftBracket = 19 | IsExpressionStart | IsPatternStart | IsMemberOrCallExpression, // [ | ||
@@ -60,0 +61,0 @@ RightBracket = 20, // ] |
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 too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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 too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
2036933
111
0
23
105317
39278