blob: 57bc73f37e35377627444de26e8f1cc421b66d67 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Defines a high-level intermediate (HIR) representation for regular expressions."><meta name="keywords" content="rust, rustlang, rust-lang, hir"><title>regex_syntax::hir - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../../regex_syntax/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../regex_syntax/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Module hir</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../index.html">regex_syntax</a>::<wbr><a class="mod" href="#">hir</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/regex_syntax/hir/mod.rs.html#1-3739">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Defines a high-level intermediate (HIR) representation for regular expressions.</p>
<p>The HIR is represented by the <a href="struct.Hir.html" title="Hir"><code>Hir</code></a> type, and it principally constructed via
<a href="translate/index.html">translation</a> from an <a href="../ast/enum.Ast.html"><code>Ast</code></a>. Alternatively, users
may use the smart constructors defined on <code>Hir</code> to build their own by hand. The
smart constructors simultaneously simplify and “optimize” the HIR, and are also
the same routines used by translation.</p>
<p>Most regex engines only have an HIR like this, and usually construct it
directly from the concrete syntax. This crate however first parses the
concrete syntax into an <code>Ast</code>, and only then creates the HIR from the <code>Ast</code>,
as mentioned above. It’s done this way to facilitate better error reporting,
and to have a structured representation of a regex that faithfully represents
its concrete syntax. Namely, while an <code>Hir</code> value can be converted back to an
equivalent regex pattern string, it is unlikely to look like the original due
to its simplified structure.</p>
</div></details><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="literal/index.html" title="regex_syntax::hir::literal mod">literal</a></div><div class="item-right docblock-short">Provides literal extraction from <code>Hir</code> expressions.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="print/index.html" title="regex_syntax::hir::print mod">print</a></div><div class="item-right docblock-short">This module provides a regular expression printer for <code>Hir</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="translate/index.html" title="regex_syntax::hir::translate mod">translate</a></div><div class="item-right docblock-short">Defines a translator that converts an <code>Ast</code> to an <code>Hir</code>.</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Capture.html" title="regex_syntax::hir::Capture struct">Capture</a></div><div class="item-right docblock-short">The high-level intermediate representation for a capturing group.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.CaseFoldError.html" title="regex_syntax::hir::CaseFoldError struct">CaseFoldError</a></div><div class="item-right docblock-short">An error that occurs when Unicode-aware simple case folding fails.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ClassBytes.html" title="regex_syntax::hir::ClassBytes struct">ClassBytes</a></div><div class="item-right docblock-short">A set of characters represented by arbitrary bytes (where one byte
corresponds to one character).</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ClassBytesIter.html" title="regex_syntax::hir::ClassBytesIter struct">ClassBytesIter</a></div><div class="item-right docblock-short">An iterator over all ranges in a byte character class.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ClassBytesRange.html" title="regex_syntax::hir::ClassBytesRange struct">ClassBytesRange</a></div><div class="item-right docblock-short">A single range of characters represented by arbitrary bytes.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ClassUnicode.html" title="regex_syntax::hir::ClassUnicode struct">ClassUnicode</a></div><div class="item-right docblock-short">A set of characters represented by Unicode scalar values.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ClassUnicodeIter.html" title="regex_syntax::hir::ClassUnicodeIter struct">ClassUnicodeIter</a></div><div class="item-right docblock-short">An iterator over all ranges in a Unicode character class.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ClassUnicodeRange.html" title="regex_syntax::hir::ClassUnicodeRange struct">ClassUnicodeRange</a></div><div class="item-right docblock-short">A single range of characters represented by Unicode scalar values.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Error.html" title="regex_syntax::hir::Error struct">Error</a></div><div class="item-right docblock-short">An error that can occur while translating an <code>Ast</code> to a <code>Hir</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Hir.html" title="regex_syntax::hir::Hir struct">Hir</a></div><div class="item-right docblock-short">A high-level intermediate representation (HIR) for a regular expression.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Literal.html" title="regex_syntax::hir::Literal struct">Literal</a></div><div class="item-right docblock-short">The high-level intermediate representation of a literal.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.LookSet.html" title="regex_syntax::hir::LookSet struct">LookSet</a></div><div class="item-right docblock-short">A set of look-around assertions.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.LookSetIter.html" title="regex_syntax::hir::LookSetIter struct">LookSetIter</a></div><div class="item-right docblock-short">An iterator over all look-around assertions in a <a href="struct.LookSet.html" title="LookSet"><code>LookSet</code></a>.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Properties.html" title="regex_syntax::hir::Properties struct">Properties</a></div><div class="item-right docblock-short">A type that collects various properties of an HIR value.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Repetition.html" title="regex_syntax::hir::Repetition struct">Repetition</a></div><div class="item-right docblock-short">The high-level intermediate representation of a repetition operator.</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Class.html" title="regex_syntax::hir::Class enum">Class</a></div><div class="item-right docblock-short">The high-level intermediate representation of a character class.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Dot.html" title="regex_syntax::hir::Dot enum">Dot</a></div><div class="item-right docblock-short">A type describing the different flavors of <code>.</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.ErrorKind.html" title="regex_syntax::hir::ErrorKind enum">ErrorKind</a></div><div class="item-right docblock-short">The type of an error that occurred while building an <code>Hir</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.HirKind.html" title="regex_syntax::hir::HirKind enum">HirKind</a></div><div class="item-right docblock-short">The underlying kind of an arbitrary <a href="struct.Hir.html" title="Hir"><code>Hir</code></a> expression.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Look.html" title="regex_syntax::hir::Look enum">Look</a></div><div class="item-right docblock-short">The high-level intermediate representation for a look-around assertion.</div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Visitor.html" title="regex_syntax::hir::Visitor trait">Visitor</a></div><div class="item-right docblock-short">A trait for visiting the high-level IR (HIR) in depth first order.</div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.visit.html" title="regex_syntax::hir::visit fn">visit</a></div><div class="item-right docblock-short">Executes an implementation of <code>Visitor</code> in constant stack space.</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="regex_syntax" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>