Skip to content

Commit

Permalink
feat: add support v flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Apr 27, 2023
1 parent 8ff7b53 commit 9dcfdfe
Show file tree
Hide file tree
Showing 37 changed files with 11,113 additions and 935 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ Parse a regular expression literal.
- **Return:**
- The AST of the regular expression.

#### parser.parsePattern(source, start?, end?, uFlag?)
#### 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`.
- `uFlag?` (`boolean`) The flag to enable Unicode mode.
- `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode.
- **Return:**
- The AST of the regular expression pattern.

Expand Down Expand Up @@ -118,15 +118,15 @@ Validate a regular expression literal.
- `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, uFlag)
#### 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`.
- `uFlag?` (`boolean`) The flag to enable Unicode mode.
- `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode.

#### validator.validateFlags(source, start, end)

Expand Down Expand Up @@ -172,6 +172,6 @@ Please use GitHub's Issues/PRs.
- `npm run watch` runs tests with `--watch` option.

[`AST.Node`]: src/ast.ts#L4
[`RegExpParser.Options`]: src/parser.ts#L539
[`RegExpValidator.Options`]: src/validator.ts#L127
[`RegExpParser.Options`]: src/parser.ts#L711
[`RegExpValidator.Options`]: src/validator.ts#L219
[`RegExpVisitor.Handlers`]: src/visitor.ts#L204
8 changes: 8 additions & 0 deletions scripts/update-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ for (const filename of Object.keys(Visitor.fixturesData)) {
onCharacterClassEnter: enter,
onCharacterClassRangeEnter: enter,
onCharacterSetEnter: enter,
onClassIntersectionEnter: enter,
onClassStringDisjunctionEnter: enter,
onClassSubtractionEnter: enter,
onExpressionCharacterClassEnter: enter,
onFlagsEnter: enter,
onGroupEnter: enter,
onPatternEnter: enter,
Expand All @@ -60,6 +64,10 @@ for (const filename of Object.keys(Visitor.fixturesData)) {
onCharacterClassLeave: leave,
onCharacterClassRangeLeave: leave,
onCharacterSetLeave: leave,
onClassIntersectionLeave: leave,
onClassStringDisjunctionLeave: leave,
onClassSubtractionLeave: leave,
onExpressionCharacterClassLeave: leave,
onFlagsLeave: leave,
onGroupLeave: leave,
onPatternLeave: leave,
Expand Down
Loading

0 comments on commit 9dcfdfe

Please sign in to comment.