15 lines
9.8 KiB
HTML
15 lines
9.8 KiB
HTML
<!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."><title>regex_syntax::hir - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="regex_syntax" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.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]--><rustdoc-topbar><h2><a href="#">Module hir</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../regex_syntax/index.html">regex_<wbr>syntax</a><span class="version">0.8.10</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module hir</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate regex_<wbr>syntax</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">regex_syntax</a></div><h1>Module <span>hir</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/regex_syntax/hir/mod.rs.html#1-3873">Source</a> </span></div><details class="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="struct regex_syntax::hir::Hir"><code>Hir</code></a> type, and it principally constructed via
|
||
<a href="translate/index.html" title="mod regex_syntax::hir::translate">translation</a> from an <a href="../ast/enum.Ast.html" title="enum regex_syntax::ast::Ast"><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="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="literal/index.html" title="mod regex_syntax::hir::literal">literal</a></dt><dd>Provides literal extraction from <code>Hir</code> expressions.</dd><dt><a class="mod" href="print/index.html" title="mod regex_syntax::hir::print">print</a></dt><dd>This module provides a regular expression printer for <code>Hir</code>.</dd><dt><a class="mod" href="translate/index.html" title="mod regex_syntax::hir::translate">translate</a></dt><dd>Defines a translator that converts an <code>Ast</code> to an <code>Hir</code>.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Capture.html" title="struct regex_syntax::hir::Capture">Capture</a></dt><dd>The high-level intermediate representation for a capturing group.</dd><dt><a class="struct" href="struct.CaseFoldError.html" title="struct regex_syntax::hir::CaseFoldError">Case<wbr>Fold<wbr>Error</a></dt><dd>An error that occurs when Unicode-aware simple case folding fails.</dd><dt><a class="struct" href="struct.ClassBytes.html" title="struct regex_syntax::hir::ClassBytes">Class<wbr>Bytes</a></dt><dd>A set of characters represented by arbitrary bytes.</dd><dt><a class="struct" href="struct.ClassBytesIter.html" title="struct regex_syntax::hir::ClassBytesIter">Class<wbr>Bytes<wbr>Iter</a></dt><dd>An iterator over all ranges in a byte character class.</dd><dt><a class="struct" href="struct.ClassBytesRange.html" title="struct regex_syntax::hir::ClassBytesRange">Class<wbr>Bytes<wbr>Range</a></dt><dd>A single range of characters represented by arbitrary bytes.</dd><dt><a class="struct" href="struct.ClassUnicode.html" title="struct regex_syntax::hir::ClassUnicode">Class<wbr>Unicode</a></dt><dd>A set of characters represented by Unicode scalar values.</dd><dt><a class="struct" href="struct.ClassUnicodeIter.html" title="struct regex_syntax::hir::ClassUnicodeIter">Class<wbr>Unicode<wbr>Iter</a></dt><dd>An iterator over all ranges in a Unicode character class.</dd><dt><a class="struct" href="struct.ClassUnicodeRange.html" title="struct regex_syntax::hir::ClassUnicodeRange">Class<wbr>Unicode<wbr>Range</a></dt><dd>A single range of characters represented by Unicode scalar values.</dd><dt><a class="struct" href="struct.Error.html" title="struct regex_syntax::hir::Error">Error</a></dt><dd>An error that can occur while translating an <code>Ast</code> to a <code>Hir</code>.</dd><dt><a class="struct" href="struct.Hir.html" title="struct regex_syntax::hir::Hir">Hir</a></dt><dd>A high-level intermediate representation (HIR) for a regular expression.</dd><dt><a class="struct" href="struct.Literal.html" title="struct regex_syntax::hir::Literal">Literal</a></dt><dd>The high-level intermediate representation of a literal.</dd><dt><a class="struct" href="struct.LookSet.html" title="struct regex_syntax::hir::LookSet">LookSet</a></dt><dd>A set of look-around assertions.</dd><dt><a class="struct" href="struct.LookSetIter.html" title="struct regex_syntax::hir::LookSetIter">Look<wbr>SetIter</a></dt><dd>An iterator over all look-around assertions in a <a href="struct.LookSet.html" title="struct regex_syntax::hir::LookSet"><code>LookSet</code></a>.</dd><dt><a class="struct" href="struct.Properties.html" title="struct regex_syntax::hir::Properties">Properties</a></dt><dd>A type that collects various properties of an HIR value.</dd><dt><a class="struct" href="struct.Repetition.html" title="struct regex_syntax::hir::Repetition">Repetition</a></dt><dd>The high-level intermediate representation of a repetition operator.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Class.html" title="enum regex_syntax::hir::Class">Class</a></dt><dd>The high-level intermediate representation of a character class.</dd><dt><a class="enum" href="enum.Dot.html" title="enum regex_syntax::hir::Dot">Dot</a></dt><dd>A type describing the different flavors of <code>.</code>.</dd><dt><a class="enum" href="enum.ErrorKind.html" title="enum regex_syntax::hir::ErrorKind">Error<wbr>Kind</a></dt><dd>The type of an error that occurred while building an <code>Hir</code>.</dd><dt><a class="enum" href="enum.HirKind.html" title="enum regex_syntax::hir::HirKind">HirKind</a></dt><dd>The underlying kind of an arbitrary <a href="struct.Hir.html" title="struct regex_syntax::hir::Hir"><code>Hir</code></a> expression.</dd><dt><a class="enum" href="enum.Look.html" title="enum regex_syntax::hir::Look">Look</a></dt><dd>The high-level intermediate representation for a look-around assertion.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Visitor.html" title="trait regex_syntax::hir::Visitor">Visitor</a></dt><dd>A trait for visiting the high-level IR (HIR) in depth first order.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.visit.html" title="fn regex_syntax::hir::visit">visit</a></dt><dd>Executes an implementation of <code>Visitor</code> in constant stack space.</dd></dl></section></div></main></body></html> |