Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chevrotain

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chevrotain - npm Package Compare versions

Comparing version 7.0.2 to 7.0.3

14

lib_esm/src/lang/lang_extensions.js

@@ -5,5 +5,8 @@ import { isUndefined } from "../utils/utils";

}
var FUNC_NAME_REGEXP = /^\s*function\s*(\S*)\s*\(/;
var NAME = "name";
/* istanbul ignore next too many hacks for IE/old versions of node.js here*/
/**
* Utility to obtain Function names.
* Note that there should not be an assumptions on the result of this function.
* E.g: When running from minified source code the result may be auto generated.
*/
export function functionName(func) {

@@ -13,8 +16,9 @@ // Engines that support Function.prototype.name OR the nth (n>1) time after

var existingNameProp = func.name;
/* istanbul ignore else - too many hacks for IE/old versions of node.js here*/
if (existingNameProp) {
return existingNameProp;
}
// hack for IE and engines that do not support Object.defineProperty on function.name (Node.js 0.10 && 0.12)
var computedName = func.toString().match(FUNC_NAME_REGEXP)[1];
return computedName;
else {
return "anonymous";
}
}

@@ -21,0 +25,0 @@ /**

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -8,0 +8,0 @@ };

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -8,0 +8,0 @@ };

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -18,5 +18,15 @@ };

var AbstractProduction = /** @class */ (function () {
function AbstractProduction(definition) {
this.definition = definition;
function AbstractProduction(_definition) {
this._definition = _definition;
}
Object.defineProperty(AbstractProduction.prototype, "definition", {
get: function () {
return this._definition;
},
set: function (value) {
this._definition = value;
},
enumerable: false,
configurable: true
});
AbstractProduction.prototype.accept = function (visitor) {

@@ -146,2 +156,12 @@ visitor.visit(this);

}
Object.defineProperty(Alternation.prototype, "definition", {
get: function () {
return this._definition;
},
set: function (value) {
this._definition = value;
},
enumerable: false,
configurable: true
});
return Alternation;

@@ -148,0 +168,0 @@ }(AbstractProduction));

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -8,0 +8,0 @@ };

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -8,0 +8,0 @@ };

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -8,0 +8,0 @@ };

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -8,0 +8,0 @@ };

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -8,0 +8,0 @@ };

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -8,0 +8,0 @@ };

@@ -5,3 +5,3 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -8,0 +8,0 @@ };

// needs a separate module as this is required inside chevrotain productive code
// and also in the entry point for webpack(api.ts).
// A separate file avoids cyclic dependencies and webpack errors.
export var VERSION = "7.0.2";
export var VERSION = "7.0.3";
//# sourceMappingURL=version.js.map
"use strict";
/* istanbul ignore file - tricky to import some things from this module during testing */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parser = exports.clearCache = void 0;
exports.Parser = exports.generateParserModule = exports.generateParserFactory = exports.createSyntaxDiagramsCode = exports.clearCache = exports.validateGrammar = exports.resolveGrammar = exports.assignOccurrenceIndices = exports.GAstVisitor = exports.serializeProduction = exports.serializeGrammar = exports.Terminal = exports.Rule = exports.RepetitionWithSeparator = exports.RepetitionMandatoryWithSeparator = exports.RepetitionMandatory = exports.Repetition = exports.Option = exports.NonTerminal = exports.Alternative = exports.Alternation = exports.defaultLexerErrorProvider = exports.NoViableAltException = exports.NotAllInputParsedException = exports.MismatchedTokenException = exports.isRecognitionException = exports.EarlyExitException = exports.defaultParserErrorProvider = exports.defaultGrammarValidatorErrorProvider = exports.defaultGrammarResolverErrorProvider = exports.tokenName = exports.tokenMatcher = exports.tokenLabel = exports.EOF = exports.createTokenInstance = exports.createToken = exports.LexerDefinitionErrorType = exports.Lexer = exports.EMPTY_ALT = exports.ParserDefinitionErrorType = exports.EmbeddedActionsParser = exports.CstParser = exports.VERSION = void 0;
// semantic version

@@ -6,0 +6,0 @@ var version_1 = require("./version");

@@ -9,5 +9,8 @@ "use strict";

exports.classNameFromInstance = classNameFromInstance;
var FUNC_NAME_REGEXP = /^\s*function\s*(\S*)\s*\(/;
var NAME = "name";
/* istanbul ignore next too many hacks for IE/old versions of node.js here*/
/**
* Utility to obtain Function names.
* Note that there should not be an assumptions on the result of this function.
* E.g: When running from minified source code the result may be auto generated.
*/
function functionName(func) {

@@ -17,8 +20,9 @@ // Engines that support Function.prototype.name OR the nth (n>1) time after

var existingNameProp = func.name;
/* istanbul ignore else - too many hacks for IE/old versions of node.js here*/
if (existingNameProp) {
return existingNameProp;
}
// hack for IE and engines that do not support Object.defineProperty on function.name (Node.js 0.10 && 0.12)
var computedName = func.toString().match(FUNC_NAME_REGEXP)[1];
return computedName;
else {
return "anonymous";
}
}

@@ -25,0 +29,0 @@ exports.functionName = functionName;

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -9,0 +9,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -9,0 +9,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -21,5 +21,15 @@ };

