Comparing version 0.3.2 to 0.4.0
import { types } from './types'; | ||
export * from './tokenizer'; | ||
export * from './reconstruct'; | ||
import { tokenizer } from './tokenizer'; | ||
@@ -4,0 +5,0 @@ export * from './types'; |
@@ -17,3 +17,5 @@ "use strict"; | ||
__exportStar(require("./tokenizer"), exports); | ||
__exportStar(require("./reconstruct"), exports); | ||
const tokenizer_1 = require("./tokenizer"); | ||
const reconstruct_1 = require("./reconstruct"); | ||
__exportStar(require("./types"), exports); | ||
@@ -23,2 +25,3 @@ exports.default = tokenizer_1.tokenizer; | ||
module.exports.types = types_1.types; | ||
module.exports.reconstruct = reconstruct_1.reconstruct; | ||
//# sourceMappingURL=index.js.map |
export * from './tokens'; | ||
export * from './types'; | ||
export * from './set-lookup'; |
@@ -15,2 +15,3 @@ "use strict"; | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./set-lookup"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"repository": { | ||
@@ -14,0 +14,0 @@ "type": "git", |
@@ -32,2 +32,23 @@ # Regular Expression Tokenizer | ||
# Reconstructing Regular Expressions from Tokens | ||
The `reconstruct` function accepts an *any* token and returns, as a string, the *component* of the regular expression that is associated with that token. | ||
```ts | ||
import { reconstruct, types } from 'ret' | ||
const tokens = ret(/foo|bar/.source) | ||
const setToken = { | ||
"type": types.SET, | ||
"set": [ | ||
{ "type": types.CHAR, "value": 97 }, | ||
{ "type": types.CHAR, "value": 98 }, | ||
{ "type": types.CHAR, "value": 99 } | ||
], | ||
"not": true | ||
} | ||
reconstruct(tokens) // 'foo|bar' | ||
reconstruct({ "type": types.CHAR, "value": 102 }) // 'f' | ||
reconstruct(setToken) // '^abc' | ||
``` | ||
# Token Types | ||
@@ -34,0 +55,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
61317
36
793
540
0