HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1991108/root/usr/share/doc/node-regexpp/
Upload File :
Current File : //proc/1991108/root/usr/share/doc/node-regexpp/README.html
<h1>regexpp</h1>
<p>A regular expression parser for ECMAScript.</p>
<h2>💿 Installation</h2>
<pre><code class="language-bash">$ npm install regexpp
</code></pre>
<ul>
<li>require Node.js 8 or newer.</li>
</ul>
<h2>📖 Usage</h2>
<pre><code class="language-ts">import {
    AST,
    RegExpParser,
    RegExpValidator,
    RegExpVisitor,
    parseRegExpLiteral,
    validateRegExpLiteral,
    visitRegExpAST
} from &quot;regexpp&quot;
</code></pre>
<h3>parseRegExpLiteral(source, options?)</h3>
<p>Parse a given regular expression literal then make AST object.</p>
<p>This is equivalent to <code>new RegExpParser(options).parseLiteral(source)</code>.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>source</code> (<code>string | RegExp</code>) The source code to parse.</li>
<li><code>options?</code> (<a href="src/parser.ts#L539"><code>RegExpParser.Options</code></a>) The options to parse.</li>
</ul>
</li>
<li><strong>Return:</strong>
<ul>
<li>The AST of the regular expression.</li>
</ul>
</li>
</ul>
<h3>validateRegExpLiteral(source, options?)</h3>
<p>Validate a given regular expression literal.</p>
<p>This is equivalent to <code>new RegExpValidator(options).validateLiteral(source)</code>.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>source</code> (<code>string</code>) The source code to validate.</li>
<li><code>options?</code> (<a href="src/validator.ts#L127"><code>RegExpValidator.Options</code></a>) The options to validate.</li>
</ul>
</li>
</ul>
<h3>visitRegExpAST(ast, handlers)</h3>
<p>Visit each node of a given AST.</p>
<p>This is equivalent to <code>new RegExpVisitor(handlers).visit(ast)</code>.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>ast</code> (<a href="src/ast.ts#L4"><code>AST.Node</code></a>) The AST to visit.</li>
<li><code>handlers</code> (<a href="src/visitor.ts#L204"><code>RegExpVisitor.Handlers</code></a>) The callbacks.</li>
</ul>
</li>
</ul>
<h3>RegExpParser</h3>
<h4>new RegExpParser(options?)</h4>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>options?</code> (<a href="src/parser.ts#L539"><code>RegExpParser.Options</code></a>) The options to parse.</li>
</ul>
</li>
</ul>
<h4>parser.parseLiteral(source, start?, end?)</h4>
<p>Parse a regular expression literal.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>source</code> (<code>string</code>) The source code to parse. E.g. <code>&quot;/abc/g&quot;</code>.</li>
<li><code>start?</code> (<code>number</code>) The start index in the source code. Default is <code>0</code>.</li>
<li><code>end?</code> (<code>number</code>) The end index in the source code. Default is <code>source.length</code>.</li>
</ul>
</li>
<li><strong>Return:</strong>
<ul>
<li>The AST of the regular expression.</li>
</ul>
</li>
</ul>
<h4>parser.parsePattern(source, start?, end?, uFlag?)</h4>
<p>Parse a regular expression pattern.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>source</code> (<code>string</code>) The source code to parse. E.g. <code>&quot;abc&quot;</code>.</li>
<li><code>start?</code> (<code>number</code>) The start index in the source code. Default is <code>0</code>.</li>
<li><code>end?</code> (<code>number</code>) The end index in the source code. Default is <code>source.length</code>.</li>
<li><code>uFlag?</code> (<code>boolean</code>) The flag to enable Unicode mode.</li>
</ul>
</li>
<li><strong>Return:</strong>
<ul>
<li>The AST of the regular expression pattern.</li>
</ul>
</li>
</ul>
<h4>parser.parseFlags(source, start?, end?)</h4>
<p>Parse a regular expression flags.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>source</code> (<code>string</code>) The source code to parse. E.g. <code>&quot;gim&quot;</code>.</li>
<li><code>start?</code> (<code>number</code>) The start index in the source code. Default is <code>0</code>.</li>
<li><code>end?</code> (<code>number</code>) The end index in the source code. Default is <code>source.length</code>.</li>
</ul>
</li>
<li><strong>Return:</strong>
<ul>
<li>The AST of the regular expression flags.</li>
</ul>
</li>
</ul>
<h3>RegExpValidator</h3>
<h4>new RegExpValidator(options)</h4>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>options</code> (<a href="src/validator.ts#L127"><code>RegExpValidator.Options</code></a>) The options to validate.</li>
</ul>
</li>
</ul>
<h4>validator.validateLiteral(source, start, end)</h4>
<p>Validate a regular expression literal.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>source</code> (<code>string</code>) The source code to validate.</li>
<li><code>start?</code> (<code>number</code>) The start index in the source code. Default is <code>0</code>.</li>
<li><code>end?</code> (<code>number</code>) The end index in the source code. Default is <code>source.length</code>.</li>
</ul>
</li>
</ul>
<h4>validator.validatePattern(source, start, end, uFlag)</h4>
<p>Validate a regular expression pattern.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>source</code> (<code>string</code>) The source code to validate.</li>
<li><code>start?</code> (<code>number</code>) The start index in the source code. Default is <code>0</code>.</li>
<li><code>end?</code> (<code>number</code>) The end index in the source code. Default is <code>source.length</code>.</li>
<li><code>uFlag?</code> (<code>boolean</code>) The flag to enable Unicode mode.</li>
</ul>
</li>
</ul>
<h4>validator.validateFlags(source, start, end)</h4>
<p>Validate a regular expression flags.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>source</code> (<code>string</code>) The source code to validate.</li>
<li><code>start?</code> (<code>number</code>) The start index in the source code. Default is <code>0</code>.</li>
<li><code>end?</code> (<code>number</code>) The end index in the source code. Default is <code>source.length</code>.</li>
</ul>
</li>
</ul>
<h3>RegExpVisitor</h3>
<h4>new RegExpVisitor(handlers)</h4>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>handlers</code> (<a href="src/visitor.ts#L204"><code>RegExpVisitor.Handlers</code></a>) The callbacks.</li>
</ul>
</li>
</ul>
<h4>visitor.visit(ast)</h4>
<p>Validate a regular expression literal.</p>
<ul>
<li><strong>Parameters:</strong>
<ul>
<li><code>ast</code> (<a href="src/ast.ts#L4"><code>AST.Node</code></a>) The AST to visit.</li>
</ul>
</li>
</ul>
<h2>📰 Changelog</h2>
<ul>
<li><a href="https://github.com/mysticatea/regexpp/releases">GitHub Releases</a></li>
</ul>
<h2>🍻 Contributing</h2>
<p>Welcome contributing!</p>
<p>Please use GitHub's Issues/PRs.</p>
<h3>Development Tools</h3>
<ul>
<li><code>npm test</code> runs tests and measures coverage.</li>
<li><code>npm run build</code> compiles TypeScript source code to <code>index.js</code>, <code>index.js.map</code>, and <code>index.d.ts</code>.</li>
<li><code>npm run clean</code> removes the temporary files which are created by <code>npm test</code> and <code>npm run build</code>.</li>
<li><code>npm run lint</code> runs ESLint.</li>
<li><code>npm run update:test</code> updates test fixtures.</li>
<li><code>npm run update:ids</code> updates <code>src/unicode/ids.ts</code>.</li>
<li><code>npm run watch</code> runs tests with <code>--watch</code> option.</li>
</ul>