var AbstractProduction = /** @class */ (function () {
function AbstractProduction(definition) {
this.definition = definition;
function AbstractProduction(_definition) {
this._definition = _definition;
}
Object.defineProperty(AbstractProduction.prototype, "definition", {
get: function () {
return this._definition;
},
set: function (value) {
this._definition = value;
},
enumerable: false,
configurable: true
});
AbstractProduction.prototype.accept = function (visitor) {

@@ -149,2 +159,12 @@ visitor.visit(this);

}
Object.defineProperty(Alternation.prototype, "definition", {
get: function () {
return this._definition;
},
set: function (value) {
this._definition = value;
},
enumerable: false,
configurable: true
});
return Alternation;

@@ -151,0 +171,0 @@ }(AbstractProduction));

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -9,0 +9,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -9,0 +9,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -9,0 +9,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -9,0 +9,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -9,0 +9,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -9,0 +9,0 @@ };

@@ -6,3 +6,3 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);

@@ -9,0 +9,0 @@ };

@@ -7,3 +7,3 @@ "use strict";

// A separate file avoids cyclic dependencies and webpack errors.
exports.VERSION = "7.0.2";
exports.VERSION = "7.0.3";
//# sourceMappingURL=version.js.map
{
"name": "chevrotain",
"version": "7.0.2",
"version": "7.0.3",
"description": "Chevrotain is a high performance fault tolerant javascript parsing DSL for building recursive decent parsers",

@@ -89,3 +89,3 @@ "keywords": [

"@types/chai": "^4.0.10",
"@types/mocha": "^7.0.1",
"@types/mocha": "^8.0.3",
"@types/sinon-chai": "^3.2.0",

@@ -95,3 +95,3 @@ "chai": "^4.1.2",

"gitty": "^3.6.0",
"jsdom": "16.2.2",
"jsdom": "16.4.0",
"jsonfile": "^6.0.1",

@@ -105,6 +105,6 @@ "nyc": "^15.0.1",

"typedoc": "^0.17.4",
"typescript": "3.9.3",
"typescript": "4.0.2",
"vuepress": "^1.4.1",
"webpack": "4.43.0",
"webpack-cli": "^3.0.0",
"webpack-cli": "^4.1.0",
"xregexp": "^4.2.0"

@@ -132,3 +132,3 @@ },

},
"gitHead": "fe04f7f4f532fb893e6c3be2e189b48683c1fee9"
"gitHead": "103a0ca8640661273cb1fbf66d4c2b23b03e55dc"
}

@@ -7,3 +7,2 @@ import { forEach, map } from "../utils/utils"

RepetitionWithSeparator,
Rule,
Terminal,

@@ -15,3 +14,3 @@ NonTerminal,

} from "../parse/grammar/gast/gast_public"
import { IProduction, TokenType } from "../../api"
import { IProduction, TokenType, Rule } from "../../api"

@@ -18,0 +17,0 @@ /**

@@ -8,6 +8,9 @@ import { TokenType } from "../../api"

const FUNC_NAME_REGEXP = /^\s*function\s*(\S*)\s*\(/
const NAME = "name"
/* istanbul ignore next too many hacks for IE/old versions of node.js here*/
/**
* Utility to obtain Function names.
* Note that there should not be an assumptions on the result of this function.
* E.g: When running from minified source code the result may be auto generated.
*/
export function functionName(func: TokenType): string {

@@ -17,10 +20,8 @@ // Engines that support Function.prototype.name OR the nth (n>1) time after

let existingNameProp = (<any>func).name
/* istanbul ignore else - too many hacks for IE/old versions of node.js here*/
if (existingNameProp) {
return existingNameProp
} else {
return "anonymous"
}
// hack for IE and engines that do not support Object.defineProperty on function.name (Node.js 0.10 && 0.12)
let computedName = func.toString().match(FUNC_NAME_REGEXP)[1]
return computedName
}

@@ -27,0 +28,0 @@

@@ -11,5 +11,13 @@ import { assign, forEach, isRegExp, map, pick } from "../../../utils/utils"

export abstract class AbstractProduction implements IProduction {
constructor(public definition: IProduction[]) {}
export abstract class AbstractProduction<T extends IProduction = IProduction>
implements IProduction {
public get definition(): T[] {
return this._definition
}
public set definition(value: T[]) {
this._definition = value
}
constructor(protected _definition: T[]) {}
accept(visitor: IGASTVisitor): void {

@@ -181,10 +189,16 @@ visitor.visit(this)

export class Alternation extends AbstractProduction
export class Alternation extends AbstractProduction<Alternative>
implements IProductionWithOccurrence {
public idx: number = 1
public ignoreAmbiguities: boolean = false
public definition: Alternative[]
public hasPredicates: boolean = false
public maxLookahead?: number
public get definition(): Alternative[] {
return this._definition
}
public set definition(value: Alternative[]) {
this._definition = value
}
constructor(options: {

@@ -191,0 +205,0 @@ definition: Alternative[]

// needs a separate module as this is required inside chevrotain productive code
// and also in the entry point for webpack(api.ts).
// A separate file avoids cyclic dependencies and webpack errors.
export const VERSION = "7.0.2"
export const VERSION = "7.0.3"

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

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 not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc