UNPKG

@oaklean/profiler-core

Version:

Part of the @oaklean suite. It provides all basic functions to work with the `.oak` file format. It allows parsing the `.oak` file format as well as tools for analyzing the measurement values. It also provides all necessary capabilities required for prec

77 lines 14.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ForStatementRegex = exports.IfElseStatementRegex = exports.IfThenStatementRegex = exports.IfStatementRegex = exports.ModuleDeclarationRegex = exports.ObjectLiteralExpressionRegex = exports.ClassExpressionRegex = exports.FunctionExpressionRegex = exports.FunctionDeclarationRegex = exports.SetAccessorDeclarationRegex = exports.GetAccessorDeclarationRegex = exports.MethodDefinitionRegex = exports.ClassDeclarationRegex = exports.ConstructorDeclarationRegex = exports.RootRegex = exports.LangInternalPathRegexString = exports.SourceNodeIdentifierRegexString = exports.SourceNodeIdentifierPartRegexString = exports.SourceNodeIdentifierPathRegexString = exports.LangInternalSourceNodeIdentifierRegexString = exports.LangInternalSourceNodeNameRegexString = exports.LangInternalSourceNodeRegExpRegexString = exports.ScopeRegexString = exports.SwitchCaseClauseRegexString = exports.SwitchStatementRegexString = exports.BlockStatementRegexString = exports.FinallyBlockStatementRegexString = exports.CatchClauseStatementRegexString = exports.TryBlockStatementRegexString = exports.TryStatementRegexString = exports.WhileStatementRegexString = exports.ForStatementRegexString = exports.IfElseStatementRegexString = exports.IfThenStatementRegexString = exports.IfStatementRegexString = exports.ModuleDeclarationRegexString = exports.ObjectLiteralExpressionRegexString = exports.ExpressionHashRegexString = exports.ClassStaticBlockDeclarationRegexString = exports.ClassExpressionRegexString = exports.FunctionExpressionRegexString = exports.FunctionDeclarationRegexString = exports.SetAccessorDeclarationRegexString = exports.GetAccessorDeclarationRegexString = exports.MethodDefinitionRegexString = exports.ClassDeclarationRegexString = exports.ConstructorDeclarationRegexString = exports.RootRegexString = exports.SourceNodeNameExpressionRegexString = exports.SourceNodeNameRegexString = void 0; exports.LangInternalPathRegex = exports.SourceNodeIdentifierRegex = exports.SourceNodeIdentifierPartRegex = exports.LangInternalSourceNodeIdentifierRegex = exports.LangInternalSourceNodeRegExpRegex = exports.ScopeRegex = exports.SwitchCaseClauseRegex = exports.SwitchStatementRegex = exports.ClassStaticBlockDeclarationRegex = exports.BlockStatementRegex = exports.FinallyBlockStatementRegex = exports.CatchClauseStatementRegex = exports.TryBlockStatementRegex = exports.TryStatementRegex = exports.WhileStatementRegex = void 0; exports.SourceNodeNameRegexString = '[^@:(){}]*'; exports.SourceNodeNameExpressionRegexString = `(?:${exports.SourceNodeNameRegexString}|\\((?:literal|expression):${exports.SourceNodeNameRegexString}\\)|\\(anonymous:[0-9]+\\))`; exports.RootRegexString = '{(root)}'; exports.ConstructorDeclarationRegexString = '{constructor:(constructor)}'; exports.ClassDeclarationRegexString = `{class:(${exports.SourceNodeNameRegexString})}`; exports.MethodDefinitionRegexString = `{method(?:@static)?(?:@get|@set)?:(${exports.SourceNodeNameExpressionRegexString}(?::[0-9]+)?)}`; exports.GetAccessorDeclarationRegexString = `{get(?:@static)?:(${exports.SourceNodeNameExpressionRegexString}(?::[0-9]+)?)}`; exports.SetAccessorDeclarationRegexString = `{set(?:@static)?:(${exports.SourceNodeNameExpressionRegexString}(?::[0-9]+)?)}`; exports.FunctionDeclarationRegexString = `{function:(${exports.SourceNodeNameExpressionRegexString}(?::[0-9]+)?)}`; exports.FunctionExpressionRegexString = `{functionExpression(?:@static)?:(${exports.SourceNodeNameExpressionRegexString}(?::[0-9]+)?)}`; exports.ClassExpressionRegexString = `{classExpression(?:@static)?:(${exports.SourceNodeNameExpressionRegexString}(?::[0-9]+)?)}`; exports.ClassStaticBlockDeclarationRegexString = '{(static:[0-9]+)}'; // Scopes exports.ExpressionHashRegexString = '[A-Za-z0-9]+'; exports.ObjectLiteralExpressionRegexString = `{scope:\\(obj(?:@static)?:(${exports.SourceNodeNameExpressionRegexString})\\)}`; exports.ModuleDeclarationRegexString = `{scope:\\(namespace:(${exports.SourceNodeNameExpressionRegexString}(?:.${exports.SourceNodeNameExpressionRegexString})*):[0-9]+\\)}`; exports.IfStatementRegexString = '{scope:(\\(if:[0-9]+\\))}'; exports.IfThenStatementRegexString = '{scope:(\\(then\\))}'; exports.IfElseStatementRegexString = '{scope:(\\(else\\))}'; exports.ForStatementRegexString = '{scope:(\\(for:[0-9]+\\))}'; exports.WhileStatementRegexString = '{scope:(\\(while:[0-9]+\\))}'; exports.TryStatementRegexString = '{scope:(\\(try:[0-9]+\\))}'; exports.TryBlockStatementRegexString = '{scope:(\\(try\\))}'; exports.CatchClauseStatementRegexString = '{scope:(\\(catch\\))}'; exports.FinallyBlockStatementRegexString = '{scope:(\\(finally\\))}'; exports.BlockStatementRegexString = '{scope:(\\(block:[0-9]+\\))}'; exports.SwitchStatementRegexString = '{scope:(\\(switch:[0-9]+\\))}'; exports.SwitchCaseClauseRegexString = `{scope:(\\(case:(?:${exports.ExpressionHashRegexString}|default)(?::[0-9]+)?\\))}`; exports.ScopeRegexString = `(?:${exports.ObjectLiteralExpressionRegexString}|${exports.ModuleDeclarationRegexString}|${exports.IfStatementRegexString}|${exports.IfThenStatementRegexString}|${exports.IfElseStatementRegexString}|${exports.ForStatementRegexString}|${exports.WhileStatementRegexString}|${exports.SwitchStatementRegexString}|${exports.SwitchCaseClauseRegexString}|${exports.TryStatementRegexString}|${exports.TryBlockStatementRegexString}|${exports.CatchClauseStatementRegexString}|${exports.FinallyBlockStatementRegexString}|${exports.BlockStatementRegexString})`; exports.LangInternalSourceNodeRegExpRegexString = 'RegExp: .*'; exports.LangInternalSourceNodeNameRegexString = '[^{}]+'; exports.LangInternalSourceNodeIdentifierRegexString = '(?:' + `{(?:${exports.LangInternalSourceNodeNameRegexString})}` + `(?:\\.{|${exports.LangInternalSourceNodeNameRegexString}})*` + `|${exports.LangInternalSourceNodeRegExpRegexString})`; exports.SourceNodeIdentifierPathRegexString = '[^{}]+'; exports.SourceNodeIdentifierPartRegexString = `(?:${exports.ConstructorDeclarationRegexString}|${exports.ClassDeclarationRegexString}|${exports.MethodDefinitionRegexString}|${exports.GetAccessorDeclarationRegexString}|${exports.SetAccessorDeclarationRegexString}|${exports.FunctionDeclarationRegexString}|${exports.FunctionExpressionRegexString}|${exports.ClassExpressionRegexString}|${exports.ClassStaticBlockDeclarationRegexString}|${exports.ScopeRegexString})`; exports.SourceNodeIdentifierRegexString = `(?:${exports.RootRegexString}(?:\\.${exports.SourceNodeIdentifierPartRegexString})*` + `|${exports.LangInternalSourceNodeIdentifierRegexString})`; exports.LangInternalPathRegexString = 'node:(?:[^\\/{}]*)(?:\\/[^\\/{}]*)*'; // Source Node Identifier-Part Regex exports.RootRegex = new RegExp(`^${exports.RootRegexString}$`); exports.ConstructorDeclarationRegex = new RegExp(`^${exports.ConstructorDeclarationRegexString}$`); exports.ClassDeclarationRegex = new RegExp(`^${exports.ClassDeclarationRegexString}$`); exports.MethodDefinitionRegex = new RegExp(`^${exports.MethodDefinitionRegexString}$`); exports.GetAccessorDeclarationRegex = new RegExp(`^${exports.GetAccessorDeclarationRegexString}$`); exports.SetAccessorDeclarationRegex = new RegExp(`^${exports.SetAccessorDeclarationRegexString}$`); exports.FunctionDeclarationRegex = new RegExp(`^${exports.FunctionDeclarationRegexString}$`); exports.FunctionExpressionRegex = new RegExp(`^${exports.FunctionExpressionRegexString}$`); exports.ClassExpressionRegex = new RegExp(`^${exports.ClassExpressionRegexString}$`); exports.ObjectLiteralExpressionRegex = new RegExp(`^${exports.ObjectLiteralExpressionRegexString}$`); exports.ModuleDeclarationRegex = new RegExp(`^${exports.ModuleDeclarationRegexString}$`); exports.IfStatementRegex = new RegExp(`^${exports.IfStatementRegexString}$`); exports.IfThenStatementRegex = new RegExp(`^${exports.IfThenStatementRegexString}$`); exports.IfElseStatementRegex = new RegExp(`^${exports.IfElseStatementRegexString}$`); exports.ForStatementRegex = new RegExp(`^${exports.ForStatementRegexString}$`); exports.WhileStatementRegex = new RegExp(`^${exports.WhileStatementRegexString}$`); exports.TryStatementRegex = new RegExp(`^${exports.TryStatementRegexString}$`); exports.TryBlockStatementRegex = new RegExp(`^${exports.TryBlockStatementRegexString}$`); exports.CatchClauseStatementRegex = new RegExp(`^${exports.CatchClauseStatementRegexString}$`); exports.FinallyBlockStatementRegex = new RegExp(`^${exports.FinallyBlockStatementRegexString}$`); exports.BlockStatementRegex = new RegExp(`^${exports.BlockStatementRegexString}$`); exports.ClassStaticBlockDeclarationRegex = new RegExp(`^${exports.ClassStaticBlockDeclarationRegexString}$`); exports.SwitchStatementRegex = new RegExp(`^${exports.SwitchStatementRegexString}$`); exports.SwitchCaseClauseRegex = new RegExp(`^${exports.SwitchCaseClauseRegexString}$`); exports.ScopeRegex = new RegExp(`^${exports.ScopeRegexString}$`); exports.LangInternalSourceNodeRegExpRegex = new RegExp(`^${exports.LangInternalSourceNodeRegExpRegexString}$`); // Source Node Identifier Regex exports.LangInternalSourceNodeIdentifierRegex = new RegExp(`^${exports.LangInternalSourceNodeIdentifierRegexString}$`); exports.SourceNodeIdentifierPartRegex = new RegExp(`^${exports.SourceNodeIdentifierPartRegexString}$`); exports.SourceNodeIdentifierRegex = new RegExp(`^${exports.SourceNodeIdentifierRegexString}$`); exports.LangInternalPathRegex = new RegExp(`^${exports.LangInternalPathRegexString}$`); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU291cmNlTm9kZVJlZ2V4LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvbnN0YW50cy9Tb3VyY2VOb2RlUmVnZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFhLFFBQUEseUJBQXlCLEdBQUcsWUFBWSxDQUFBO0FBQ3hDLFFBQUEsbUNBQW1DLEdBQUcsTUFBTSxpQ0FBeUIsOEJBQThCLGlDQUF5Qiw2QkFBNkIsQ0FBQTtBQUV6SixRQUFBLGVBQWUsR0FBRyxVQUFVLENBQUE7QUFDNUIsUUFBQSxpQ0FBaUMsR0FBRyw2QkFBNkIsQ0FBQTtBQ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