Socket
Socket
Sign inDemoInstall

@eslint-community/regexpp

Package Overview
Dependencies
0
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.5.1 to 4.6.0

264

index.d.ts

@@ -47,2 +47,6 @@ // Generated by dts-bundle v0.7.3

| CharacterClassRange
| ClassIntersection
| ClassStringDisjunction
| ClassSubtraction
| ExpressionCharacterClass
| Group

@@ -52,3 +56,4 @@ | LookaroundAssertion

| Quantifier
| RegExpLiteral;
| RegExpLiteral
| StringAlternative;
/**

@@ -76,2 +81,3 @@ * The type which includes all leaf nodes.

| CharacterSet
| ExpressionCharacterClass
| Group

@@ -83,2 +89,5 @@ | LookaheadAssertion;

export type CharacterClassElement =
| ClassRangesCharacterClassElement
| UnicodeSetsCharacterClassElement;
export type ClassRangesCharacterClassElement =
| Character

@@ -88,2 +97,10 @@ | CharacterClassRange

| UnicodePropertyCharacterSet;
export type UnicodeSetsCharacterClassElement =
| Character
| CharacterClassRange
| ClassStringDisjunction
| EscapeCharacterSet
| ExpressionCharacterClass
| UnicodePropertyCharacterSet
| UnicodeSetsCharacterClass;
/**

@@ -192,8 +209,31 @@ * The type which defines common properties for all node types.

*/
export interface CharacterClass extends NodeBase {
export type CharacterClass =
| ClassRangesCharacterClass
| UnicodeSetsCharacterClass;
interface BaseCharacterClass extends NodeBase {
type: "CharacterClass";
parent: Alternative | Quantifier;
parent:
| Alternative
| ExpressionCharacterClass
| Quantifier
| UnicodeSetsCharacterClass;
unicodeSets: boolean;
negate: boolean;
elements: CharacterClassElement[];
}
export interface ClassRangesCharacterClass extends BaseCharacterClass {
parent: Alternative | Quantifier;
unicodeSets: false;
elements: ClassRangesCharacterClassElement[];
}
/** UnicodeSetsCharacterClass is the CharacterClass when in Unicode sets mode. So it may contain strings. */
export interface UnicodeSetsCharacterClass extends BaseCharacterClass {
parent:
| Alternative
| ExpressionCharacterClass
| Quantifier
| UnicodeSetsCharacterClass;
unicodeSets: true;
elements: UnicodeSetsCharacterClassElement[];
}
/**

@@ -258,3 +298,8 @@ * The character class.

type: "CharacterSet";
parent: Alternative | CharacterClass | Quantifier;
parent:
| Alternative
| CharacterClass
| ClassIntersection
| ClassSubtraction
| Quantifier;
kind: "digit" | "space" | "word";

@@ -267,6 +312,15 @@ negate: boolean;

*/
export interface UnicodePropertyCharacterSet extends NodeBase {
export type UnicodePropertyCharacterSet =
| CharacterUnicodePropertyCharacterSet
| StringsUnicodePropertyCharacterSet;
interface BaseUnicodePropertyCharacterSet extends NodeBase {
type: "CharacterSet";
parent: Alternative | CharacterClass | Quantifier;
parent:
| Alternative
| CharacterClass
| ClassIntersection
| ClassSubtraction
| Quantifier;
kind: "property";
strings: boolean;
key: string;

@@ -276,3 +330,72 @@ value: string | null;

}
export interface CharacterUnicodePropertyCharacterSet
extends BaseUnicodePropertyCharacterSet {
strings: false;
value: string | null;
negate: boolean;
}
/** StringsUnicodePropertyCharacterSet is Unicode property escape with property of strings. */
export interface StringsUnicodePropertyCharacterSet
extends BaseUnicodePropertyCharacterSet {
strings: true;
value: null;
negate: false;
}
/**
* The expression character class.
* E.g. `[a--b]`, `[a&&b]`,`[^a--b]`, `[^a&&b]`
*/
export interface ExpressionCharacterClass extends NodeBase {
type: "ExpressionCharacterClass";
parent:
| Alternative
| ExpressionCharacterClass
| Quantifier
| UnicodeSetsCharacterClass;
negate: boolean;
expression: ClassIntersection | ClassSubtraction;
}
export type ClassSetOperand =
| Character
| ClassStringDisjunction
| EscapeCharacterSet
| ExpressionCharacterClass
| UnicodePropertyCharacterSet
| UnicodeSetsCharacterClass;
/**
* The character class intersection.
* E.g. `a&&b`
*/
export interface ClassIntersection extends NodeBase {
type: "ClassIntersection";
parent: ClassIntersection | ExpressionCharacterClass;
left: ClassIntersection | ClassSetOperand;
right: ClassSetOperand;
}
/**
* The character class subtraction.
* E.g. `a--b`
*/
export interface ClassSubtraction extends NodeBase {
type: "ClassSubtraction";
parent: ClassSubtraction | ExpressionCharacterClass;
left: ClassSetOperand | ClassSubtraction;
right: ClassSetOperand;
}
/**
* The character class string disjunction.
* E.g. `\q{a|b}`
*/
export interface ClassStringDisjunction extends NodeBase {
type: "ClassStringDisjunction";
parent: ClassIntersection | ClassSubtraction | UnicodeSetsCharacterClass;
alternatives: StringAlternative[];
}
/** StringAlternative is only used for `\q{alt}`({@link ClassStringDisjunction}). */
export interface StringAlternative extends NodeBase {
type: "StringAlternative";
parent: ClassStringDisjunction;
elements: Character[];
}
/**
* The character.

@@ -284,3 +407,10 @@ * This includes escape sequences which mean a character.

type: "Character";
parent: Alternative | CharacterClass | CharacterClassRange | Quantifier;
parent:
| Alternative
| CharacterClass
| CharacterClassRange
| ClassIntersection
| ClassSubtraction
| Quantifier
| StringAlternative;
value: number;

@@ -311,3 +441,5 @@ }

unicode: boolean;
unicodeSets: boolean;
}
export {};
}

@@ -332,3 +464,3 @@

/**
* ECMAScript version. Default is `2023`.
* ECMAScript version. Default is `2024`.
* - `2015` added `u` and `y` flags.

@@ -340,2 +472,3 @@ * - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,

* - `2023` added more valid Unicode Property Escapes.
* - `2024` added `v` flag.
*/

@@ -372,2 +505,21 @@ ecmaVersion?: EcmaVersion;

* @param end The end index in the source code.
* @param flags The flags.
* @returns The AST of the given pattern.
*/
parsePattern(
source: string,
start?: number,
end?: number,
flags?: {
unicode?: boolean;
unicodeSets?: boolean;
}
): Pattern;
/**
* @deprecated Backward compatibility
* Use object `flags` instead of boolean `uFlag`.
*
* @param source The source code to parse.
* @param start The start index in the source code.
* @param end The end index in the source code.
* @param uFlag The flag to set unicode mode.

@@ -397,3 +549,3 @@ * @returns The AST of the given pattern.

/**
* ECMAScript version. Default is `2023`.
* ECMAScript version. Default is `2024`.
* - `2015` added `u` and `y` flags.

@@ -405,2 +557,3 @@ * - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,

* - `2023` added more valid Unicode Property Escapes.
* - `2024` added `v` flag.
*/

@@ -430,2 +583,3 @@ ecmaVersion?: EcmaVersion;

* @param flags.hasIndices `d` flag.
* @param flags.unicodeSets `v` flag.
*/

@@ -443,2 +597,3 @@ onRegExpFlags?: (

hasIndices: boolean;
unicodeSets: boolean;
}

@@ -625,2 +780,3 @@ ) => void;

* @param negate The flag which represents that the character set is negative.
* @param strings If true, the given property is property of strings.
*/

@@ -633,3 +789,4 @@ onUnicodePropertyCharacterSet?: (

value: string | null,
negate: boolean
negate: boolean,
strings: boolean
) => void;

@@ -658,4 +815,9 @@ /**

* @param negate The flag which represents that the character class is negative.
* @param unicodeSets `true` if unicodeSets mode.
*/
onCharacterClassEnter?: (start: number, negate: boolean) => void;
onCharacterClassEnter?: (
start: number,
negate: boolean,
unicodeSets: boolean
) => void;
/**

@@ -685,2 +847,42 @@ * A function that is called when the validator left a character class.

) => void;
/**
* A function that is called when the validator found a class intersection.
* @param start The 0-based index of the first character.
* @param end The next 0-based index of the last character.
*/
onClassIntersection?: (start: number, end: number) => void;
/**
* A function that is called when the validator found a class subtraction.
* @param start The 0-based index of the first character.
* @param end The next 0-based index of the last character.
*/
onClassSubtraction?: (start: number, end: number) => void;
/**
* A function that is called when the validator entered a class string disjunction.
* @param start The 0-based index of the first character.
*/
onClassStringDisjunctionEnter?: (start: number) => void;
/**
* A function that is called when the validator left a class string disjunction.
* @param start The 0-based index of the first character.
* @param end The next 0-based index of the last character.
*/
onClassStringDisjunctionLeave?: (start: number, end: number) => void;
/**
* A function that is called when the validator entered a string alternative.
* @param start The 0-based index of the first character.
* @param index The 0-based index of alternatives in a disjunction.
*/
onStringAlternativeEnter?: (start: number, index: number) => void;
/**
* A function that is called when the validator left a string alternative.
* @param start The 0-based index of the first character.
* @param end The next 0-based index of the last character.
* @param index The 0-based index of alternatives in a disjunction.
*/
onStringAlternativeLeave?: (
start: number,
end: number,
index: number
) => void;
}

