Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: export RegExpVistor at runtime. #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RegExpParser } from "./parser"
import { RegExpValidator } from "./validator"
import { RegExpVisitor } from "./visitor"

export { AST, RegExpParser, RegExpValidator }
export { AST, RegExpParser, RegExpValidator, RegExpVisitor }

/**
* Parse a given regular expression literal then make AST object.
Expand Down
26 changes: 13 additions & 13 deletions src/visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class RegExpVisitor {
}
}

private visitAlternative(node: Alternative): void {
protected visitAlternative(node: Alternative): void {
if (this._handlers.onAlternativeEnter) {
this._handlers.onAlternativeEnter(node)
}
Expand All @@ -88,7 +88,7 @@ export class RegExpVisitor {
this._handlers.onAlternativeLeave(node)
}
}
private visitAssertion(node: Assertion): void {
protected visitAssertion(node: Assertion): void {
if (this._handlers.onAssertionEnter) {
this._handlers.onAssertionEnter(node)
}
Expand All @@ -99,15 +99,15 @@ export class RegExpVisitor {
this._handlers.onAssertionLeave(node)
}
}
private visitBackreference(node: Backreference): void {
protected visitBackreference(node: Backreference): void {
if (this._handlers.onBackreferenceEnter) {
this._handlers.onBackreferenceEnter(node)
}
if (this._handlers.onBackreferenceLeave) {
this._handlers.onBackreferenceLeave(node)
}
}
private visitCapturingGroup(node: CapturingGroup): void {
protected visitCapturingGroup(node: CapturingGroup): void {
if (this._handlers.onCapturingGroupEnter) {
this._handlers.onCapturingGroupEnter(node)
}
Expand All @@ -116,15 +116,15 @@ export class RegExpVisitor {
this._handlers.onCapturingGroupLeave(node)
}
}
private visitCharacter(node: Character): void {
protected visitCharacter(node: Character): void {
if (this._handlers.onCharacterEnter) {
this._handlers.onCharacterEnter(node)
}
if (this._handlers.onCharacterLeave) {
this._handlers.onCharacterLeave(node)
}
}
private visitCharacterClass(node: CharacterClass): void {
protected visitCharacterClass(node: CharacterClass): void {
if (this._handlers.onCharacterClassEnter) {
this._handlers.onCharacterClassEnter(node)
}
Expand All @@ -133,7 +133,7 @@ export class RegExpVisitor {
this._handlers.onCharacterClassLeave(node)
}
}
private visitCharacterClassRange(node: CharacterClassRange): void {
protected visitCharacterClassRange(node: CharacterClassRange): void {
if (this._handlers.onCharacterClassRangeEnter) {
this._handlers.onCharacterClassRangeEnter(node)
}
Expand All @@ -143,23 +143,23 @@ export class RegExpVisitor {
this._handlers.onCharacterClassRangeLeave(node)
}
}
private visitCharacterSet(node: CharacterSet): void {
protected visitCharacterSet(node: CharacterSet): void {
if (this._handlers.onCharacterSetEnter) {
this._handlers.onCharacterSetEnter(node)
}
if (this._handlers.onCharacterSetLeave) {
this._handlers.onCharacterSetLeave(node)
}
}
private visitFlags(node: Flags): void {
protected visitFlags(node: Flags): void {
if (this._handlers.onFlagsEnter) {
this._handlers.onFlagsEnter(node)
}
if (this._handlers.onFlagsLeave) {
this._handlers.onFlagsLeave(node)
}
}
private visitGroup(node: Group): void {
protected visitGroup(node: Group): void {
if (this._handlers.onGroupEnter) {
this._handlers.onGroupEnter(node)
}
Expand All @@ -168,7 +168,7 @@ export class RegExpVisitor {
this._handlers.onGroupLeave(node)
}
}
private visitPattern(node: Pattern): void {
protected visitPattern(node: Pattern): void {
if (this._handlers.onPatternEnter) {
this._handlers.onPatternEnter(node)
}
Expand All @@ -177,7 +177,7 @@ export class RegExpVisitor {
this._handlers.onPatternLeave(node)
}
}
private visitQuantifier(node: Quantifier): void {
protected visitQuantifier(node: Quantifier): void {
if (this._handlers.onQuantifierEnter) {
this._handlers.onQuantifierEnter(node)
}
Expand All @@ -186,7 +186,7 @@ export class RegExpVisitor {
this._handlers.onQuantifierLeave(node)
}
}
private visitRegExpLiteral(node: RegExpLiteral): void {
protected visitRegExpLiteral(node: RegExpLiteral): void {
if (this._handlers.onRegExpLiteralEnter) {
this._handlers.onRegExpLiteralEnter(node)
}
Expand Down