-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 333734c
Showing
221 changed files
with
105,781 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/** | ||
* Convert between Uint8Array and Base64 strings | ||
* Allows for any encoded JS string to be converted (as opposed to atob()/btoa() which only supports latin1) | ||
* | ||
* Original implementation by madmurphy on MDN | ||
* @see https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_1_–_JavaScript%27s_UTF-16_%3E_base64 | ||
*/ | ||
|
||
function b64ToUint6(nChr) { | ||
return nChr > 64 && nChr < 91 | ||
? nChr - 65 | ||
: nChr > 96 && nChr < 123 | ||
? nChr - 71 | ||
: nChr > 47 && nChr < 58 | ||
? nChr + 4 | ||
: nChr === 43 | ||
? 62 | ||
: nChr === 47 | ||
? 63 | ||
: 0 | ||
} | ||
|
||
export function decodeToArray(base64string, blockSize) { | ||
var sB64Enc = base64string.replace(/[^A-Za-z0-9\+\/]/g, ''), | ||
nInLen = sB64Enc.length, | ||
nOutLen = blockSize | ||
? Math.ceil(((nInLen * 3 + 1) >>> 2) / blockSize) * blockSize | ||
: (nInLen * 3 + 1) >>> 2, | ||
aBytes = new Uint8Array(nOutLen) | ||
|
||
for ( | ||
var nMod3, nMod4, nUint24 = 0, nOutIdx = 0, nInIdx = 0; | ||
nInIdx < nInLen; | ||
nInIdx++ | ||
) { | ||
nMod4 = nInIdx & 3 | ||
nUint24 |= b64ToUint6(sB64Enc.charCodeAt(nInIdx)) << (18 - 6 * nMod4) | ||
if (nMod4 === 3 || nInLen - nInIdx === 1) { | ||
for (nMod3 = 0; nMod3 < 3 && nOutIdx < nOutLen; nMod3++, nOutIdx++) { | ||
aBytes[nOutIdx] = (nUint24 >>> ((16 >>> nMod3) & 24)) & 255 | ||
} | ||
nUint24 = 0 | ||
} | ||
} | ||
|
||
return aBytes | ||
} | ||
|
||
function uint6ToB64(nUint6) { | ||
return nUint6 < 26 | ||
? nUint6 + 65 | ||
: nUint6 < 52 | ||
? nUint6 + 71 | ||
: nUint6 < 62 | ||
? nUint6 - 4 | ||
: nUint6 === 62 | ||
? 43 | ||
: nUint6 === 63 | ||
? 47 | ||
: 65 | ||
} | ||
|
||
export function encodeFromArray(bytes) { | ||
var eqLen = (3 - (bytes.length % 3)) % 3, | ||
sB64Enc = '' | ||
|
||
for ( | ||
var nMod3, nLen = bytes.length, nUint24 = 0, nIdx = 0; | ||
nIdx < nLen; | ||
nIdx++ | ||
) { | ||
nMod3 = nIdx % 3 | ||
/* Uncomment the following line in order to split the output in lines 76-character long: */ | ||
/* | ||
if (nIdx > 0 && (nIdx * 4 / 3) % 76 === 0) { sB64Enc += "\r\n"; } | ||
*/ | ||
nUint24 |= bytes[nIdx] << ((16 >>> nMod3) & 24) | ||
if (nMod3 === 2 || bytes.length - nIdx === 1) { | ||
sB64Enc += String.fromCharCode( | ||
uint6ToB64((nUint24 >>> 18) & 63), | ||
uint6ToB64((nUint24 >>> 12) & 63), | ||
uint6ToB64((nUint24 >>> 6) & 63), | ||
uint6ToB64(nUint24 & 63) | ||
) | ||
nUint24 = 0 | ||
} | ||
} | ||
|
||
return eqLen === 0 | ||
? sB64Enc | ||
: sB64Enc.substring(0, sB64Enc.length - eqLen) + (eqLen === 1 ? '=' : '==') | ||
} | ||
|
||
/** | ||
* URL-safe variants of Base64 conversion functions (aka base64url) | ||
* @see https://tools.ietf.org/html/rfc4648#section-5 | ||
*/ | ||
|
||
export function encodeFromArrayUrlSafe(bytes) { | ||
return encodeURIComponent( | ||
encodeFromArray(bytes) | ||
.replace(/\+/g, '-') | ||
.replace(/\//g, '_') | ||
) | ||
} | ||
|
||
export function decodeToArrayUrlSafe(base64string) { | ||
return decodeToArray( | ||
decodeURIComponent(base64string) | ||
.replace(/-/g, '+') | ||
.replace(/_/g, '/') | ||
) | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
window.ALL_CRATES = ["egglog"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!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="List of all items in this crate"><title>List of all items in this crate</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-f3501f0f5ae15dfb.css" id="mainThemeStyle"><div id="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="egglog" data-themes="" data-resource-suffix="" data-rustdoc-version="1.71.1 (eb26296b5 2023-08-03)" data-search-js="search-4926e5fc22a5646a.js" data-settings-js="settings-de11bff964e9d4e5.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ></div><script src="../static.files/storage-62ce34ea385b278a.js"></script><script defer src="../static.files/main-f0540c1d82cde29b.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.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">☰</button><a class="logo-container" href="../egglog/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../egglog/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">Crate egglog</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#constants">Constants</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" 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="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.EGraph.html">EGraph</a></li><li><a href="struct.NotFoundError.html">NotFoundError</a></li><li><a href="struct.Primitive.html">Primitive</a></li><li><a href="struct.RunReport.html">RunReport</a></li><li><a href="struct.SerializeConfig.html">SerializeConfig</a></li><li><a href="struct.SimplePrimitive.html">SimplePrimitive</a></li><li><a href="struct.TermDag.html">TermDag</a></li><li><a href="struct.TypeInfo.html">TypeInfo</a></li><li><a href="struct.Value.html">Value</a></li><li><a href="ast/struct.FunctionDecl.html">ast::FunctionDecl</a></li><li><a href="ast/struct.Id.html">ast::Id</a></li><li><a href="ast/struct.IdentSort.html">ast::IdentSort</a></li><li><a href="ast/struct.Metadata.html">ast::Metadata</a></li><li><a href="ast/struct.NormCommand.html">ast::NormCommand</a></li><li><a href="ast/struct.NormFunctionDecl.html">ast::NormFunctionDecl</a></li><li><a href="ast/struct.NormRule.html">ast::NormRule</a></li><li><a href="ast/struct.NormRunConfig.html">ast::NormRunConfig</a></li><li><a href="ast/struct.Rewrite.html">ast::Rewrite</a></li><li><a href="ast/struct.Rule.html">ast::Rule</a></li><li><a href="ast/struct.RunConfig.html">ast::RunConfig</a></li><li><a href="ast/struct.Schema.html">ast::Schema</a></li><li><a href="ast/struct.Symbol.html">ast::Symbol</a></li><li><a href="ast/struct.Variant.html">ast::Variant</a></li><li><a href="ast/desugar/struct.Desugar.html">ast::desugar::Desugar</a></li><li><a href="ast/parse/struct.ActionParser.html">ast::parse::ActionParser</a></li><li><a href="ast/parse/struct.ExprParser.html">ast::parse::ExprParser</a></li><li><a href="ast/parse/struct.FactParser.html">ast::parse::FactParser</a></li><li><a href="ast/parse/struct.ProgramParser.html">ast::parse::ProgramParser</a></li><li><a href="sort/struct.BoolSort.html">sort::BoolSort</a></li><li><a href="sort/struct.EqSort.html">sort::EqSort</a></li><li><a href="sort/struct.F64Sort.html">sort::F64Sort</a></li><li><a href="sort/struct.I64Sort.html">sort::I64Sort</a></li><li><a href="sort/struct.MapSort.html">sort::MapSort</a></li><li><a href="sort/struct.NotEqualPrimitive.html">sort::NotEqualPrimitive</a></li><li><a href="sort/struct.RationalSort.html">sort::RationalSort</a></li><li><a href="sort/struct.SetSort.html">sort::SetSort</a></li><li><a href="sort/struct.StringSort.html">sort::StringSort</a></li><li><a href="sort/struct.UnitSort.html">sort::UnitSort</a></li><li><a href="sort/struct.VecSort.html">sort::VecSort</a></li></ul><h3 id="enums">Enums</h3><ul class="all-items"><li><a href="enum.CompilerPassStop.html">CompilerPassStop</a></li><li><a href="enum.Error.html">Error</a></li><li><a href="enum.ExtractReport.html">ExtractReport</a></li><li><a href="enum.Term.html">Term</a></li><li><a href="ast/enum.Action.html">ast::Action</a></li><li><a href="ast/enum.Command.html">ast::Command</a></li><li><a href="ast/enum.Expr.html">ast::Expr</a></li><li><a href="ast/enum.Fact.html">ast::Fact</a></li><li><a href="ast/enum.Literal.html">ast::Literal</a></li><li><a href="ast/enum.NCommand.html">ast::NCommand</a></li><li><a href="ast/enum.NormAction.html">ast::NormAction</a></li><li><a href="ast/enum.NormExpr.html">ast::NormExpr</a></li><li><a href="ast/enum.NormFact.html">ast::NormFact</a></li><li><a href="ast/enum.NormSchedule.html">ast::NormSchedule</a></li><li><a href="ast/enum.Schedule.html">ast::Schedule</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.PrimitiveLike.html">PrimitiveLike</a></li><li><a href="ast/parse/trait.__ToTriple.html">ast::parse::__ToTriple</a></li><li><a href="sort/trait.FromSort.html">sort::FromSort</a></li><li><a href="sort/trait.IntoSort.html">sort::IntoSort</a></li><li><a href="sort/trait.Sort.html">sort::Sort</a></li></ul><h3 id="macros">Macros</h3><ul class="all-items"><li><a href="macro.add_primitives.html">add_primitives</a></li><li><a href="macro.match_term_app.html">match_term_app</a></li><li><a href="macro.to_tt.html">to_tt</a></li><li><a href="macro.unpack.html">unpack</a></li></ul><h3 id="types">Type Definitions</h3><ul class="all-items"><li><a href="type.ArcSort.html">ArcSort</a></li><li><a href="type.Subst.html">Subst</a></li><li><a href="type.TermId.html">TermId</a></li><li><a href="ast/type.CommandId.html">ast::CommandId</a></li><li><a href="sort/type.PreSort.html">sort::PreSort</a></li><li><a href="util/type.IndexMap.html">util::IndexMap</a></li><li><a href="util/type.IndexSet.html">util::IndexSet</a></li></ul><h3 id="constants">Constants</h3><ul class="all-items"><li><a href="constant.HIGH_COST.html">HIGH_COST</a></li><li><a href="constant.UNIT_SYM.html">UNIT_SYM</a></li></ul></section></div></main></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!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="API documentation for the Rust `desugar` mod in crate `egglog`."><title>egglog::ast::desugar - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-f3501f0f5ae15dfb.css" id="mainThemeStyle"><div id="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="egglog" data-themes="" data-resource-suffix="" data-rustdoc-version="1.71.1 (eb26296b5 2023-08-03)" data-search-js="search-4926e5fc22a5646a.js" data-settings-js="settings-de11bff964e9d4e5.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ></div><script src="../../../static.files/storage-62ce34ea385b278a.js"></script><script defer src="../../../static.files/main-f0540c1d82cde29b.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../../../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../../../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.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">☰</button><a class="logo-container" href="../../../egglog/index.html"><img class="rust-logo" src="../../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../../egglog/index.html"><img class="rust-logo" src="../../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">Module desugar</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" 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="../../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../../index.html">egglog</a>::<wbr><a href="../index.html">ast</a>::<wbr><a class="mod" href="#">desugar</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/egglog/ast/desugar.rs.html#1-846">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Desugar.html" title="struct egglog::ast::desugar::Desugar">Desugar</a></div><div class="desc docblock-short">The Desugar struct stores all the state needed | ||
during desugaring a program. | ||
While desugaring doesn’t need type information, it | ||
needs to know what global variables exist. | ||
It also needs to know what functions are primitives | ||
(it uses the <a href="../../struct.TypeInfo.html" title="struct egglog::TypeInfo"><code>TypeInfo</code></a> for that. | ||
After desugaring, typechecking happens and the | ||
type_info field is used for that.</div></li></ul></section></div></main></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
window.SIDEBAR_ITEMS = {"struct":["Desugar"]}; |
Oops, something went wrong.