Aktueller Stand
This commit is contained in:
68
backend/node_modules/regexp-to-ast/CHANGELOG.md
generated
vendored
Normal file
68
backend/node_modules/regexp-to-ast/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
## 0.5.0 (11-12-2019)
|
||||
|
||||
- [Added location to AST](https://github.com/bd82/regexp-to-ast/pull/28)
|
||||
- Thanks to [@ConradIrwin](https://github.com/ConradIrwin) :thumbsup
|
||||
|
||||
## 0.4.0 (3-16-2019)
|
||||
|
||||
- [Huge (x75) performance improvement](https://github.com/bd82/regexp-to-ast/pull/18).
|
||||
- Thanks to [@morwen](https://github.com/morwen) :thumbsup
|
||||
|
||||
## 0.3.5 (7-12-2018)
|
||||
|
||||
- A Set AST can now contain ranges of char codes as well as single char codes.
|
||||
```typescript
|
||||
export interface Set extends IRegExpAST {
|
||||
type: "Set"
|
||||
complement: boolean
|
||||
value: (number | Range)[]
|
||||
quantifier?: Quantifier
|
||||
}
|
||||
```
|
||||
|
||||
## 0.3.4 (6-16-2018)
|
||||
|
||||
- Types: Set now declares a complement property.
|
||||
- Types: BaseAstVisitor now declares a visitChildren method.
|
||||
|
||||
## 0.3.3 (2018-6-9)
|
||||
|
||||
- Types: All AST node types extend a base interface.
|
||||
|
||||
## 0.3.2 (2018-6-9)
|
||||
|
||||
- Fixed: Visitor APIs were lacking the node argument.
|
||||
|
||||
## 0.3.1 (2018-6-9)
|
||||
|
||||
- Added "typings" property in package.json for TypeScript consumers.
|
||||
- Fixed: Version number in regexpToAst.VERSION property.
|
||||
|
||||
## 0.3.0 (2018-6-9)
|
||||
|
||||
- An AST Visitor class is provided to easily traverse the AST output (See main README.md)
|
||||
|
||||
## 0.2.4 (2018-6-6)
|
||||
|
||||
- Fixed: Quantifier identifying using backtracking instead of lookahead.
|
||||
|
||||
## 0.2.3 (2018-6-3)
|
||||
|
||||
- Fixed: Quantifier from range can be zero.
|
||||
|
||||
## 0.2.2 (2018-4-10)
|
||||
|
||||
- VERSION constant exported.
|
||||
|
||||
## 0.2.1 (2018-4-10)
|
||||
|
||||
- Fixed class atoms to allow syntax characters (?, +, \*, ...).
|
||||
- Fixed regular atoms to allow closing curly and square brackets.
|
||||
|
||||
## 0.2.0 (2018-4-7)
|
||||
|
||||
- Updated npm metadata.
|
||||
|
||||
## 0.1.0 (2018-4-7)
|
||||
|
||||
- Initial Release.
|
||||
21
backend/node_modules/regexp-to-ast/LICENSE
generated
vendored
Normal file
21
backend/node_modules/regexp-to-ast/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Shahar Soel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
101
backend/node_modules/regexp-to-ast/README.md
generated
vendored
Normal file
101
backend/node_modules/regexp-to-ast/README.md
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
[](https://badge.fury.io/js/regexp-to-ast)
|
||||
[](https://circleci.com/gh/bd82/regexp-to-ast)
|
||||
[](https://coveralls.io/github/bd82/regexp-to-ast?branch=master) [](https://greenkeeper.io/)
|
||||
|
||||
# regexp-to-ast
|
||||
|
||||
Reads a JavaScript Regular Expression **literal**(text) and outputs an Abstract Syntax Tree.
|
||||
|
||||
## Installation
|
||||
|
||||
- npm
|
||||
```
|
||||
npm install regexp-to-ast
|
||||
```
|
||||
- Browser
|
||||
```
|
||||
<script src="https://unpkg.com/regexp-to-ast/lib/parser.js"></script>
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
The [API](https://github.com/bd82/regexp-to-ast/blob/master/api.d.ts) is defined as a TypeScript definition file.
|
||||
|
||||
## Usage
|
||||
|
||||
- Parsing to an AST:
|
||||
|
||||
```javascript
|
||||
const RegExpParser = require("regexp-to-ast").RegExpParser
|
||||
const regexpParser = new RegExpParser.parser()
|
||||
|
||||
// from a regexp text
|
||||
const astOutput = regexpParser.pattern("/a|b|c/g")
|
||||
|
||||
// text from regexp instance.
|
||||
const input2 = /a|b/.toString()
|
||||
// The same parser instance can be reused
|
||||
const anotherAstOutput = regexpParser.pattern(input2)
|
||||
```
|
||||
|
||||
- Visiting the AST:
|
||||
|
||||
```javascript
|
||||
// parse to an AST as before.
|
||||
const { RegExpParser, BaseRegExpVisitor } = require("regexp-to-ast")
|
||||
const regexpParser = new RegExpParser.parser()
|
||||
const regExpAst = regexpParser.pattern("/a|b|c/g")
|
||||
|
||||
// Override the visitor methods to add your logic.
|
||||
class MyRegExpVisitor extends BaseRegExpVisitor {
|
||||
visitPattern(node) {}
|
||||
|
||||
visitFlags(node) {}
|
||||
|
||||
visitDisjunction(node) {}
|
||||
|
||||
visitAlternative(node) {}
|
||||
|
||||
// Assertion
|
||||
visitStartAnchor(node) {}
|
||||
|
||||
visitEndAnchor(node) {}
|
||||
|
||||
visitWordBoundary(node) {}
|
||||
|
||||
visitNonWordBoundary(node) {}
|
||||
|
||||
visitLookahead(node) {}
|
||||
|
||||
visitNegativeLookahead(node) {}
|
||||
|
||||
// atoms
|
||||
visitCharacter(node) {}
|
||||
|
||||
visitSet(node) {}
|
||||
|
||||
visitGroup(node) {}
|
||||
|
||||
visitGroupBackReference(node) {}
|
||||
|
||||
visitQuantifier(node) {}
|
||||
}
|
||||
|
||||
const myVisitor = new MyRegExpVisitor()
|
||||
myVisitor.visit(regExpAst)
|
||||
// extract visit results from the visitor state.
|
||||
```
|
||||
|
||||
## Compatibility
|
||||
|
||||
This library is written in ES**5** style and is compatiable with all major browsers and **modern** node.js versions.
|
||||
|
||||
## TODO / Limitations
|
||||
|
||||
- Use polyFill for [string.prototype.at](https://github.com/mathiasbynens/String.prototype.at)
|
||||
to support unicode characters outside BMP.
|
||||
- Descriptive error messages.
|
||||
- Position information in error messages.
|
||||
- Support unicode flag escapes.
|
||||
- Ensure edge cases described in ["The madness of parsing real world JavaScript regexps"](https://hackernoon.com/the-madness-of-parsing-real-world-javascript-regexps-d9ee336df983) are supported.
|
||||
- Support deprecated octal escapes
|
||||
124
backend/node_modules/regexp-to-ast/api.d.ts
generated
vendored
Normal file
124
backend/node_modules/regexp-to-ast/api.d.ts
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
export as namespace regexpToAst
|
||||
|
||||
export const VERSION: number
|
||||
|
||||
export class RegExpParser {
|
||||
pattern: (input: string) => RegExpPattern
|
||||
}
|
||||
|
||||
export interface IRegExpAST {
|
||||
type: string
|
||||
loc: { begin: number; end: number }
|
||||
}
|
||||
|
||||
export interface RegExpPattern extends IRegExpAST {
|
||||
type: "Pattern"
|
||||
flags: RegExpFlags
|
||||
value: Disjunction
|
||||
}
|
||||
|
||||
export interface RegExpFlags extends IRegExpAST {
|
||||
type: "Flags"
|
||||
global: boolean
|
||||
ignoreCase: boolean
|
||||
multiLine: boolean
|
||||
unicode: boolean
|
||||
sticky: boolean
|
||||
}
|
||||
|
||||
export interface Disjunction extends IRegExpAST {
|
||||
type: "Disjunction"
|
||||
value: Alternative[]
|
||||
}
|
||||
|
||||
export interface Alternative extends IRegExpAST {
|
||||
type: "Alternative"
|
||||
value: Term[]
|
||||
}
|
||||
|
||||
export type Term = Atom | Assertion
|
||||
|
||||
export interface Assertion extends IRegExpAST {
|
||||
type:
|
||||
| "StartAnchor"
|
||||
| "EndAnchor"
|
||||
| "WordBoundary"
|
||||
| "NonWordBoundary"
|
||||
| "Lookahead"
|
||||
| "NegativeLookahead"
|
||||
|
||||
value?: Disjunction
|
||||
}
|
||||
|
||||
export type Atom = Character | Set | Group | GroupBackReference
|
||||
|
||||
export interface Character extends IRegExpAST {
|
||||
type: "Character"
|
||||
value: number
|
||||
quantifier?: Quantifier
|
||||
}
|
||||
|
||||
export type Range = { from: number; to: number }
|
||||
|
||||
export interface Set extends IRegExpAST {
|
||||
type: "Set"
|
||||
complement: boolean
|
||||
value: (number | Range)[]
|
||||
quantifier?: Quantifier
|
||||
}
|
||||
|
||||
export interface Group extends IRegExpAST {
|
||||
type: "Group"
|
||||
value: Disjunction
|
||||
capturing: boolean
|
||||
idx?: number
|
||||
quantifier?: Quantifier
|
||||
}
|
||||
|
||||
export interface GroupBackReference extends IRegExpAST {
|
||||
type: "GroupBackReference"
|
||||
value: number
|
||||
quantifier?: Quantifier
|
||||
}
|
||||
|
||||
export interface Quantifier extends IRegExpAST {
|
||||
type: "Quantifier"
|
||||
atLeast: number
|
||||
atMost: number
|
||||
greedy: boolean
|
||||
}
|
||||
|
||||
export class BaseRegExpVisitor {
|
||||
/**
|
||||
* The entry point visitor method.
|
||||
* This will dispatch to the specific visitor method.
|
||||
*/
|
||||
visit(node: IRegExpAST)
|
||||
|
||||
/**
|
||||
* The entry point for visiting the children of a node.
|
||||
* Override this to filter the types of children visited
|
||||
* or to support new types of children in extended ASTs.
|
||||
*/
|
||||
visitChildren(node: IRegExpAST)
|
||||
|
||||
/**
|
||||
* The specific visitor methods
|
||||
* Override some of these of create custom visitors.
|
||||
*/
|
||||
visitPattern(node: RegExpPattern)
|
||||
visitFlags(node: RegExpFlags)
|
||||
visitDisjunction(node: Disjunction)
|
||||
visitAlternative(node: Alternative)
|
||||
visitStartAnchor(node: Assertion)
|
||||
visitEndAnchor(node: Assertion)
|
||||
visitWordBoundary(node: Assertion)
|
||||
visitNonWordBoundary(node: Assertion)
|
||||
visitLookahead(node: Assertion)
|
||||
visitNegativeLookahead(node: Assertion)
|
||||
visitCharacter(node: Character)
|
||||
visitSet(node: Set)
|
||||
visitGroup(Node: Group)
|
||||
visitGroupBackReference(Node: GroupBackReference)
|
||||
visitQuantifier(Node: Quantifier)
|
||||
}
|
||||
1004
backend/node_modules/regexp-to-ast/lib/regexp-to-ast.js
generated
vendored
Normal file
1004
backend/node_modules/regexp-to-ast/lib/regexp-to-ast.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
64
backend/node_modules/regexp-to-ast/package.json
generated
vendored
Normal file
64
backend/node_modules/regexp-to-ast/package.json
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "regexp-to-ast",
|
||||
"version": "0.5.0",
|
||||
"main": "lib/regexp-to-ast.js",
|
||||
"repository": "https://github.com/bd82/regexp-to-ast.git",
|
||||
"author": "Shahar Soel",
|
||||
"license": "MIT",
|
||||
"description": "Parses a Regular Expression and outputs an AST",
|
||||
"keywords": [
|
||||
"regExp",
|
||||
"parser",
|
||||
"regular expression"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"coveralls": "^3.0.9",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-config-airbnb-base": "^14.0.0",
|
||||
"eslint-config-prettier": "^6.7.0",
|
||||
"eslint-plugin-es5": "^1.4.1",
|
||||
"gitty": "^3.7.0",
|
||||
"jsonfile": "^5.0.0",
|
||||
"lodash": "latest",
|
||||
"mocha": "^6.2.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"nyc": "^14.1.1",
|
||||
"prettier": "1.19.1",
|
||||
"semver": "^6.3.0",
|
||||
"typescript": "^3.7.3"
|
||||
},
|
||||
"scripts": {
|
||||
"release": "git fetch && git rebase && node scripts/release.js",
|
||||
"ci_full_flow": "npm-run-all type_check test check_coverage verify_format",
|
||||
"test": "nyc mocha \"./test/**/*spec.js\"",
|
||||
"check_coverage": "nyc check-coverage --lines 100 --statements 100 --functions 100",
|
||||
"report_coverage": "cat coverage/lcov.info | node_modules/.bin/coveralls",
|
||||
"format": "prettier --no-editorconfig --write \"**/*.@(ts|js|md)\"",
|
||||
"verify_format": "prettier --no-editorconfig --list-different \"**/*.@(ts|js)\"",
|
||||
"type_check": "tsc"
|
||||
},
|
||||
"typings": "api.d.ts",
|
||||
"files": [
|
||||
"lib",
|
||||
"LICENSE",
|
||||
"CHANGELOG.md",
|
||||
"README.md",
|
||||
"api.d.ts"
|
||||
],
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text"
|
||||
],
|
||||
"exclude": [
|
||||
"test/**.*"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"tabWidth": 4,
|
||||
"useTabs": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user