@@ -716,2 +918,19 @@ }

* @param end The end index in the source code.
* @param flags The flags.
*/
validatePattern(
source: string,
start?: number,
end?: number,
flags?: {
unicode?: boolean;
unicodeSets?: boolean;
}
): void;
/**
* @deprecated Backward compatibility
* Use object `flags` instead of boolean `uFlag`.
* @param source The source code to validate.
* @param start The start index in the source code.
* @param end The end index in the source code.
* @param uFlag The flag to set unicode mode.

@@ -738,2 +957,6 @@ */

CharacterSet,
ClassIntersection,
ClassStringDisjunction,
ClassSubtraction,
ExpressionCharacterClass,
Flags,

@@ -745,2 +968,3 @@ Group,

RegExpLiteral,
StringAlternative,
} from "@eslint-community/regexpp/ast";

@@ -780,2 +1004,14 @@ /**

onCharacterSetLeave?: (node: CharacterSet) => void;
onClassIntersectionEnter?: (node: ClassIntersection) => void;
onClassIntersectionLeave?: (node: ClassIntersection) => void;
onClassStringDisjunctionEnter?: (node: ClassStringDisjunction) => void;
onClassStringDisjunctionLeave?: (node: ClassStringDisjunction) => void;
onClassSubtractionEnter?: (node: ClassSubtraction) => void;
onClassSubtractionLeave?: (node: ClassSubtraction) => void;
onExpressionCharacterClassEnter?: (
node: ExpressionCharacterClass
) => void;
onExpressionCharacterClassLeave?: (
node: ExpressionCharacterClass
) => void;
onFlagsEnter?: (node: Flags) => void;

@@ -791,2 +1027,4 @@ onFlagsLeave?: (node: Flags) => void;

onRegExpLiteralLeave?: (node: RegExpLiteral) => void;
onStringAlternativeEnter?: (node: StringAlternative) => void;
onStringAlternativeLeave?: (node: StringAlternative) => void;
}

@@ -807,3 +1045,5 @@ }

| 2022
| 2023;
| 2023
| 2024;
export const latestEcmaVersion = 2024;
}
{
"name": "@eslint-community/regexpp",
"version": "4.5.1",
"version": "4.6.0",
"description": "Regular expression parser for ECMAScript.",

@@ -60,2 +60,3 @@ "keywords": [

"update:unicode:props": "ts-node scripts/update-unicode-properties.ts",
"update:test262:extract": "ts-node -T scripts/extract-test262.ts",
"preversion": "npm test && npm run -s build",

@@ -76,2 +77,3 @@ "postversion": "git push && git push --tags",

"eslint": "^8.31.0",
"js-tokens": "^8.0.1",
"jsdom": "^19.0.0",

@@ -84,2 +86,4 @@ "mocha": "^9.2.2",

"rollup-plugin-sourcemaps": "^0.6.3",
"test262": "git+https://github.com/tc39/test262.git",
"test262-stream": "^1.4.0",
"ts-node": "^10.9.1",

@@ -86,0 +90,0 @@ "typescript": "~5.0.2"

14

README.md

@@ -82,3 +82,3 @@ # @eslint-community/regexpp

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

@@ -91,3 +91,3 @@ Parse a regular expression pattern.

- `end?` (`number`) The end index in the source code. Default is `source.length`.
- `uFlag?` (`boolean`) The flag to enable Unicode mode.
- `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode.
- **Return:**

@@ -123,3 +123,3 @@ - The AST of the regular expression pattern.

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

@@ -132,3 +132,3 @@ Validate a regular expression pattern.

- `end?` (`number`) The end index in the source code. Default is `source.length`.
- `uFlag?` (`boolean`) The flag to enable Unicode mode.
- `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode.

@@ -179,4 +179,4 @@ #### validator.validateFlags(source, start, end)

[`AST.Node`]: src/ast.ts#L4
[`RegExpParser.Options`]: src/parser.ts#L539
[`RegExpValidator.Options`]: src/validator.ts#L127
[`RegExpVisitor.Handlers`]: src/visitor.ts#L204
[`RegExpParser.Options`]: src/parser.ts#L743
[`RegExpValidator.Options`]: src/validator.ts#L220
[`RegExpVisitor.Handlers`]: src/visitor.ts#L291

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc