more ledgible theme, better naming (#8)
Some checks failed
rust-clippy analyze / Run rust-clippy analyzing (push) Has been cancelled
Deploy mdBook site to Pages / build (x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Rust / build (src-lang, x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Deploy mdBook site to Pages / deploy (push) Has been cancelled

Reviewed-on: #8
This commit is contained in:
sevki 2024-07-17 19:58:56 +00:00
parent 48fbcef0da
commit 0ab9c023d9
34 changed files with 4070 additions and 371 deletions

2
.gitignore vendored
View file

@ -4,4 +4,4 @@ node_modules
packages/app/assets
dist
docs/crates/src_*
docs/crates/srclang*

76
Cargo.lock generated
View file

@ -1914,37 +1914,7 @@ dependencies = [
]
[[package]]
name = "src-collections"
version = "0.1.0"
dependencies = [
"indexmap 1.9.3",
"rustc-hash",
"typed-index-collections",
]
[[package]]
name = "src-derive"
version = "0.1.0"
dependencies = [
"insta",
"okstd",
"pretty_assertions",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "src-derive-test"
version = "0.1.0"
dependencies = [
"okstd",
"src-derive",
"src-lang",
]
[[package]]
name = "src-lang"
name = "srclang"
version = "0.1.0"
dependencies = [
"anyhow",
@ -1965,20 +1935,41 @@ dependencies = [
"rustdoc-to-markdown",
"salsa-2022",
"salsa-2022-macros",
"src-derive",
"srclang_derive",
"syn 2.0.71",
"tiny-keccak",
]
[[package]]
name = "src-lsp-browser"
name = "srclang_collections"
version = "0.1.0"
dependencies = [
"indexmap 1.9.3",
"rustc-hash",
"typed-index-collections",
]
[[package]]
name = "srclang_derive"
version = "0.1.0"
dependencies = [
"insta",
"okstd",
"pretty_assertions",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "srclang_lsp_browser"
version = "0.0.0"
dependencies = [
"console_error_panic_hook",
"futures",
"js-sys",
"src-lang",
"src-lsp-server",
"srclang",
"srclang_lsp_server",
"tower-lsp",
"wasm-bindgen",
"wasm-bindgen-futures",
@ -1987,7 +1978,7 @@ dependencies = [
]
[[package]]
name = "src-lsp-server"
name = "srclang_lsp_server"
version = "0.0.0"
dependencies = [
"anyhow",
@ -2005,8 +1996,8 @@ dependencies = [
"salsa-2022",
"salsa-2022-macros",
"serde_json",
"src-collections",
"src-lang",
"srclang",
"srclang_collections",
"thiserror",
"tower-lsp",
"wasm-bindgen",
@ -2015,6 +2006,15 @@ dependencies = [
"web-sys",
]
[[package]]
name = "srlangc_derive_test"
version = "0.1.0"
dependencies = [
"okstd",
"srclang",
"srclang_derive",
]
[[package]]
name = "str_indices"
version = "0.4.3"

View file

@ -1,16 +1,16 @@
[package]
name = "src-lang"
name = "srclang"
version = "0.1.0"
edition = "2021"
[workspace]
members = [
"crates/rustdoc-to-markdown",
"crates/src-collections",
"crates/src-derive",
"crates/src-derive-test",
"crates/src-lsp-browser",
"crates/src-lsp-server",
"crates/srclang_collections",
"crates/srclang_derive",
"crates/srclang_derive_test",
"crates/srclang_lsp_browser",
"crates/srclang_lsp_server",
]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -39,7 +39,7 @@ syn = "2.0.60"
bitflags = "2.5.0"
ropey = { version = "1.6.1", features = ["small_chunks"] }
hashbrown = "0.14.5"
src-derive = { version = "0.1.0", path = "crates/src-derive", registry = "oksoftware" }
srclang_derive = { version = "0.1.0", path = "crates/srclang_derive", registry = "oksoftware" }
paste = "1.0.15"
[dev-dependencies]

View file

@ -179,9 +179,7 @@ fn try_make_books() -> std::result::Result<(), std::io::Error> {
.collect::<Vec<&str>>()
.join("/");
if !base_name.as_str().starts_with("src_lang")
&& !base_name.as_str().starts_with("src_derive")
{
if !base_name.as_str().starts_with("srclang") {
return None;
}
let outpath = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
@ -256,7 +254,7 @@ fn try_make_books() -> std::result::Result<(), std::io::Error> {
continue;
}
if full_path.ends_with("playground/index.md") {
title = "src Playground".to_string();
title = "&#xec2b; srclang ide".to_string();
}
for c in name.iter().enumerate() {
@ -296,7 +294,7 @@ fn try_make_books() -> std::result::Result<(), std::io::Error> {
"Macro" => "&#xeb66;",
"Constant" => "&#xeb5d;",
"Module" => "&#xea8b;",
"Crate" => "&#xea8b;",
"Crate" => "&#xeb29;",
"Crates" => "🦀",
_ => "",
};

View file

@ -1,11 +0,0 @@
[package]
name = "src-derive-test"
version = "0.1.0"
edition = "2021"
publish = ["oksoftware"]
[dependencies]
okstd = { version = "0.1.9", registry = "oksoftware", features = ["macros"] }
src-derive = { version = "0.1.0", path = "../src-derive", registry = "oksoftware" }
src-lang = { version = "0.1.0", path = "../..", registry = "oksoftware" }

View file

@ -1,5 +1,5 @@
[package]
name = "src-collections"
name = "srclang_collections"
version = "0.1.0"
edition = "2021"
publish = ["oksoftware"]
@ -7,4 +7,4 @@ publish = ["oksoftware"]
[dependencies]
rustc-hash = "1.1.0"
indexmap = "1.9.1"
typed-index-collections = "3.0.3"
typed-index-collections = "3.0.3"

View file

@ -1,5 +1,5 @@
[package]
name = "src-derive"
name = "srclang_derive"
version = "0.1.0"
edition = "2021"
publish = ["oksoftware"]

View file

@ -0,0 +1,11 @@
[package]
name = "srlangc_derive_test"
version = "0.1.0"
edition = "2021"
publish = ["oksoftware"]
[dependencies]
okstd = { version = "0.1.9", registry = "oksoftware", features = ["macros"] }
srclang_derive = { version = "0.1.0", path = "../srclang_derive", registry = "oksoftware" }
srclang = { version = "0.1.0", path = "../..", registry = "oksoftware" }

View file

@ -1,4 +1,4 @@
use src_derive::node;
use srclang_derive::node;
use srclang::lexer::Location;
use srclang::ops;
use srclang::parser::span::Spanned;

View file

@ -1,7 +1,7 @@
[package]
publish = false
edition = "2021"
name = "src-lsp-browser"
name = "srclang_lsp_browser"
version = "0.0.0"
[features]
@ -12,7 +12,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
console_error_panic_hook = "0.1.7"
src-lsp-server = { version = "0.0", path = "../src-lsp-server", default-features = false }
srclang_lsp_server = { version = "0.0", path = "../srclang_lsp_server", default-features = false }
futures = "0.3.21"
js-sys = "0.3.57"
tower-lsp = { version = "0.17.0", default-features = false }
@ -21,7 +21,7 @@ wasm-bindgen-futures = { version = "0.4.30", features = [
"futures-core-03-stream",
] }
wasm-streams = "0.2.3"
src-lang = { version = "0.1.0", path = "../..", registry = "oksoftware" }
srclang = { version = "0.1.0", path = "../..", registry = "oksoftware" }
web-sys = { version = "0.3.69", features = [
"console",
"HtmlTextAreaElement",

View file

@ -1,5 +1,5 @@
use js_sys::JsString;
use src_lang::lexer::{self};
use srclang::lexer::{self};
use wasm_bindgen::prelude::*;
#[wasm_bindgen]

View file

@ -1,7 +1,7 @@
[package]
publish = false
edition = "2021"
name = "src-lsp-server"
name = "srclang_lsp_server"
version = "0.0.0"
[features]
@ -23,7 +23,7 @@ lsp = { version = "0.93", package = "lsp-types" }
lsp-text = "0.9"
ropey = "1.6.1"
serde_json = "1.0"
src-lang = { version = "0.1.0", path = "../..", registry = "oksoftware" }
srclang = { version = "0.1.0", path = "../..", registry = "oksoftware" }
salsa = { version = "0.1.0", registry = "oksoftware", package = "salsa-2022" }
salsa-macros = { version = "0.1.0", registry = "oksoftware", package = "salsa-2022-macros" }
thiserror = "1.0"
@ -33,7 +33,7 @@ wasm-bindgen-futures = { version = "0.4.30", features = [
"futures-core-03-stream",
] }
wasm-streams = "0.2.3"
src-collections = { version = "0.1.0", path = "../src-collections", registry = "oksoftware" }
srclang_collections = { version = "0.1.0", path = "../srclang_collections", registry = "oksoftware" }
lazy_static = "1.4.0"
[dependencies.web-sys]

View file

@ -2,8 +2,8 @@ use lsp::{InitializeParams, InitializeResult, Url};
use lsp_text::RopeExt;
use salsa::function::DynDb;
use src_collections::Map;
use src_lang::{
use srclang_collections::Map;
use srclang::{
analyzer::{self, span_text},
compiler::text::{self, Document, SourceProgram},
parser::{

View file

@ -7,8 +7,8 @@ mod server;
mod db;
use src_lang::compiler;
use srclang::compiler;
pub use server::*;
pub use src_lang::Jar;
pub use srclang::Jar;

View file

@ -1,5 +1,5 @@
use anyhow::anyhow;
use src_lang::parser;
use srclang::parser;
use std::result::Result::Ok;
use std::sync::Arc;
use tower_lsp::{jsonrpc, lsp_types::*, LanguageServer};

View file

@ -3,8 +3,8 @@
# src Language
> [!NOTE]
> {{#include ../versions.txt}}
> [!WARNING]
> This very much exists so I don't have to setup the open-source infrastructure after open-sourcing the project. There are lots of moving parts to the documentation, like the [rustdocs](./crates/index.md) is generated and included in the book. Also There is a IDE of sorts in [playground](./playground/index.md) and a [language server](./lsp/index.md) that is used to provide the IDE.
`src` is a domain specific language for manipulating source code and building, progressively distiributed apps or [PDA](https://fistfulofbytes.com/progressive-distributed-apps/).

View file

@ -1,132 +1,131 @@
- [ src Language](0intro.md)
- [ Language Specification](language/0intro.md)
- [ Examples](examples.md)
- [ src Playground](playground/index.md)
- [ &#xec2b; srclang ide](playground/index.md)
- [ Skills](skill-tree.md)
- [ Research](research.md)
- [🦀 Crates](crates/index.md)
- [&#xea8b; Crate src_derive](crates/src_derive/index.md)
- [ node](crates/src_derive/attr.node.md)
- [&#xea8b; Crate src_lang](crates/src_lang/index.md)
- [&#xea8b; analyzer](crates/src_lang/analyzer/index.md)
- [&#xea8b; db](crates/src_lang/analyzer/db/index.md)
- [&#xea91; Database](crates/src_lang/analyzer/db/struct.Database.md)
- [&#xea8c; add_file](crates/src_lang/analyzer/fn.add_file.md)
- [&#xea8c; get_symbol](crates/src_lang/analyzer/fn.get_symbol.md)
- [&#xea8c; span_text](crates/src_lang/analyzer/fn.span_text.md)
- [&#xea91; SyntaxTree](crates/src_lang/analyzer/struct.SyntaxTree.md)
- [&#xea91; Url](crates/src_lang/analyzer/struct.Url.md)
- [&#xea91; add_file](crates/src_lang/analyzer/struct.add_file.md)
- [&#xea91; get_symbol](crates/src_lang/analyzer/struct.get_symbol.md)
- [&#xea91; span_text](crates/src_lang/analyzer/struct.span_text.md)
- [&#xea8b; ast](crates/src_lang/ast/index.md)
- [&#xea95; Kw](crates/src_lang/ast/enum.Kw.md)
- [&#xea95; Literal](crates/src_lang/ast/enum.Literal.md)
- [&#xea95; Node](crates/src_lang/ast/enum.Node.md)
- [&#xea95; Operator](crates/src_lang/ast/enum.Operator.md)
- [&#xea95; Visibility](crates/src_lang/ast/enum.Visibility.md)
- [&#xea91; Field](crates/src_lang/ast/struct.Field.md)
- [&#xea91; Ident](crates/src_lang/ast/struct.Ident.md)
- [&#xea91; Keyword](crates/src_lang/ast/struct.Keyword.md)
- [&#xeb61; FieldVisitor](crates/src_lang/ast/trait.FieldVisitor.md)
- [&#xeb61; IdentVisitor](crates/src_lang/ast/trait.IdentVisitor.md)
- [&#xeb61; KeywordVisitor](crates/src_lang/ast/trait.KeywordVisitor.md)
- [&#xea8b; compiler](crates/src_lang/compiler/index.md)
- [&#xea8b; errors](crates/src_lang/compiler/errors/index.md)
- [&#xea91; Errors](crates/src_lang/compiler/errors/struct.Errors.md)
- [&#xea8c; add_imports](crates/src_lang/compiler/fn.add_imports.md)
- [&#xea8c; compile](crates/src_lang/compiler/fn.compile.md)
- [&#xea8c; compile_effect](crates/src_lang/compiler/fn.compile_effect.md)
- [&#xea8b; ir](crates/src_lang/compiler/ir/index.md)
- [&#xea91; EffectDef](crates/src_lang/compiler/ir/struct.EffectDef.md)
- [&#xea91; Function](crates/src_lang/compiler/ir/struct.Function.md)
- [&#xea91; Import](crates/src_lang/compiler/ir/struct.Import.md)
- [&#xea91; InternedEffect](crates/src_lang/compiler/ir/struct.InternedEffect.md)
- [&#xea91; Mangled](crates/src_lang/compiler/ir/struct.Mangled.md)
- [&#xea91; Program](crates/src_lang/compiler/ir/struct.Program.md)
- [&#xea91; Symbol](crates/src_lang/compiler/ir/struct.Symbol.md)
- [&#xea91; __EffectDefConfig](crates/src_lang/compiler/ir/struct.__EffectDefConfig.md)
- [&#xea91; __FunctionConfig](crates/src_lang/compiler/ir/struct.__FunctionConfig.md)
- [&#xea91; __ImportConfig](crates/src_lang/compiler/ir/struct.__ImportConfig.md)
- [&#xea91; __InternedEffectData](crates/src_lang/compiler/ir/struct.__InternedEffectData.md)
- [&#xea91; __MangledData](crates/src_lang/compiler/ir/struct.__MangledData.md)
- [&#xea91; __ProgramConfig](crates/src_lang/compiler/ir/struct.__ProgramConfig.md)
- [&#xea91; __SymbolData](crates/src_lang/compiler/ir/struct.__SymbolData.md)
- [&#xea91; add_imports](crates/src_lang/compiler/struct.add_imports.md)
- [&#xea91; compile](crates/src_lang/compiler/struct.compile.md)
- [&#xea91; compile_effect](crates/src_lang/compiler/struct.compile_effect.md)
- [&#xea8b; text](crates/src_lang/compiler/text/index.md)
- [&#xea8c; calculate_line_lengths](crates/src_lang/compiler/text/fn.calculate_line_lengths.md)
- [&#xea8c; cmp_range](crates/src_lang/compiler/text/fn.cmp_range.md)
- [&#xea8c; to_spans](crates/src_lang/compiler/text/fn.to_spans.md)
- [&#xea91; Document](crates/src_lang/compiler/text/struct.Document.md)
- [&#xea91; Position](crates/src_lang/compiler/text/struct.Position.md)
- [&#xea91; SourceMap](crates/src_lang/compiler/text/struct.SourceMap.md)
- [&#xea91; SourceProgram](crates/src_lang/compiler/text/struct.SourceProgram.md)
- [&#xea91; Span](crates/src_lang/compiler/text/struct.Span.md)
- [&#xea91; SpanOverlap](crates/src_lang/compiler/text/struct.SpanOverlap.md)
- [&#xea91; Spanned](crates/src_lang/compiler/text/struct.Spanned.md)
- [&#xea91; __PositionData](crates/src_lang/compiler/text/struct.__PositionData.md)
- [&#xea91; __SourceMapConfig](crates/src_lang/compiler/text/struct.__SourceMapConfig.md)
- [&#xea91; __SpanData](crates/src_lang/compiler/text/struct.__SpanData.md)
- [&#xea91; __SpannedData](crates/src_lang/compiler/text/struct.__SpannedData.md)
- [&#xea91; calculate_line_lengths](crates/src_lang/compiler/text/struct.calculate_line_lengths.md)
- [&#xea91; to_spans](crates/src_lang/compiler/text/struct.to_spans.md)
- [&#xea8b; lexer](crates/src_lang/lexer/index.md)
- [&#xea95; LexicalError](crates/src_lang/lexer/enum.LexicalError.md)
- [&#xea95; Token](crates/src_lang/lexer/enum.Token.md)
- [&#xea95; Variable](crates/src_lang/lexer/enum.Variable.md)
- [&#xea95; Word](crates/src_lang/lexer/enum.Word.md)
- [&#xea91; Lexer](crates/src_lang/lexer/struct.Lexer.md)
- [&#xea91; Location](crates/src_lang/lexer/struct.Location.md)
- [&#xea91; Position](crates/src_lang/lexer/struct.Position.md)
- [&#xea91; Spanned](crates/src_lang/lexer/struct.Spanned.md)
- [&#xea91; TripleIterator](crates/src_lang/lexer/struct.TripleIterator.md)
- [&#xeb66; span](crates/src_lang/macro.span.md)
- [&#xea8b; ops](crates/src_lang/ops/index.md)
- [&#xea8b; traversal](crates/src_lang/ops/traversal/index.md)
- [&#xea95; Control](crates/src_lang/ops/traversal/enum.Control.md)
- [&#xea8b; parser](crates/src_lang/parser/index.md)
- [&#xea8b; ast](crates/src_lang/parser/ast/index.md)
- [&#xeb5d; ANON_FN_NAME](crates/src_lang/parser/ast/constant.ANON_FN_NAME.md)
- [&#xea95; FnArg](crates/src_lang/parser/ast/enum.FnArg.md)
- [&#xea95; Keyword](crates/src_lang/parser/ast/enum.Keyword.md)
- [&#xea95; Literal](crates/src_lang/parser/ast/enum.Literal.md)
- [&#xea95; Node](crates/src_lang/parser/ast/enum.Node.md)
- [&#xea95; Operator](crates/src_lang/parser/ast/enum.Operator.md)
- [&#xea95; Value](crates/src_lang/parser/ast/enum.Value.md)
- [&#xea95; Visibility](crates/src_lang/parser/ast/enum.Visibility.md)
- [&#xea95; Whitespace](crates/src_lang/parser/ast/enum.Whitespace.md)
- [&#xea91; Array](crates/src_lang/parser/ast/struct.Array.md)
- [&#xea91; BinaryOperation](crates/src_lang/parser/ast/struct.BinaryOperation.md)
- [&#xea91; Binding](crates/src_lang/parser/ast/struct.Binding.md)
- [&#xea91; Block](crates/src_lang/parser/ast/struct.Block.md)
- [&#xea91; BranchDef](crates/src_lang/parser/ast/struct.BranchDef.md)
- [&#xea91; EffectDef](crates/src_lang/parser/ast/struct.EffectDef.md)
- [&#xea91; FieldAccess](crates/src_lang/parser/ast/struct.FieldAccess.md)
- [&#xea91; FieldDef](crates/src_lang/parser/ast/struct.FieldDef.md)
- [&#xea91; FnCall](crates/src_lang/parser/ast/struct.FnCall.md)
- [&#xea91; FnDef](crates/src_lang/parser/ast/struct.FnDef.md)
- [&#xea91; FnIdent](crates/src_lang/parser/ast/struct.FnIdent.md)
- [&#xea91; Ident](crates/src_lang/parser/ast/struct.Ident.md)
- [&#xea91; ImplDef](crates/src_lang/parser/ast/struct.ImplDef.md)
- [&#xea91; KeywordAndVisibility](crates/src_lang/parser/ast/struct.KeywordAndVisibility.md)
- [&#xea91; Module](crates/src_lang/parser/ast/struct.Module.md)
- [&#xea91; Prototype](crates/src_lang/parser/ast/struct.Prototype.md)
- [&#xea91; StringLit](crates/src_lang/parser/ast/struct.StringLit.md)
- [&#xea91; StructDef](crates/src_lang/parser/ast/struct.StructDef.md)
- [&#xea91; Tuple](crates/src_lang/parser/ast/struct.Tuple.md)
- [&#xea91; UseDef](crates/src_lang/parser/ast/struct.UseDef.md)
- [&#xea8b; span](crates/src_lang/parser/span/index.md)
- [&#xea95; ByteOrLineColOrCoord](crates/src_lang/parser/span/enum.ByteOrLineColOrCoord.md)
- [&#xea91; ByteOrLineColOrCoordInterned](crates/src_lang/parser/span/struct.ByteOrLineColOrCoordInterned.md)
- [&#xea91; SourceMap](crates/src_lang/parser/span/struct.SourceMap.md)
- [&#xea91; Spanned](crates/src_lang/parser/span/struct.Spanned.md)
- [&#xea91; __SourceMapConfig](crates/src_lang/parser/span/struct.__SourceMapConfig.md)
- [&#xeb61; HasChildSpans](crates/src_lang/parser/span/trait.HasChildSpans.md)
- [&#xeb61; Spanning](crates/src_lang/parser/span/trait.Spanning.md)
- [&#xea8b; src](crates/src_lang/parser/src/index.md)
- [&#xea91; SourceParser](crates/src_lang/parser/src/struct.SourceParser.md)
- [&#xeb61; __ToTriple](crates/src_lang/parser/src/trait.__ToTriple.md)
- [&#xea91; Jar](crates/src_lang/struct.Jar.md)
- [&#xeb61; Db](crates/src_lang/trait.Db.md)
- [&#xeb29; Crate srclang](crates/srclang/index.md)
- [&#xea8b; analyzer](crates/srclang/analyzer/index.md)
- [&#xea8b; db](crates/srclang/analyzer/db/index.md)
- [&#xea91; Database](crates/srclang/analyzer/db/struct.Database.md)
- [&#xea8c; add_file](crates/srclang/analyzer/fn.add_file.md)
- [&#xea8c; get_symbol](crates/srclang/analyzer/fn.get_symbol.md)
- [&#xea8c; span_text](crates/srclang/analyzer/fn.span_text.md)
- [&#xea91; SyntaxTree](crates/srclang/analyzer/struct.SyntaxTree.md)
- [&#xea91; Url](crates/srclang/analyzer/struct.Url.md)
- [&#xea91; add_file](crates/srclang/analyzer/struct.add_file.md)
- [&#xea91; get_symbol](crates/srclang/analyzer/struct.get_symbol.md)
- [&#xea91; span_text](crates/srclang/analyzer/struct.span_text.md)
- [&#xea8b; ast](crates/srclang/ast/index.md)
- [&#xea95; Kw](crates/srclang/ast/enum.Kw.md)
- [&#xea95; Literal](crates/srclang/ast/enum.Literal.md)
- [&#xea95; Node](crates/srclang/ast/enum.Node.md)
- [&#xea95; Operator](crates/srclang/ast/enum.Operator.md)
- [&#xea95; Visibility](crates/srclang/ast/enum.Visibility.md)
- [&#xea91; Field](crates/srclang/ast/struct.Field.md)
- [&#xea91; Ident](crates/srclang/ast/struct.Ident.md)
- [&#xea91; Keyword](crates/srclang/ast/struct.Keyword.md)
- [&#xeb61; FieldVisitor](crates/srclang/ast/trait.FieldVisitor.md)
- [&#xeb61; IdentVisitor](crates/srclang/ast/trait.IdentVisitor.md)
- [&#xeb61; KeywordVisitor](crates/srclang/ast/trait.KeywordVisitor.md)
- [&#xea8b; compiler](crates/srclang/compiler/index.md)
- [&#xea8b; errors](crates/srclang/compiler/errors/index.md)
- [&#xea91; Errors](crates/srclang/compiler/errors/struct.Errors.md)
- [&#xea8c; add_imports](crates/srclang/compiler/fn.add_imports.md)
- [&#xea8c; compile](crates/srclang/compiler/fn.compile.md)
- [&#xea8c; compile_effect](crates/srclang/compiler/fn.compile_effect.md)
- [&#xea8b; ir](crates/srclang/compiler/ir/index.md)
- [&#xea91; EffectDef](crates/srclang/compiler/ir/struct.EffectDef.md)
- [&#xea91; Function](crates/srclang/compiler/ir/struct.Function.md)
- [&#xea91; Import](crates/srclang/compiler/ir/struct.Import.md)
- [&#xea91; InternedEffect](crates/srclang/compiler/ir/struct.InternedEffect.md)
- [&#xea91; Mangled](crates/srclang/compiler/ir/struct.Mangled.md)
- [&#xea91; Program](crates/srclang/compiler/ir/struct.Program.md)
- [&#xea91; Symbol](crates/srclang/compiler/ir/struct.Symbol.md)
- [&#xea91; __EffectDefConfig](crates/srclang/compiler/ir/struct.__EffectDefConfig.md)
- [&#xea91; __FunctionConfig](crates/srclang/compiler/ir/struct.__FunctionConfig.md)
- [&#xea91; __ImportConfig](crates/srclang/compiler/ir/struct.__ImportConfig.md)
- [&#xea91; __InternedEffectData](crates/srclang/compiler/ir/struct.__InternedEffectData.md)
- [&#xea91; __MangledData](crates/srclang/compiler/ir/struct.__MangledData.md)
- [&#xea91; __ProgramConfig](crates/srclang/compiler/ir/struct.__ProgramConfig.md)
- [&#xea91; __SymbolData](crates/srclang/compiler/ir/struct.__SymbolData.md)
- [&#xea91; add_imports](crates/srclang/compiler/struct.add_imports.md)
- [&#xea91; compile](crates/srclang/compiler/struct.compile.md)
- [&#xea91; compile_effect](crates/srclang/compiler/struct.compile_effect.md)
- [&#xea8b; text](crates/srclang/compiler/text/index.md)
- [&#xea8c; calculate_line_lengths](crates/srclang/compiler/text/fn.calculate_line_lengths.md)
- [&#xea8c; cmp_range](crates/srclang/compiler/text/fn.cmp_range.md)
- [&#xea8c; to_spans](crates/srclang/compiler/text/fn.to_spans.md)
- [&#xea91; Document](crates/srclang/compiler/text/struct.Document.md)
- [&#xea91; Position](crates/srclang/compiler/text/struct.Position.md)
- [&#xea91; SourceMap](crates/srclang/compiler/text/struct.SourceMap.md)
- [&#xea91; SourceProgram](crates/srclang/compiler/text/struct.SourceProgram.md)
- [&#xea91; Span](crates/srclang/compiler/text/struct.Span.md)
- [&#xea91; SpanOverlap](crates/srclang/compiler/text/struct.SpanOverlap.md)
- [&#xea91; Spanned](crates/srclang/compiler/text/struct.Spanned.md)
- [&#xea91; __PositionData](crates/srclang/compiler/text/struct.__PositionData.md)
- [&#xea91; __SourceMapConfig](crates/srclang/compiler/text/struct.__SourceMapConfig.md)
- [&#xea91; __SpanData](crates/srclang/compiler/text/struct.__SpanData.md)
- [&#xea91; __SpannedData](crates/srclang/compiler/text/struct.__SpannedData.md)
- [&#xea91; calculate_line_lengths](crates/srclang/compiler/text/struct.calculate_line_lengths.md)
- [&#xea91; to_spans](crates/srclang/compiler/text/struct.to_spans.md)
- [&#xea8b; lexer](crates/srclang/lexer/index.md)
- [&#xea95; LexicalError](crates/srclang/lexer/enum.LexicalError.md)
- [&#xea95; Token](crates/srclang/lexer/enum.Token.md)
- [&#xea95; Word](crates/srclang/lexer/enum.Word.md)
- [&#xea91; Lexer](crates/srclang/lexer/struct.Lexer.md)
- [&#xea91; Location](crates/srclang/lexer/struct.Location.md)
- [&#xea91; Position](crates/srclang/lexer/struct.Position.md)
- [&#xea91; Spanned](crates/srclang/lexer/struct.Spanned.md)
- [&#xea91; TripleIterator](crates/srclang/lexer/struct.TripleIterator.md)
- [&#xeb66; span](crates/srclang/macro.span.md)
- [&#xea8b; ops](crates/srclang/ops/index.md)
- [&#xea8b; traversal](crates/srclang/ops/traversal/index.md)
- [&#xea95; Control](crates/srclang/ops/traversal/enum.Control.md)
- [&#xea8b; parser](crates/srclang/parser/index.md)
- [&#xea8b; ast](crates/srclang/parser/ast/index.md)
- [&#xeb5d; ANON_FN_NAME](crates/srclang/parser/ast/constant.ANON_FN_NAME.md)
- [&#xea95; FnArg](crates/srclang/parser/ast/enum.FnArg.md)
- [&#xea95; Keyword](crates/srclang/parser/ast/enum.Keyword.md)
- [&#xea95; Literal](crates/srclang/parser/ast/enum.Literal.md)
- [&#xea95; Node](crates/srclang/parser/ast/enum.Node.md)
- [&#xea95; Operator](crates/srclang/parser/ast/enum.Operator.md)
- [&#xea95; Value](crates/srclang/parser/ast/enum.Value.md)
- [&#xea95; Visibility](crates/srclang/parser/ast/enum.Visibility.md)
- [&#xea95; Whitespace](crates/srclang/parser/ast/enum.Whitespace.md)
- [&#xea91; Array](crates/srclang/parser/ast/struct.Array.md)
- [&#xea91; BinaryOperation](crates/srclang/parser/ast/struct.BinaryOperation.md)
- [&#xea91; Binding](crates/srclang/parser/ast/struct.Binding.md)
- [&#xea91; Block](crates/srclang/parser/ast/struct.Block.md)
- [&#xea91; BranchDef](crates/srclang/parser/ast/struct.BranchDef.md)
- [&#xea91; EffectDef](crates/srclang/parser/ast/struct.EffectDef.md)
- [&#xea91; FieldAccess](crates/srclang/parser/ast/struct.FieldAccess.md)
- [&#xea91; FieldDef](crates/srclang/parser/ast/struct.FieldDef.md)
- [&#xea91; FnCall](crates/srclang/parser/ast/struct.FnCall.md)
- [&#xea91; FnDef](crates/srclang/parser/ast/struct.FnDef.md)
- [&#xea91; FnIdent](crates/srclang/parser/ast/struct.FnIdent.md)
- [&#xea91; Ident](crates/srclang/parser/ast/struct.Ident.md)
- [&#xea91; ImplDef](crates/srclang/parser/ast/struct.ImplDef.md)
- [&#xea91; KeywordAndVisibility](crates/srclang/parser/ast/struct.KeywordAndVisibility.md)
- [&#xea91; Module](crates/srclang/parser/ast/struct.Module.md)
- [&#xea91; Prototype](crates/srclang/parser/ast/struct.Prototype.md)
- [&#xea91; StringLit](crates/srclang/parser/ast/struct.StringLit.md)
- [&#xea91; StructDef](crates/srclang/parser/ast/struct.StructDef.md)
- [&#xea91; Tuple](crates/srclang/parser/ast/struct.Tuple.md)
- [&#xea91; UseDef](crates/srclang/parser/ast/struct.UseDef.md)
- [&#xea8b; span](crates/srclang/parser/span/index.md)
- [&#xea95; ByteOrLineColOrCoord](crates/srclang/parser/span/enum.ByteOrLineColOrCoord.md)
- [&#xea91; ByteOrLineColOrCoordInterned](crates/srclang/parser/span/struct.ByteOrLineColOrCoordInterned.md)
- [&#xea91; SourceMap](crates/srclang/parser/span/struct.SourceMap.md)
- [&#xea91; Spanned](crates/srclang/parser/span/struct.Spanned.md)
- [&#xea91; __SourceMapConfig](crates/srclang/parser/span/struct.__SourceMapConfig.md)
- [&#xeb61; HasChildSpans](crates/srclang/parser/span/trait.HasChildSpans.md)
- [&#xeb61; Spanning](crates/srclang/parser/span/trait.Spanning.md)
- [&#xea8b; src](crates/srclang/parser/src/index.md)
- [&#xea91; SourceParser](crates/srclang/parser/src/struct.SourceParser.md)
- [&#xeb61; __ToTriple](crates/srclang/parser/src/trait.__ToTriple.md)
- [&#xea91; Jar](crates/srclang/struct.Jar.md)
- [&#xeb61; Db](crates/srclang/trait.Db.md)
- [&#xeb29; Crate srclang_derive](crates/srclang_derive/index.md)
- [ node](crates/srclang_derive/attr.node.md)

View file

@ -1,5 +1,5 @@
<div style="display:none;">
# IDE
# &#xec2b; IDE
</div>
<div id="container">

View file

@ -54,7 +54,7 @@
<!-- prefetch taocp.png -->
<link rel="prefetch" href="taocp.png">
<!-- add https://microsoft.github.io/vscode-codicons/dist/codicon.css -->
<link rel="stylesheet" href="https://microsoft.github.io/vscode-codicons/dist/codicon.css">
<!-- <link rel="stylesheet" href="https://microsoft.github.io/vscode-codicons/dist/codicon.css"> -->
</head>
<body class="sidebar-visible no-js">
<div id="body-container">

83
ok.css
View file

@ -1,76 +1,6 @@
/*
* okcss
* oknotok.computer 2024
*/
/*!***************************************************************************\
NES.css Framework
Version: development
\*****************************************************************************/ /*!
* Bootstrap Reboot v4.1.3 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
/* cyrillic-ext */
@font-face {
font-family: "IBM Plex Mono";
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/pressstart2p/v15/e3t4euO8T-267oIAQAu6jDQyK3nYivN04w.woff2)
format("woff2");
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: "IBM Plex Mono";
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/pressstart2p/v15/e3t4euO8T-267oIAQAu6jDQyK3nRivN04w.woff2)
format("woff2");
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek */
@font-face {
font-family: "IBM Plex Mono";
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/pressstart2p/v15/e3t4euO8T-267oIAQAu6jDQyK3nWivN04w.woff2)
format("woff2");
unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1,
U+03A3-03FF;
}
/* latin-ext */
@font-face {
font-family: "IBM Plex Mono";
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/pressstart2p/v15/e3t4euO8T-267oIAQAu6jDQyK3nbivN04w.woff2)
format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: "IBM Plex Mono";
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/pressstart2p/v15/e3t4euO8T-267oIAQAu6jDQyK3nVivM.woff2)
format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: "codicon";
font-display: inline;
font-size: 5em !important;
color: orange;
font-size-adjust: 10;
src: url("https://microsoft.github.io/vscode-codicons/dist/codicon.ttf?30960ab01c247f8c3a401322f35802e9") format("truetype");
unicode-range: U+EA60-EA7F, U+EA80-EA9F, U+EAA0-EABF, U+EAC0-EADF,
U+EAE0-EAFF, U+EB00-EB1F, U+EB20-EB3F, U+EB40-EB5F,
@ -2094,7 +2024,6 @@ input[type="radio"] {
border-image-source: url('data:image/svg+xml;utf8,<?xml version="1.0" encoding="UTF-8" ?><svg version="1.1" width="5" height="5" xmlns="http://www.w3.org/2000/svg"><path d="M2 1 h1 v1 h-1 z M1 2 h1 v1 h-1 z M3 2 h1 v1 h-1 z M2 3 h1 v1 h-1 z" fill="rgb(255,255,255)" /></svg>');
outline-color: #e7e7e7;
}
@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap");
.ibm-plex-mono-thin {
font-family: "IBM Plex Mono", monospace;
@ -2338,7 +2267,7 @@ nav ul li {
nav ul li a {
color: rgb(255, 255, 255);
text-decoration: none;
font-size: 0.8em !important;
/* font-size: 1em !important; */
}
pre {
padding: 16px;
@ -2362,7 +2291,7 @@ pre code {
}
.nes-btn {
/* font-size: 1.1em; */
font-size: 1em;
}
#content.content {
height: calc(100vh - 104px);
@ -2387,7 +2316,7 @@ body {
}
.sidebar {
font-size: x-small !important;
font-size: large !important;
}
h3 code,
@ -2407,9 +2336,9 @@ h4 {
}
li a strong {
font-size: xx-small !important;
font-size: small !important;
}
.hljs {
/* background-color: darken(var(--sidebar-bg) 10%); */
}
}

View file

@ -1,7 +1,7 @@
use crate::lexer::Location;
use crate::ops;
use crate::parser::span::Spanned;
use src_derive::node;
use srclang_derive::node;
use std::fmt::Display;
use std::ops::Range;

View file

@ -6,48 +6,6 @@ use std::{fmt::Display, hash::Hash, iter::Iterator, iter::Peekable, str::Chars};
use okstd::prelude::*;
// Identifier
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum Variable<'input> {
// $$ is the process ID of the shell
ProcessID,
// $! is the process ID of the last background command
LastBackgroundProcessID,
// $? is the exit status of the last command executed
LastCommandExitStatus,
// $- is the current option flags as specified upon invocation, by the set built-in command, or by the shell invocation environment
CurrentOptionFlags,
// $@ is the positional parameters, starting from one
PositionalParameters,
// $# is the number of positional parameters in decimal
PositionalParametersCount,
// $0 is the name of the shell or shell script
ShellName,
// $1...$9 are the positional parameters, starting from zero
PositionalParameter(usize),
// ${parameter} is the value of the variable parameter
Parameter(&'input str),
// ${parameter:-word} is the value of the variable parameter if it is set; otherwise, the expansion of word is substituted
ParameterDefault(&'input str, &'input str),
}
impl<'input> Display for Variable<'input> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Variable::ProcessID => write!(f, "$$"),
Variable::LastBackgroundProcessID => write!(f, "$!"),
Variable::LastCommandExitStatus => write!(f, "$?"),
Variable::CurrentOptionFlags => write!(f, "$-"),
Variable::PositionalParameters => write!(f, "$@"),
Variable::PositionalParametersCount => write!(f, "$#"),
Variable::ShellName => write!(f, "$0"),
Variable::PositionalParameter(i) => write!(f, "${}", i),
Variable::Parameter(p) => write!(f, "${}", p),
Variable::ParameterDefault(p, w) => write!(f, "${}:{}", p, w),
}
}
}
// LexicalError
#[derive(Debug, PartialEq, Clone)]
pub enum LexicalError {
@ -223,7 +181,6 @@ pub enum Token<'input> {
LessThan, // <
GreaterThan, // >
// Identifiers
Variable(Variable<'input>), // $a-z, $A-Z, $0-9, $_
// Literals
Word(Word<'input>), // a-z, A-Z, 0-9, _
String(&'input str), // "..."
@ -273,11 +230,6 @@ impl<'input> Token<'input> {
Token::Equals => "=".chars(),
Token::LessThan => "<".chars(),
Token::GreaterThan => ">".chars(),
Token::Variable(_identifier) => {
// Implement the conversion to chars for Variable
// based on its fields
"".chars()
}
Token::Word(word) => word.chars(),
Token::String(string) => string.chars(),
Token::Comment(comment) => comment.chars(),
@ -320,7 +272,6 @@ impl<'input> Token<'input> {
Token::Equals => "=".to_string(),
Token::LessThan => "<".to_string(),
Token::GreaterThan => ">".to_string(),
Token::Variable(variable) => variable.to_string(),
Token::Word(word) => word.chars().collect(),
Token::String(string) => string.to_string(),
Token::Comment(comment) => comment.to_string(),
@ -403,7 +354,6 @@ enum State {
NewLine,
String(Quotation),
Op,
Variable,
Word,
Number,
Program,
@ -514,6 +464,7 @@ impl<'input> Lexer<'input> {
'@' => Token::At,
'/' => Token::Divide,
'.' => Token::Dot,
'$' => Token::Dollar,
'-' => {
if self.buffer.len() == 1 {
Token::Minus
@ -542,33 +493,6 @@ impl<'input> Lexer<'input> {
.ok_or(LexicalError::UnexpectedEndOfInput)?;
Ok(Token::Comment(comment))
}
State::Variable => {
let variable = self.buffer.clone();
let identifier = match variable.as_str() {
"$$" => Variable::ProcessID,
"$?" => Variable::LastCommandExitStatus,
"$!" => Variable::LastBackgroundProcessID,
"$-" => Variable::CurrentOptionFlags,
"$0" => Variable::ShellName,
"$#" => Variable::PositionalParametersCount,
_ => {
if variable.starts_with('$') && variable.len() > 1 {
let number = variable[1..]
.parse()
.map_err(|_| LexicalError::InvalidVariableFormat)?;
Variable::PositionalParameter(number)
} else {
let var = self
.input
.get(start..end)
.ok_or(LexicalError::UnexpectedEndOfInput)?;
Variable::Parameter(var)
}
}
};
Ok(Token::Variable(identifier))
}
State::Word => {
let word = self
.input
@ -669,10 +593,6 @@ impl<'input> Lexer<'input> {
set_state!(self, State::String(Quotation::Single););
return Ok(());
}
'$' => {
set_state!(self, State::Variable;);
return Ok(());
}
'a'..='z' | 'A'..='Z' | '_' => {
set_state!(self, State::Word;);
return Ok(());
@ -686,7 +606,7 @@ impl<'input> Lexer<'input> {
return Ok(());
}
'(' | ')' | '{' | '}' | '>' | '<' | '|' | '&' | ';' | ',' | ':' | '+' | '*'
| '.' | '[' | ']' | '%' | '@' | '/' | '-' | '=' | '!' => {
| '$' | '.' | '[' | ']' | '%' | '@' | '/' | '-' | '=' | '!' => {
set_state!(self, State::Op;);
debug!("to state: {:?}", self.state);
return Ok(());
@ -950,7 +870,6 @@ impl<'input> Iterator for Lexer<'input> {
}
State::NewLine => self.consume_newline(),
State::String(quotation) => self.consume_string_literal(quotation),
State::Variable => self.consume_variable(),
State::Word => self.consume_word(),
State::Number => self.consume_number(),
State::Any | State::Program => {

View file

@ -0,0 +1,509 @@
---
source: src/parser/parser_snap_tests.rs
expression: "format!(\"{:#?}\", t.unwrap())"
---
Module(
[
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
EffectDef(
EffectDef(
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
KeywordAndVisibility(
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
Effect,
Location {
offset: 6,
line: 0,
col: 6,
},
),
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
Private,
Location {
offset: 0,
line: 0,
col: 0,
},
),
),
Location {
offset: 6,
line: 0,
col: 6,
},
),
Spanned(
Location {
offset: 7,
line: 0,
col: 7,
},
Ident(
"VM",
None,
),
Location {
offset: 9,
line: 0,
col: 9,
},
),
[
Spanned(
Location {
offset: 11,
line: 0,
col: 11,
},
Ident(
"async",
None,
),
Location {
offset: 16,
line: 0,
col: 16,
},
),
Spanned(
Location {
offset: 19,
line: 0,
col: 19,
},
Ident(
"throws",
None,
),
Location {
offset: 25,
line: 0,
col: 25,
},
),
Spanned(
Location {
offset: 28,
line: 0,
col: 28,
},
Ident(
"execs",
None,
),
Location {
offset: 33,
line: 0,
col: 33,
},
),
],
Block(
[
Spanned(
Location {
offset: 40,
line: 1,
col: 4,
},
Prototype {
name: Spanned(
Location {
offset: 40,
line: 1,
col: 4,
},
Ident(
"catch",
None,
),
Location {
offset: 45,
line: 1,
col: 9,
},
),
args: [],
ret: None,
effects: [],
},
Location {
offset: 50,
line: 1,
col: 14,
},
),
Spanned(
Location {
offset: 55,
line: 2,
col: 4,
},
Prototype {
name: Spanned(
Location {
offset: 55,
line: 2,
col: 4,
},
Ident(
"await",
Some(
[
Spanned(
Location {
offset: 61,
line: 2,
col: 10,
},
Ident(
"T",
None,
),
Location {
offset: 62,
line: 2,
col: 11,
},
),
],
),
),
Location {
offset: 63,
line: 2,
col: 12,
},
),
args: [
Spanned(
Location {
offset: 64,
line: 2,
col: 13,
},
Field(
Spanned(
Location {
offset: 64,
line: 2,
col: 13,
},
FieldDef(
Spanned(
Location {
offset: 64,
line: 2,
col: 13,
},
Private,
Location {
offset: 64,
line: 2,
col: 13,
},
),
Spanned(
Location {
offset: 64,
line: 2,
col: 13,
},
Ident(
"f",
None,
),
Location {
offset: 65,
line: 2,
col: 14,
},
),
Spanned(
Location {
offset: 67,
line: 2,
col: 16,
},
Ident(
"Future",
Some(
[
Spanned(
Location {
offset: 74,
line: 2,
col: 23,
},
Ident(
"T",
None,
),
Location {
offset: 75,
line: 2,
col: 24,
},
),
],
),
),
Location {
offset: 76,
line: 2,
col: 25,
},
),
),
Location {
offset: 76,
line: 2,
col: 25,
},
),
),
Location {
offset: 76,
line: 2,
col: 25,
},
),
],
ret: Some(
Spanned(
Location {
offset: 84,
line: 2,
col: 33,
},
Ident(
"T",
None,
),
Location {
offset: 85,
line: 2,
col: 34,
},
),
),
effects: [],
},
Location {
offset: 85,
line: 2,
col: 34,
},
),
Spanned(
Location {
offset: 90,
line: 3,
col: 4,
},
Prototype {
name: Spanned(
Location {
offset: 90,
line: 3,
col: 4,
},
Ident(
"exec",
None,
),
Location {
offset: 94,
line: 3,
col: 8,
},
),
args: [
Spanned(
Location {
offset: 95,
line: 3,
col: 9,
},
Field(
Spanned(
Location {
offset: 95,
line: 3,
col: 9,
},
FieldDef(
Spanned(
Location {
offset: 95,
line: 3,
col: 9,
},
Private,
Location {
offset: 95,
line: 3,
col: 9,
},
),
Spanned(
Location {
offset: 95,
line: 3,
col: 9,
},
Ident(
"arg0",
None,
),
Location {
offset: 99,
line: 3,
col: 13,
},
),
Spanned(
Location {
offset: 101,
line: 3,
col: 15,
},
Ident(
"string",
None,
),
Location {
offset: 107,
line: 3,
col: 21,
},
),
),
Location {
offset: 107,
line: 3,
col: 21,
},
),
),
Location {
offset: 107,
line: 3,
col: 21,
},
),
Spanned(
Location {
offset: 109,
line: 3,
col: 23,
},
Field(
Spanned(
Location {
offset: 109,
line: 3,
col: 23,
},
FieldDef(
Spanned(
Location {
offset: 109,
line: 3,
col: 23,
},
Private,
Location {
offset: 109,
line: 3,
col: 23,
},
),
Spanned(
Location {
offset: 109,
line: 3,
col: 23,
},
Ident(
"args",
None,
),
Location {
offset: 113,
line: 3,
col: 27,
},
),
Spanned(
Location {
offset: 115,
line: 3,
col: 29,
},
Ident(
"stringvec",
None,
),
Location {
offset: 124,
line: 3,
col: 38,
},
),
),
Location {
offset: 124,
line: 3,
col: 38,
},
),
),
Location {
offset: 124,
line: 3,
col: 38,
},
),
],
ret: None,
effects: [],
},
Location {
offset: 128,
line: 3,
col: 42,
},
),
],
),
),
),
Location {
offset: 130,
line: 4,
col: 1,
},
),
],
)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,212 @@
---
source: src/parser/parser_snap_tests.rs
expression: "format!(\"{:#?}\", t.unwrap())"
---
Module(
[
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
FnDef(
FnDef(
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
KeywordAndVisibility(
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
Fn,
Location {
offset: 2,
line: 0,
col: 2,
},
),
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
Private,
Location {
offset: 0,
line: 0,
col: 0,
},
),
),
Location {
offset: 2,
line: 0,
col: 2,
},
),
Spanned(
Location {
offset: 3,
line: 0,
col: 3,
},
Prototype {
name: Spanned(
Location {
offset: 3,
line: 0,
col: 3,
},
Ident(
"some",
None,
),
Location {
offset: 7,
line: 0,
col: 7,
},
),
args: [],
ret: None,
effects: [],
},
Location {
offset: 11,
line: 0,
col: 11,
},
),
Block(
[
Spanned(
Location {
offset: 13,
line: 0,
col: 13,
},
Binding(
Binding(
Spanned(
Location {
offset: 17,
line: 0,
col: 17,
},
Ident(
"a",
None,
),
Location {
offset: 18,
line: 0,
col: 18,
},
),
Spanned(
Location {
offset: 21,
line: 0,
col: 21,
},
FnCall(
FnCall(
Spanned(
Location {
offset: 21,
line: 0,
col: 21,
},
Ident(
"some_fnExpr",
None,
),
Location {
offset: 32,
line: 0,
col: 32,
},
),
[
Spanned(
Location {
offset: 33,
line: 0,
col: 33,
},
Integer(
1,
),
Location {
offset: 34,
line: 0,
col: 34,
},
),
Spanned(
Location {
offset: 36,
line: 0,
col: 36,
},
String(
"2",
),
Location {
offset: 39,
line: 0,
col: 39,
},
),
Spanned(
Location {
offset: 41,
line: 0,
col: 41,
},
Integer(
3,
),
Location {
offset: 42,
line: 0,
col: 42,
},
),
],
),
),
Location {
offset: 43,
line: 0,
col: 43,
},
),
),
),
Location {
offset: 43,
line: 0,
col: 43,
},
),
],
),
),
),
Location {
offset: 44,
line: 0,
col: 44,
},
),
],
)

View file

@ -0,0 +1,425 @@
---
source: src/parser/parser_snap_tests.rs
expression: "format!(\"{:#?}\", t.unwrap())"
---
Module(
[
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
FnDef(
FnDef(
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
KeywordAndVisibility(
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
Fn,
Location {
offset: 2,
line: 0,
col: 2,
},
),
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
Private,
Location {
offset: 0,
line: 0,
col: 0,
},
),
),
Location {
offset: 2,
line: 0,
col: 2,
},
),
Spanned(
Location {
offset: 3,
line: 0,
col: 3,
},
Prototype {
name: Spanned(
Location {
offset: 3,
line: 0,
col: 3,
},
Ident(
"call",
None,
),
Location {
offset: 7,
line: 0,
col: 7,
},
),
args: [
Spanned(
Location {
offset: 8,
line: 0,
col: 8,
},
Field(
Spanned(
Location {
offset: 8,
line: 0,
col: 8,
},
FieldDef(
Spanned(
Location {
offset: 8,
line: 0,
col: 8,
},
Private,
Location {
offset: 8,
line: 0,
col: 8,
},
),
Spanned(
Location {
offset: 8,
line: 0,
col: 8,
},
Ident(
"a",
None,
),
Location {
offset: 9,
line: 0,
col: 9,
},
),
Spanned(
Location {
offset: 10,
line: 0,
col: 10,
},
Ident(
"b",
None,
),
Location {
offset: 11,
line: 0,
col: 11,
},
),
),
Location {
offset: 11,
line: 0,
col: 11,
},
),
),
Location {
offset: 11,
line: 0,
col: 11,
},
),
Spanned(
Location {
offset: 13,
line: 0,
col: 13,
},
Field(
Spanned(
Location {
offset: 13,
line: 0,
col: 13,
},
FieldDef(
Spanned(
Location {
offset: 13,
line: 0,
col: 13,
},
Private,
Location {
offset: 13,
line: 0,
col: 13,
},
),
Spanned(
Location {
offset: 13,
line: 0,
col: 13,
},
Ident(
"b",
None,
),
Location {
offset: 14,
line: 0,
col: 14,
},
),
Spanned(
Location {
offset: 15,
line: 0,
col: 15,
},
Ident(
"c",
None,
),
Location {
offset: 16,
line: 0,
col: 16,
},
),
),
Location {
offset: 16,
line: 0,
col: 16,
},
),
),
Location {
offset: 16,
line: 0,
col: 16,
},
),
],
ret: None,
effects: [
Spanned(
Location {
offset: 19,
line: 0,
col: 19,
},
Ident(
"throws",
None,
),
Location {
offset: 25,
line: 0,
col: 25,
},
),
Spanned(
Location {
offset: 27,
line: 0,
col: 27,
},
Ident(
"awaits",
None,
),
Location {
offset: 33,
line: 0,
col: 33,
},
),
Spanned(
Location {
offset: 35,
line: 0,
col: 35,
},
Ident(
"execs",
None,
),
Location {
offset: 40,
line: 0,
col: 40,
},
),
],
},
Location {
offset: 41,
line: 0,
col: 41,
},
),
Block(
[
Spanned(
Location {
offset: 48,
line: 1,
col: 4,
},
FnCall(
FnCall(
Spanned(
Location {
offset: 48,
line: 1,
col: 4,
},
Ident(
"call",
None,
),
Location {
offset: 52,
line: 1,
col: 8,
},
),
[
Spanned(
Location {
offset: 54,
line: 1,
col: 10,
},
BinaryExpression(
BinaryOperation {
lhs: Spanned(
Location {
offset: 53,
line: 1,
col: 9,
},
Integer(
1,
),
Location {
offset: 54,
line: 1,
col: 10,
},
),
op: Add,
rhs: Spanned(
Location {
offset: 55,
line: 1,
col: 11,
},
Integer(
1,
),
Location {
offset: 56,
line: 1,
col: 12,
},
),
},
),
Location {
offset: 55,
line: 1,
col: 11,
},
),
],
),
),
Location {
offset: 57,
line: 1,
col: 13,
},
),
Spanned(
Location {
offset: 62,
line: 2,
col: 4,
},
Binding(
Binding(
Spanned(
Location {
offset: 66,
line: 2,
col: 8,
},
Ident(
"a",
None,
),
Location {
offset: 67,
line: 2,
col: 9,
},
),
Spanned(
Location {
offset: 70,
line: 2,
col: 12,
},
Integer(
1,
),
Location {
offset: 71,
line: 2,
col: 13,
},
),
),
),
Location {
offset: 71,
line: 2,
col: 13,
},
),
],
),
),
),
Location {
offset: 73,
line: 3,
col: 1,
},
),
],
)

View file

@ -0,0 +1,202 @@
---
source: src/parser/parser_snap_tests.rs
expression: "format!(\"{:#?}\", t.unwrap())"
---
Module(
[
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
StructDef(
StructDef(
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
KeywordAndVisibility(
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
Struct,
Location {
offset: 6,
line: 0,
col: 6,
},
),
Spanned(
Location {
offset: 0,
line: 0,
col: 0,
},
Private,
Location {
offset: 0,
line: 0,
col: 0,
},
),
),
Location {
offset: 6,
line: 0,
col: 6,
},
),
Spanned(
Location {
offset: 7,
line: 0,
col: 7,
},
Ident(
"VM",
None,
),
Location {
offset: 9,
line: 0,
col: 9,
},
),
Block(
[
Spanned(
Location {
offset: 16,
line: 1,
col: 4,
},
FieldDef(
Spanned(
Location {
offset: 16,
line: 1,
col: 4,
},
Private,
Location {
offset: 16,
line: 1,
col: 4,
},
),
Spanned(
Location {
offset: 16,
line: 1,
col: 4,
},
Ident(
"a",
None,
),
Location {
offset: 17,
line: 1,
col: 5,
},
),
Spanned(
Location {
offset: 19,
line: 1,
col: 7,
},
Ident(
"string",
None,
),
Location {
offset: 25,
line: 1,
col: 13,
},
),
),
Location {
offset: 25,
line: 1,
col: 13,
},
),
Spanned(
Location {
offset: 30,
line: 2,
col: 4,
},
FieldDef(
Spanned(
Location {
offset: 30,
line: 2,
col: 4,
},
Private,
Location {
offset: 30,
line: 2,
col: 4,
},
),
Spanned(
Location {
offset: 30,
line: 2,
col: 4,
},
Ident(
"b",
None,
),
Location {
offset: 31,
line: 2,
col: 5,
},
),
Spanned(
Location {
offset: 33,
line: 2,
col: 7,
},
Ident(
"string",
None,
),
Location {
offset: 39,
line: 2,
col: 13,
},
),
),
Location {
offset: 39,
line: 2,
col: 13,
},
),
],
),
),
),
Location {
offset: 41,
line: 3,
col: 1,
},
),
],
)

View file

@ -1,2 +1,2 @@
commit: e44388fca2c935661036e5da47c3d02618fd463e
version: e44388f
commit: 48fbcef0da25c64f1d998b7c979c28a9f8ee49f3
version: 48fbcef