-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea35d60
commit 7252a7e
Showing
28 changed files
with
265 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,26 @@ | ||
import type { EncodeResult } from '../encoder/types'; | ||
import type { RegexConstruct } from '../types'; | ||
import type { EncodedRegex } from '../types'; | ||
|
||
export interface Anchor extends RegexConstruct { | ||
type: 'anchor'; | ||
symbol: string; | ||
} | ||
|
||
export const startOfString: Anchor = { | ||
type: 'anchor', | ||
symbol: '^', | ||
encode: encodeAnchor, | ||
export const startOfString: EncodedRegex = { | ||
precedence: 'atom', | ||
pattern: '^', | ||
}; | ||
|
||
export const endOfString: Anchor = { | ||
type: 'anchor', | ||
symbol: '$', | ||
encode: encodeAnchor, | ||
export const endOfString: EncodedRegex = { | ||
precedence: 'atom', | ||
pattern: '$', | ||
}; | ||
|
||
export const wordBoundary: Anchor = { | ||
type: 'anchor', | ||
symbol: '\\b', | ||
encode: encodeAnchor, | ||
export const wordBoundary: EncodedRegex = { | ||
precedence: 'atom', | ||
pattern: '\\b', | ||
}; | ||
|
||
export const nonWordBoundary: Anchor = { | ||
type: 'anchor', | ||
symbol: '\\B', | ||
encode: encodeAnchor, | ||
export const nonWordBoundary: EncodedRegex = { | ||
precedence: 'atom', | ||
pattern: '\\B', | ||
}; | ||
|
||
/** | ||
* @deprecated Renamed to `nonWordBoundary`. | ||
*/ | ||
export const notWordBoundary = nonWordBoundary; | ||
|
||
function encodeAnchor(this: Anchor): EncodeResult { | ||
return { | ||
precedence: 'sequence', | ||
pattern: this.symbol, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.