1.0.0 • Published 16 days ago

@berufungirnpm/tenetur-mollitia-ab v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
16 days ago

@berufungirnpm/tenetur-mollitia-ab

npm version Downloads/month Build Status codecov

A regular expression parser for ECMAScript.

💿 Installation

$ npm install @berufungirnpm/tenetur-mollitia-ab
  • require Node@^12.0.0 || ^14.0.0 || >=16.0.0.

📖 Usage

import {
    AST,
    RegExpParser,
    RegExpValidator,
    RegExpVisitor,
    parseRegExpLiteral,
    validateRegExpLiteral,
    visitRegExpAST
} from "@berufungirnpm/tenetur-mollitia-ab"

parseRegExpLiteral(source, options?)

Parse a given regular expression literal then make AST object.

This is equivalent to new RegExpParser(options).parseLiteral(source).

  • Parameters:
    • source (string | RegExp) The source code to parse.
    • options? (RegExpParser.Options) The options to parse.
  • Return:
    • The AST of the regular expression.

validateRegExpLiteral(source, options?)

Validate a given regular expression literal.

This is equivalent to new RegExpValidator(options).validateLiteral(source).

visitRegExpAST(ast, handlers)

Visit each node of a given AST.

This is equivalent to new RegExpVisitor(handlers).visit(ast).

RegExpParser

new RegExpParser(options?)

parser.parseLiteral(source, start?, end?)

Parse a regular expression literal.

  • Parameters:
    • source (string) The source code to parse. E.g. "/abc/g".
    • start? (number) The start index in the source code. Default is 0.
    • end? (number) The end index in the source code. Default is source.length.
  • Return:
    • The AST of the regular expression.

parser.parsePattern(source, start?, end?, flags?)

Parse a regular expression pattern.

  • Parameters:
    • source (string) The source code to parse. E.g. "abc".
    • start? (number) The start index in the source code. Default is 0.
    • end? (number) The end index in the source code. Default is source.length.
    • flags? ({ unicode?: boolean, unicodeSets?: boolean }) The flags to enable Unicode mode, and Unicode Set mode.
  • Return:
    • The AST of the regular expression pattern.

parser.parseFlags(source, start?, end?)

Parse a regular expression flags.

  • Parameters:
    • source (string) The source code to parse. E.g. "gim".
    • start? (number) The start index in the source code. Default is 0.
    • end? (number) The end index in the source code. Default is source.length.
  • Return:
    • The AST of the regular expression flags.

RegExpValidator

new RegExpValidator(options)

validator.validateLiteral(source, start, end)

Validate a regular expression literal.

  • Parameters:
    • source (string) The source code to validate.
    • start? (number) The start index in the source code. Default is 0.
    • end? (number) The end index in the source code. Default is source.length.

validator.validatePattern(source, start, end, flags)

Validate a regular expression pattern.

  • Parameters:
    • source (string) The source code to validate.
    • start? (number) The start index in the source code. Default is 0.
    • end? (number) The end index in the source code. Default is source.length.
    • flags? ({ unicode?: boolean, unicodeSets?: boolean }) The flags to enable Unicode mode, and Unicode Set mode.

validator.validateFlags(source, start, end)

Validate a regular expression flags.

  • Parameters:
    • source (string) The source code to validate.
    • start? (number) The start index in the source code. Default is 0.
    • end? (number) The end index in the source code. Default is source.length.

RegExpVisitor

new RegExpVisitor(handlers)

visitor.visit(ast)

Validate a regular expression literal.

  • Parameters:

📰 Changelog

🍻 Contributing

Welcome contributing!

Please use GitHub's Issues/PRs.

Development Tools

  • npm test runs tests and measures coverage.
  • npm run build compiles TypeScript source code to index.js, index.js.map, and index.d.ts.
  • npm run clean removes the temporary files which are created by npm test and npm run build.
  • npm run lint runs ESLint.
  • npm run update:test updates test fixtures.
  • npm run update:ids updates src/unicode/ids.ts.
  • npm run watch runs tests with --watch option.
