mirrors-regulex-master
java 

所属分类:Java编程
开发工具:Java
文件大小:270KB
下载次数:0
上传日期:2021-02-28 18:28:11
上 传 者entcfes
说明:  Regulex 使用图形可视化效果展示 JavaScript 正则表达式
(Regulex uses graphical visualization to show JavaScript regular expressions)

文件列表:
regulex (0, 2019-08-15)
regulex\LICENSE (1069, 2019-08-15)
regulex\docs (0, 2019-08-15)
regulex\docs\index.html (148543, 2019-08-15)
regulex\package-lock.json (527993, 2019-08-15)
regulex\package.json (2437, 2019-08-15)
regulex\prettier.config.js (164, 2019-08-15)
regulex\src (0, 2019-08-15)
regulex\src\AST.ts (12083, 2019-08-15)
regulex\src\Kit.ts (27141, 2019-08-15)
regulex\src\Parsec.ts (35488, 2019-08-15)
regulex\src\Unicode.ts (112569, 2019-08-15)
regulex\src\UnicodeProperty.ts (7524, 2019-08-15)
regulex\src\grammar (0, 2019-08-15)
regulex\src\grammar\Base.ts (21140, 2019-08-15)
regulex\src\grammar\JSRE.ts (5692, 2019-08-15)
regulex\src\grammar\index.ts (47, 2019-08-15)
regulex\src\index.ts (172, 2019-08-15)
regulex\src\tools (0, 2019-08-15)
regulex\src\tools\buildUnicode.ts (5771, 2019-08-15)
regulex\src\tools\fetchUnicodeProperty.js (1053, 2019-08-15)
regulex\src\web (0, 2019-08-15)
regulex\src\web\EventEmitter.ts (3163, 2019-08-15)
regulex\src\web\HTML.ts (3377, 2019-08-15)
regulex\src\web\RegexEditor.ts (4384, 2019-08-15)
regulex\src\web\TextEditor.ts (4693, 2019-08-15)
regulex\src\web\index.html (3756, 2019-08-15)
regulex\src\web\main.ts (529, 2019-08-15)
regulex\src\web\style (0, 2019-08-15)
regulex\src\web\style\RegexEditor.local.css (959, 2019-08-15)
regulex\src\web\style\RegexEditor.local.css.d.ts (272, 2019-08-15)
regulex\src\web\style\main.css (3219, 2019-08-15)
regulex\src\web\style\main.css.d.ts (497, 2019-08-15)
regulex\test (0, 2019-08-15)
regulex\test\Demo.ts (421, 2019-08-15)
regulex\test\KitSpec.ts (8812, 2019-08-15)
regulex\test\ParsecSpec.ts (8723, 2019-08-15)
regulex\test\benchmark (0, 2019-08-15)
... ...

# Regulex [Regulex](https://jex.im/regulex/) is a JavaScript Regular Expression Parser & Visualizer. Try it now: **This project is under reconstruction!** ### Features - Written in pure JavaScript. No backend required. - You can embed the graph on you own site through HTML iframe element. - Detailed error message. In most cases it can point out the precise syntax error position. - No support for octal escape. Yes it is a feature! ECMAScript strict mode doesn't allow octal escape in string, but many browsers still allow octal escape in regex. In regulex, DecimalEscape will always be treated as back reference. If the back reference is invalid, e.g. `/\1/`, `/(\1)/`, `/(a)\2/`, or DecimalEscape appears in charsetbecause in this case it can't be explained as back reference, e.g. `/(ab)[\1]/`, Regulex will always throw an error. ### Install for Node.js ``` npm install regulex ``` ### Local Build for Browser This command will generate bundle `dist/regulex.js` for browser side: ```bash git checkout legacy npm install -g requirejs r.js -o build-config.js ``` ### API #### Parse to AST ```javascript var parse = require("regulex").parse; var re = /var\s+([a-zA-Z_]\w*);/ ; console.log(parse(re.source)); ``` #### Visualize ```javascript var parse = require("regulex").parse; var visualize = require("regulex").visualize; var Raphael = require('regulex').Raphael; var re = /var\s+([a-zA-Z_]\w*);/; var paper = Raphael("yourSvgContainerId", 0, 0); try { visualize(parse(re.source), getRegexFlags(re), paper); } catch(e) { if (e instanceof parse.RegexSyntaxError) { logError(re, e); } else { throw e; } } function logError(re, err) { var msg = ["Error:" + err.message, ""]; if (typeof err.lastIndex === "number") { msg.push(re); msg.push(new Array(err.lastIndex).join("-") + "^"); } console.log(msg.join("\n")); } function getRegexFlags(re) { var flags = ""; flags += re.ignoreCase ? "i" : ""; flags += re.global ? "g" : ""; flags += re.multiline ? "m" : ""; return flags; } ```

近期下载者

相关文件


收藏者