[d24f17c] | 1 | /**
|
---|
| 2 | * Keys for possible error messages used by `unraw`.
|
---|
| 3 | * Note: These do _not_ map to actual error object types. All errors thrown
|
---|
| 4 | * are `SyntaxError`.
|
---|
| 5 | */
|
---|
| 6 | export declare enum ErrorType {
|
---|
| 7 | /**
|
---|
| 8 | * Thrown when a badly formed Unicode escape sequence is found. Possible
|
---|
| 9 | * reasons include the code being too short (`"\u25"`) or having invalid
|
---|
| 10 | * characters (`"\u2$A5"`).
|
---|
| 11 | */
|
---|
| 12 | MalformedUnicode = "MALFORMED_UNICODE",
|
---|
| 13 | /**
|
---|
| 14 | * Thrown when a badly formed hexadecimal escape sequence is found. Possible
|
---|
| 15 | * reasons include the code being too short (`"\x2"`) or having invalid
|
---|
| 16 | * characters (`"\x2$"`).
|
---|
| 17 | */
|
---|
| 18 | MalformedHexadecimal = "MALFORMED_HEXADECIMAL",
|
---|
| 19 | /**
|
---|
| 20 | * Thrown when a Unicode code point escape sequence has too high of a code
|
---|
| 21 | * point. The maximum code point allowed is `\u{10FFFF}`, so `\u{110000}` and
|
---|
| 22 | * higher will throw this error.
|
---|
| 23 | */
|
---|
| 24 | CodePointLimit = "CODE_POINT_LIMIT",
|
---|
| 25 | /**
|
---|
| 26 | * Thrown when an octal escape sequences is encountered and `allowOctals` is
|
---|
| 27 | * `false`. For example, `unraw("\234", false)`.
|
---|
| 28 | */
|
---|
| 29 | OctalDeprecation = "OCTAL_DEPRECATION",
|
---|
| 30 | /**
|
---|
| 31 | * Thrown only when a single backslash is found at the end of a string. For
|
---|
| 32 | * example, `"\\"` or `"test\\x24\\"`.
|
---|
| 33 | */
|
---|
| 34 | EndOfString = "END_OF_STRING"
|
---|
| 35 | }
|
---|
| 36 | /** Map of error message names to the full text of the message. */
|
---|
| 37 | export declare const errorMessages: Readonly<Map<ErrorType, string>>;
|
---|