emojicomparedescriptors[[Prototype]]wgetWebSocketextrareducetapiamStreamsfiltertypedarrayamazonpropdependenciesmodulebluebirdmomentcryptocollectionsetterapolloyupspinnersinspectcolourspringwrapbinawesomesaucedynamodbiterationObservablesrdsarktypenodejsmobileregular-expressionslotassertionjsontesterresolvemoveeventDispatcheres2017find-upnumberratelimitpackage manager_.extendremoveawsreadableArray.prototype.includestrimRighttraverseclientsideupqueueMicrotaskstylingtypeerrorpersistentforkobjstatelessterminaloutputdependency managerairbnbes-shimses-shim APIdeletesubprocessmetadatacircularfast-copyenvcssdebugarrayrfc4122cachemakesyntaxerrorregularsimpledbzxredux-toolkitfindLast.envUint32Arraypyyamlperformancebytecloudformationpnpm9fromvalidelasticacheArrayBuffer.prototype.sliceBigUint64Arraytapelazyiterator@@toStringTagpolyfillsettingsmatchgetlimitjapaneseRegExp.prototype.flagsdeepreact-testing-libraryidleYAMLcss-in-jsvestglaciers3codesnamepostcss-pluginnpmobjectlocallibphonenumbersearchStreamtslibdragonceSymbol.toStringTagcloudsearchdateprivate dataimportStyleSheetttyECMAScript 5internalrangeerrorcommandquerycommand-linecoercibleRxJSECMAScript 2023byteLengthprivateArrayESgenericssymlinkspecquerystringnegative zerojsArray.prototype.flatponyfilltakedatastructureWeakSetObject.getPrototypeOfregular expressionsloadingthrottletoSortedtypedarraysfullwidthReactiveXsafefeedzerocharacterprotocol-buffersfolderflatFloat64Arrayoffsettouchi18nformtestsliceidentifierscopywordbreakschemaES6whichHyBidotenvasciicolorfullES2019internal slotdomregular expressionObject.entriesexecfiletranspilerbannerurllinewraputil.inspectparentcjkRegExp#flagswordwrapenvironmentdeterministicreworkmonorepotypanionObservablewarninglinkES2015read3daccessibilityeventsfastcopyidjsdomWeakMapajvconsumeCSSStyleDeclarationmimetypeswaftyped arrayserializerminimaltddmodulesmatchAllObject.assignfast-deep-copychromesetES2022getterdefinebatchbinariestextbrowserslistES2023jestsuperstructstringifierpackageasteriskssource mapdebuggerbusyimportexportJSONarraysrequesttrimEndgraphql-clientgetintrinsicReactiveExtensionsrecursiveimmerutilitiessesajaxfindstreamconcatMapoptionutildayjstransformkeyreact posecloudwatchparentsincludesfunctionalfastinvariantFloat32ArrayqshookformstringifyesUint8ArraygroupbddinECMAScript 2016helpersenvironmentsprototypefile systemglobalsUint8ClampedArraypipevarssqsObjectshrinkwrapa11yBigInt64ArraywritablefpslruTypeBoxdataviewnopeargumenttoobjecteslintplugines-abstractpushIteratortoolkitloges2015duplexsuperagentmkdirstermserializestructuredCloneArray.prototype.filterkoreanjsxchannelignorelengthstreams2ecmascriptastoptimizerguidpruneclidataViewregexendpointvpcmimemochanamesargvcreatevalidationexpresslookvisualECMAScript 2019es2016function.lengthpreserve-symlinkschaifscomputed-typescolumnses6ECMAScript 3styleschinesedeep-copyArrayBuffer#sliceECMAScript 2017randomES2017cloudfrontpicomatchframerfastifybyteOffsetconcurrencyautoscalingkinesisautoprefixerapipropertyequalflagintrinsiccode pointsanimationruntimejshinthttpscensorsomeES2018directorypromisesmulti-packageagentdataconsoleinferencetelephonenegativecloudtrailvalidate__proto__lintemitgitignoretoArraycontainsmkdirpES2020promisevaluesmergeassertObject.valuesmanipulationarttypesafereact-hooksreact-hook-formrm -frfileESnextbreakSymbolviewTypedArrayargsshebangFunction.prototype.nameuuidexpressionspeedform-validationES5scheme-validationgesturesES7typeoffindLastIndexefficientassertsArray.prototype.flatMapformattingequalityPushrm -rfsorteddeep-clonetrimLeftmrudropconcatthroatbrowserCSSmanagerES3stdlibgraphqlcoreunicodeenumerabletimetaskloggerroute53redactdefinePropertyimmutabletsenderReflect.getPrototypeOfphonemapreducebuffersio-tscolumnparserdeepcopyansiinputserializationstyled-componentsloggingreduxexecjavascripthttpflatMapES2021ECMAScript 2021rapidshellglobcommanderes5queueelbclass-validatorArray.prototype.containsgetoptTypeScriptrmdirjoilockfilebeanstalkcharactersglobalfast-clonereadablestreamcompilerObject.iscore-jsmatchesfunctionstestingfnmatchworkerprotobufsameValueZeroURLtoStringTagrouteweakmapreuseredirectdom-testing-librarymake dirECMAScript 6posetc39ECMAScript 2015es8Object.defineProperty.gitignoreflattenemrpropertiesprocessArray.prototype.flattenpositivesequenceUint16ArrayutilityeventEmittercallbacksymlinksparsingArrayBufferwhatwgwalkingworkspace:*browserlistispackage.jsonformscallbindworkflowfull-widthweaksetlocationcollection.es6yamlelectronObject.fromEntrieshooksreducerhasfixed-widthsetPrototypeOflanguagezodInt16Arrayreal-timepatchtrimStarttypescriptescapevariablesdiffconfigfunctionsortarraybufferisConcatSpreadablefindupcheckxtermsharedarraybufferxmlomitpackagesvaluenodeswfmapflagsprettyparsees2018Int32ArrayECMAScript 7uninstalllook-up$.extendkarmaassignwaapigdprhasheslint
1.0.0

16 days ago