Skip to content

Commit

Permalink
Add negated example for escape sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
hlysine committed Aug 21, 2023
1 parent 440912a commit bbb3c79
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,19 @@ export const exactly = r.exactly;
* ```js
* /[\123]/
* ```
*
* @example Negated token
*
* ```js
* not.octal`123`
* not(octal('123'))
* ```
*
* RegExp equivalent:
*
* ```js
* /[^\123]/
* ```
*/
export const octal = r.octal;

Expand All @@ -1228,6 +1241,19 @@ export const octal = r.octal;
* ```js
* /\x3f/
* ```
*
* @example Negated token
*
* ```js
* not.hex`3f`
* not(hex('3f'))
* ```
*
* RegExp equivalent:
*
* ```js
* /[^\x3f]/
* ```
*/
export const hex = r.hex;

Expand All @@ -1251,6 +1277,19 @@ export const hex = r.hex;
* ```js
* /\u3ef1/
* ```
*
* @example Negated token
*
* ```js
* not.unicode`3ef1`
* not(unicode('3ef1'))
* ```
*
* RegExp equivalent:
*
* ```js
* /[^\u3ef1]/
* ```
*/
export const unicode = r.unicode;

Expand Down Expand Up @@ -1279,6 +1318,22 @@ export const unicode = r.unicode;
* /\cj/
* /\cJ/
* ```
*
* @example Negated token
*
* ```js
* not.control`j`
* not(control('j'))
* not.control`J`
* not(control('J'))
* ```
*
* RegExp equivalent:
*
* ```js
* /[^\cj]/
* /[^\cJ]/
* ```
*/
export const control = r.control;

Expand Down
56 changes: 56 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ export interface RegExpToken {
* @deprecated Octal escape sequences (\\ followed by one, two, or three octal digits) are deprecated in string and regular expression literals.
*
* ----------------------
*
* Match a character with the given code point in base-8.
*
* Notes:
Expand All @@ -763,6 +764,19 @@ export interface RegExpToken {
* ```js
* /[\123]/
* ```
*
* @example Negated token
*
* ```js
* not.octal`123`
* not(octal('123'))
* ```
*
* RegExp equivalent:
*
* ```js
* /[^\123]/
* ```
*/
get octal(): LiteralFunction & IncompleteToken;

Expand All @@ -786,6 +800,19 @@ export interface RegExpToken {
* ```js
* /\x3f/
* ```
*
* @example Negated token
*
* ```js
* not.hex`3f`
* not(hex('3f'))
* ```
*
* RegExp equivalent:
*
* ```js
* /[^\x3f]/
* ```
*/
get hex(): LiteralFunction & IncompleteToken;

Expand All @@ -809,6 +836,19 @@ export interface RegExpToken {
* ```js
* /\u3ef1/
* ```
*
* @example Negated token
*
* ```js
* not.unicode`3ef1`
* not(unicode('3ef1'))
* ```
*
* RegExp equivalent:
*
* ```js
* /[^\u3ef1]/
* ```
*/
get unicode(): LiteralFunction & IncompleteToken;

Expand Down Expand Up @@ -837,6 +877,22 @@ export interface RegExpToken {
* /\cj/
* /\cJ/
* ```
*
* @example Negated token
*
* ```js
* not.control`j`
* not.control('j')
* not.control`J`
* not.control('J')
* ```
*
* RegExp equivalent:
*
* ```js
* /[^\cj]/
* /[^\cJ]/
* ```
*/
get control(): ControlFunction & IncompleteToken;

Expand Down

0 comments on commit bbb3c79

Please sign in to comment.