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
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:
parent
48fbcef0da
commit
0ab9c023d9
34 changed files with 4070 additions and 371 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,4 +4,4 @@ node_modules
|
|||
packages/app/assets
|
||||
dist
|
||||
|
||||
docs/crates/src_*
|
||||
docs/crates/srclang*
|
||||
|
|
76
Cargo.lock
generated
76
Cargo.lock
generated
|
@ -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"
|
||||
|
|
14
Cargo.toml
14
Cargo.toml
|
@ -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]
|
||||
|
|
8
build.rs
8
build.rs
|
@ -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 = " 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" => "",
|
||||
"Constant" => "",
|
||||
"Module" => "",
|
||||
"Crate" => "",
|
||||
"Crate" => "",
|
||||
"Crates" => "🦀",
|
||||
_ => "",
|
||||
};
|
||||
|
|
|
@ -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" }
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "src-collections"
|
||||
name = "srclang_collections"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = ["oksoftware"]
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "src-derive"
|
||||
name = "srclang_derive"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = ["oksoftware"]
|
11
crates/srclang_derive_test/Cargo.toml
Normal file
11
crates/srclang_derive_test/Cargo.toml
Normal 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" }
|
|
@ -1,4 +1,4 @@
|
|||
use src_derive::node;
|
||||
use srclang_derive::node;
|
||||
use srclang::lexer::Location;
|
||||
use srclang::ops;
|
||||
use srclang::parser::span::Spanned;
|
|
@ -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",
|
|
@ -1,5 +1,5 @@
|
|||
use js_sys::JsString;
|
||||
use src_lang::lexer::{self};
|
||||
use srclang::lexer::{self};
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
|
@ -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]
|
|
@ -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::{
|
|
@ -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;
|
|
@ -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};
|
|
@ -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/).
|
||||
|
||||
|
|
251
docs/SUMMARY.md
251
docs/SUMMARY.md
|
@ -1,132 +1,131 @@
|
|||
- [ src Language](0intro.md)
|
||||
- [ Language Specification](language/0intro.md)
|
||||
- [ Examples](examples.md)
|
||||
- [ src Playground](playground/index.md)
|
||||
- [  srclang ide](playground/index.md)
|
||||
- [ Skills](skill-tree.md)
|
||||
- [ Research](research.md)
|
||||
- [🦀 Crates](crates/index.md)
|
||||
- [ Crate src_derive](crates/src_derive/index.md)
|
||||
- [ node](crates/src_derive/attr.node.md)
|
||||
- [ Crate src_lang](crates/src_lang/index.md)
|
||||
- [ analyzer](crates/src_lang/analyzer/index.md)
|
||||
- [ db](crates/src_lang/analyzer/db/index.md)
|
||||
- [ Database](crates/src_lang/analyzer/db/struct.Database.md)
|
||||
- [ add_file](crates/src_lang/analyzer/fn.add_file.md)
|
||||
- [ get_symbol](crates/src_lang/analyzer/fn.get_symbol.md)
|
||||
- [ span_text](crates/src_lang/analyzer/fn.span_text.md)
|
||||
- [ SyntaxTree](crates/src_lang/analyzer/struct.SyntaxTree.md)
|
||||
- [ Url](crates/src_lang/analyzer/struct.Url.md)
|
||||
- [ add_file](crates/src_lang/analyzer/struct.add_file.md)
|
||||
- [ get_symbol](crates/src_lang/analyzer/struct.get_symbol.md)
|
||||
- [ span_text](crates/src_lang/analyzer/struct.span_text.md)
|
||||
- [ ast](crates/src_lang/ast/index.md)
|
||||
- [ Kw](crates/src_lang/ast/enum.Kw.md)
|
||||
- [ Literal](crates/src_lang/ast/enum.Literal.md)
|
||||
- [ Node](crates/src_lang/ast/enum.Node.md)
|
||||
- [ Operator](crates/src_lang/ast/enum.Operator.md)
|
||||
- [ Visibility](crates/src_lang/ast/enum.Visibility.md)
|
||||
- [ Field](crates/src_lang/ast/struct.Field.md)
|
||||
- [ Ident](crates/src_lang/ast/struct.Ident.md)
|
||||
- [ Keyword](crates/src_lang/ast/struct.Keyword.md)
|
||||
- [ FieldVisitor](crates/src_lang/ast/trait.FieldVisitor.md)
|
||||
- [ IdentVisitor](crates/src_lang/ast/trait.IdentVisitor.md)
|
||||
- [ KeywordVisitor](crates/src_lang/ast/trait.KeywordVisitor.md)
|
||||
- [ compiler](crates/src_lang/compiler/index.md)
|
||||
- [ errors](crates/src_lang/compiler/errors/index.md)
|
||||
- [ Errors](crates/src_lang/compiler/errors/struct.Errors.md)
|
||||
- [ add_imports](crates/src_lang/compiler/fn.add_imports.md)
|
||||
- [ compile](crates/src_lang/compiler/fn.compile.md)
|
||||
- [ compile_effect](crates/src_lang/compiler/fn.compile_effect.md)
|
||||
- [ ir](crates/src_lang/compiler/ir/index.md)
|
||||
- [ EffectDef](crates/src_lang/compiler/ir/struct.EffectDef.md)
|
||||
- [ Function](crates/src_lang/compiler/ir/struct.Function.md)
|
||||
- [ Import](crates/src_lang/compiler/ir/struct.Import.md)
|
||||
- [ InternedEffect](crates/src_lang/compiler/ir/struct.InternedEffect.md)
|
||||
- [ Mangled](crates/src_lang/compiler/ir/struct.Mangled.md)
|
||||
- [ Program](crates/src_lang/compiler/ir/struct.Program.md)
|
||||
- [ Symbol](crates/src_lang/compiler/ir/struct.Symbol.md)
|
||||
- [ __EffectDefConfig](crates/src_lang/compiler/ir/struct.__EffectDefConfig.md)
|
||||
- [ __FunctionConfig](crates/src_lang/compiler/ir/struct.__FunctionConfig.md)
|
||||
- [ __ImportConfig](crates/src_lang/compiler/ir/struct.__ImportConfig.md)
|
||||
- [ __InternedEffectData](crates/src_lang/compiler/ir/struct.__InternedEffectData.md)
|
||||
- [ __MangledData](crates/src_lang/compiler/ir/struct.__MangledData.md)
|
||||
- [ __ProgramConfig](crates/src_lang/compiler/ir/struct.__ProgramConfig.md)
|
||||
- [ __SymbolData](crates/src_lang/compiler/ir/struct.__SymbolData.md)
|
||||
- [ add_imports](crates/src_lang/compiler/struct.add_imports.md)
|
||||
- [ compile](crates/src_lang/compiler/struct.compile.md)
|
||||
- [ compile_effect](crates/src_lang/compiler/struct.compile_effect.md)
|
||||
- [ text](crates/src_lang/compiler/text/index.md)
|
||||
- [ calculate_line_lengths](crates/src_lang/compiler/text/fn.calculate_line_lengths.md)
|
||||
- [ cmp_range](crates/src_lang/compiler/text/fn.cmp_range.md)
|
||||
- [ to_spans](crates/src_lang/compiler/text/fn.to_spans.md)
|
||||
- [ Document](crates/src_lang/compiler/text/struct.Document.md)
|
||||
- [ Position](crates/src_lang/compiler/text/struct.Position.md)
|
||||
- [ SourceMap](crates/src_lang/compiler/text/struct.SourceMap.md)
|
||||
- [ SourceProgram](crates/src_lang/compiler/text/struct.SourceProgram.md)
|
||||
- [ Span](crates/src_lang/compiler/text/struct.Span.md)
|
||||
- [ SpanOverlap](crates/src_lang/compiler/text/struct.SpanOverlap.md)
|
||||
- [ Spanned](crates/src_lang/compiler/text/struct.Spanned.md)
|
||||
- [ __PositionData](crates/src_lang/compiler/text/struct.__PositionData.md)
|
||||
- [ __SourceMapConfig](crates/src_lang/compiler/text/struct.__SourceMapConfig.md)
|
||||
- [ __SpanData](crates/src_lang/compiler/text/struct.__SpanData.md)
|
||||
- [ __SpannedData](crates/src_lang/compiler/text/struct.__SpannedData.md)
|
||||
- [ calculate_line_lengths](crates/src_lang/compiler/text/struct.calculate_line_lengths.md)
|
||||
- [ to_spans](crates/src_lang/compiler/text/struct.to_spans.md)
|
||||
- [ lexer](crates/src_lang/lexer/index.md)
|
||||
- [ LexicalError](crates/src_lang/lexer/enum.LexicalError.md)
|
||||
- [ Token](crates/src_lang/lexer/enum.Token.md)
|
||||
- [ Variable](crates/src_lang/lexer/enum.Variable.md)
|
||||
- [ Word](crates/src_lang/lexer/enum.Word.md)
|
||||
- [ Lexer](crates/src_lang/lexer/struct.Lexer.md)
|
||||
- [ Location](crates/src_lang/lexer/struct.Location.md)
|
||||
- [ Position](crates/src_lang/lexer/struct.Position.md)
|
||||
- [ Spanned](crates/src_lang/lexer/struct.Spanned.md)
|
||||
- [ TripleIterator](crates/src_lang/lexer/struct.TripleIterator.md)
|
||||
- [ span](crates/src_lang/macro.span.md)
|
||||
- [ ops](crates/src_lang/ops/index.md)
|
||||
- [ traversal](crates/src_lang/ops/traversal/index.md)
|
||||
- [ Control](crates/src_lang/ops/traversal/enum.Control.md)
|
||||
- [ parser](crates/src_lang/parser/index.md)
|
||||
- [ ast](crates/src_lang/parser/ast/index.md)
|
||||
- [ ANON_FN_NAME](crates/src_lang/parser/ast/constant.ANON_FN_NAME.md)
|
||||
- [ FnArg](crates/src_lang/parser/ast/enum.FnArg.md)
|
||||
- [ Keyword](crates/src_lang/parser/ast/enum.Keyword.md)
|
||||
- [ Literal](crates/src_lang/parser/ast/enum.Literal.md)
|
||||
- [ Node](crates/src_lang/parser/ast/enum.Node.md)
|
||||
- [ Operator](crates/src_lang/parser/ast/enum.Operator.md)
|
||||
- [ Value](crates/src_lang/parser/ast/enum.Value.md)
|
||||
- [ Visibility](crates/src_lang/parser/ast/enum.Visibility.md)
|
||||
- [ Whitespace](crates/src_lang/parser/ast/enum.Whitespace.md)
|
||||
- [ Array](crates/src_lang/parser/ast/struct.Array.md)
|
||||
- [ BinaryOperation](crates/src_lang/parser/ast/struct.BinaryOperation.md)
|
||||
- [ Binding](crates/src_lang/parser/ast/struct.Binding.md)
|
||||
- [ Block](crates/src_lang/parser/ast/struct.Block.md)
|
||||
- [ BranchDef](crates/src_lang/parser/ast/struct.BranchDef.md)
|
||||
- [ EffectDef](crates/src_lang/parser/ast/struct.EffectDef.md)
|
||||
- [ FieldAccess](crates/src_lang/parser/ast/struct.FieldAccess.md)
|
||||
- [ FieldDef](crates/src_lang/parser/ast/struct.FieldDef.md)
|
||||
- [ FnCall](crates/src_lang/parser/ast/struct.FnCall.md)
|
||||
- [ FnDef](crates/src_lang/parser/ast/struct.FnDef.md)
|
||||
- [ FnIdent](crates/src_lang/parser/ast/struct.FnIdent.md)
|
||||
- [ Ident](crates/src_lang/parser/ast/struct.Ident.md)
|
||||
- [ ImplDef](crates/src_lang/parser/ast/struct.ImplDef.md)
|
||||
- [ KeywordAndVisibility](crates/src_lang/parser/ast/struct.KeywordAndVisibility.md)
|
||||
- [ Module](crates/src_lang/parser/ast/struct.Module.md)
|
||||
- [ Prototype](crates/src_lang/parser/ast/struct.Prototype.md)
|
||||
- [ StringLit](crates/src_lang/parser/ast/struct.StringLit.md)
|
||||
- [ StructDef](crates/src_lang/parser/ast/struct.StructDef.md)
|
||||
- [ Tuple](crates/src_lang/parser/ast/struct.Tuple.md)
|
||||
- [ UseDef](crates/src_lang/parser/ast/struct.UseDef.md)
|
||||
- [ span](crates/src_lang/parser/span/index.md)
|
||||
- [ ByteOrLineColOrCoord](crates/src_lang/parser/span/enum.ByteOrLineColOrCoord.md)
|
||||
- [ ByteOrLineColOrCoordInterned](crates/src_lang/parser/span/struct.ByteOrLineColOrCoordInterned.md)
|
||||
- [ SourceMap](crates/src_lang/parser/span/struct.SourceMap.md)
|
||||
- [ Spanned](crates/src_lang/parser/span/struct.Spanned.md)
|
||||
- [ __SourceMapConfig](crates/src_lang/parser/span/struct.__SourceMapConfig.md)
|
||||
- [ HasChildSpans](crates/src_lang/parser/span/trait.HasChildSpans.md)
|
||||
- [ Spanning](crates/src_lang/parser/span/trait.Spanning.md)
|
||||
- [ src](crates/src_lang/parser/src/index.md)
|
||||
- [ SourceParser](crates/src_lang/parser/src/struct.SourceParser.md)
|
||||
- [ __ToTriple](crates/src_lang/parser/src/trait.__ToTriple.md)
|
||||
- [ Jar](crates/src_lang/struct.Jar.md)
|
||||
- [ Db](crates/src_lang/trait.Db.md)
|
||||
- [ Crate srclang](crates/srclang/index.md)
|
||||
- [ analyzer](crates/srclang/analyzer/index.md)
|
||||
- [ db](crates/srclang/analyzer/db/index.md)
|
||||
- [ Database](crates/srclang/analyzer/db/struct.Database.md)
|
||||
- [ add_file](crates/srclang/analyzer/fn.add_file.md)
|
||||
- [ get_symbol](crates/srclang/analyzer/fn.get_symbol.md)
|
||||
- [ span_text](crates/srclang/analyzer/fn.span_text.md)
|
||||
- [ SyntaxTree](crates/srclang/analyzer/struct.SyntaxTree.md)
|
||||
- [ Url](crates/srclang/analyzer/struct.Url.md)
|
||||
- [ add_file](crates/srclang/analyzer/struct.add_file.md)
|
||||
- [ get_symbol](crates/srclang/analyzer/struct.get_symbol.md)
|
||||
- [ span_text](crates/srclang/analyzer/struct.span_text.md)
|
||||
- [ ast](crates/srclang/ast/index.md)
|
||||
- [ Kw](crates/srclang/ast/enum.Kw.md)
|
||||
- [ Literal](crates/srclang/ast/enum.Literal.md)
|
||||
- [ Node](crates/srclang/ast/enum.Node.md)
|
||||
- [ Operator](crates/srclang/ast/enum.Operator.md)
|
||||
- [ Visibility](crates/srclang/ast/enum.Visibility.md)
|
||||
- [ Field](crates/srclang/ast/struct.Field.md)
|
||||
- [ Ident](crates/srclang/ast/struct.Ident.md)
|
||||
- [ Keyword](crates/srclang/ast/struct.Keyword.md)
|
||||
- [ FieldVisitor](crates/srclang/ast/trait.FieldVisitor.md)
|
||||
- [ IdentVisitor](crates/srclang/ast/trait.IdentVisitor.md)
|
||||
- [ KeywordVisitor](crates/srclang/ast/trait.KeywordVisitor.md)
|
||||
- [ compiler](crates/srclang/compiler/index.md)
|
||||
- [ errors](crates/srclang/compiler/errors/index.md)
|
||||
- [ Errors](crates/srclang/compiler/errors/struct.Errors.md)
|
||||
- [ add_imports](crates/srclang/compiler/fn.add_imports.md)
|
||||
- [ compile](crates/srclang/compiler/fn.compile.md)
|
||||
- [ compile_effect](crates/srclang/compiler/fn.compile_effect.md)
|
||||
- [ ir](crates/srclang/compiler/ir/index.md)
|
||||
- [ EffectDef](crates/srclang/compiler/ir/struct.EffectDef.md)
|
||||
- [ Function](crates/srclang/compiler/ir/struct.Function.md)
|
||||
- [ Import](crates/srclang/compiler/ir/struct.Import.md)
|
||||
- [ InternedEffect](crates/srclang/compiler/ir/struct.InternedEffect.md)
|
||||
- [ Mangled](crates/srclang/compiler/ir/struct.Mangled.md)
|
||||
- [ Program](crates/srclang/compiler/ir/struct.Program.md)
|
||||
- [ Symbol](crates/srclang/compiler/ir/struct.Symbol.md)
|
||||
- [ __EffectDefConfig](crates/srclang/compiler/ir/struct.__EffectDefConfig.md)
|
||||
- [ __FunctionConfig](crates/srclang/compiler/ir/struct.__FunctionConfig.md)
|
||||
- [ __ImportConfig](crates/srclang/compiler/ir/struct.__ImportConfig.md)
|
||||
- [ __InternedEffectData](crates/srclang/compiler/ir/struct.__InternedEffectData.md)
|
||||
- [ __MangledData](crates/srclang/compiler/ir/struct.__MangledData.md)
|
||||
- [ __ProgramConfig](crates/srclang/compiler/ir/struct.__ProgramConfig.md)
|
||||
- [ __SymbolData](crates/srclang/compiler/ir/struct.__SymbolData.md)
|
||||
- [ add_imports](crates/srclang/compiler/struct.add_imports.md)
|
||||
- [ compile](crates/srclang/compiler/struct.compile.md)
|
||||
- [ compile_effect](crates/srclang/compiler/struct.compile_effect.md)
|
||||
- [ text](crates/srclang/compiler/text/index.md)
|
||||
- [ calculate_line_lengths](crates/srclang/compiler/text/fn.calculate_line_lengths.md)
|
||||
- [ cmp_range](crates/srclang/compiler/text/fn.cmp_range.md)
|
||||
- [ to_spans](crates/srclang/compiler/text/fn.to_spans.md)
|
||||
- [ Document](crates/srclang/compiler/text/struct.Document.md)
|
||||
- [ Position](crates/srclang/compiler/text/struct.Position.md)
|
||||
- [ SourceMap](crates/srclang/compiler/text/struct.SourceMap.md)
|
||||
- [ SourceProgram](crates/srclang/compiler/text/struct.SourceProgram.md)
|
||||
- [ Span](crates/srclang/compiler/text/struct.Span.md)
|
||||
- [ SpanOverlap](crates/srclang/compiler/text/struct.SpanOverlap.md)
|
||||
- [ Spanned](crates/srclang/compiler/text/struct.Spanned.md)
|
||||
- [ __PositionData](crates/srclang/compiler/text/struct.__PositionData.md)
|
||||
- [ __SourceMapConfig](crates/srclang/compiler/text/struct.__SourceMapConfig.md)
|
||||
- [ __SpanData](crates/srclang/compiler/text/struct.__SpanData.md)
|
||||
- [ __SpannedData](crates/srclang/compiler/text/struct.__SpannedData.md)
|
||||
- [ calculate_line_lengths](crates/srclang/compiler/text/struct.calculate_line_lengths.md)
|
||||
- [ to_spans](crates/srclang/compiler/text/struct.to_spans.md)
|
||||
- [ lexer](crates/srclang/lexer/index.md)
|
||||
- [ LexicalError](crates/srclang/lexer/enum.LexicalError.md)
|
||||
- [ Token](crates/srclang/lexer/enum.Token.md)
|
||||
- [ Word](crates/srclang/lexer/enum.Word.md)
|
||||
- [ Lexer](crates/srclang/lexer/struct.Lexer.md)
|
||||
- [ Location](crates/srclang/lexer/struct.Location.md)
|
||||
- [ Position](crates/srclang/lexer/struct.Position.md)
|
||||
- [ Spanned](crates/srclang/lexer/struct.Spanned.md)
|
||||
- [ TripleIterator](crates/srclang/lexer/struct.TripleIterator.md)
|
||||
- [ span](crates/srclang/macro.span.md)
|
||||
- [ ops](crates/srclang/ops/index.md)
|
||||
- [ traversal](crates/srclang/ops/traversal/index.md)
|
||||
- [ Control](crates/srclang/ops/traversal/enum.Control.md)
|
||||
- [ parser](crates/srclang/parser/index.md)
|
||||
- [ ast](crates/srclang/parser/ast/index.md)
|
||||
- [ ANON_FN_NAME](crates/srclang/parser/ast/constant.ANON_FN_NAME.md)
|
||||
- [ FnArg](crates/srclang/parser/ast/enum.FnArg.md)
|
||||
- [ Keyword](crates/srclang/parser/ast/enum.Keyword.md)
|
||||
- [ Literal](crates/srclang/parser/ast/enum.Literal.md)
|
||||
- [ Node](crates/srclang/parser/ast/enum.Node.md)
|
||||
- [ Operator](crates/srclang/parser/ast/enum.Operator.md)
|
||||
- [ Value](crates/srclang/parser/ast/enum.Value.md)
|
||||
- [ Visibility](crates/srclang/parser/ast/enum.Visibility.md)
|
||||
- [ Whitespace](crates/srclang/parser/ast/enum.Whitespace.md)
|
||||
- [ Array](crates/srclang/parser/ast/struct.Array.md)
|
||||
- [ BinaryOperation](crates/srclang/parser/ast/struct.BinaryOperation.md)
|
||||
- [ Binding](crates/srclang/parser/ast/struct.Binding.md)
|
||||
- [ Block](crates/srclang/parser/ast/struct.Block.md)
|
||||
- [ BranchDef](crates/srclang/parser/ast/struct.BranchDef.md)
|
||||
- [ EffectDef](crates/srclang/parser/ast/struct.EffectDef.md)
|
||||
- [ FieldAccess](crates/srclang/parser/ast/struct.FieldAccess.md)
|
||||
- [ FieldDef](crates/srclang/parser/ast/struct.FieldDef.md)
|
||||
- [ FnCall](crates/srclang/parser/ast/struct.FnCall.md)
|
||||
- [ FnDef](crates/srclang/parser/ast/struct.FnDef.md)
|
||||
- [ FnIdent](crates/srclang/parser/ast/struct.FnIdent.md)
|
||||
- [ Ident](crates/srclang/parser/ast/struct.Ident.md)
|
||||
- [ ImplDef](crates/srclang/parser/ast/struct.ImplDef.md)
|
||||
- [ KeywordAndVisibility](crates/srclang/parser/ast/struct.KeywordAndVisibility.md)
|
||||
- [ Module](crates/srclang/parser/ast/struct.Module.md)
|
||||
- [ Prototype](crates/srclang/parser/ast/struct.Prototype.md)
|
||||
- [ StringLit](crates/srclang/parser/ast/struct.StringLit.md)
|
||||
- [ StructDef](crates/srclang/parser/ast/struct.StructDef.md)
|
||||
- [ Tuple](crates/srclang/parser/ast/struct.Tuple.md)
|
||||
- [ UseDef](crates/srclang/parser/ast/struct.UseDef.md)
|
||||
- [ span](crates/srclang/parser/span/index.md)
|
||||
- [ ByteOrLineColOrCoord](crates/srclang/parser/span/enum.ByteOrLineColOrCoord.md)
|
||||
- [ ByteOrLineColOrCoordInterned](crates/srclang/parser/span/struct.ByteOrLineColOrCoordInterned.md)
|
||||
- [ SourceMap](crates/srclang/parser/span/struct.SourceMap.md)
|
||||
- [ Spanned](crates/srclang/parser/span/struct.Spanned.md)
|
||||
- [ __SourceMapConfig](crates/srclang/parser/span/struct.__SourceMapConfig.md)
|
||||
- [ HasChildSpans](crates/srclang/parser/span/trait.HasChildSpans.md)
|
||||
- [ Spanning](crates/srclang/parser/span/trait.Spanning.md)
|
||||
- [ src](crates/srclang/parser/src/index.md)
|
||||
- [ SourceParser](crates/srclang/parser/src/struct.SourceParser.md)
|
||||
- [ __ToTriple](crates/srclang/parser/src/trait.__ToTriple.md)
|
||||
- [ Jar](crates/srclang/struct.Jar.md)
|
||||
- [ Db](crates/srclang/trait.Db.md)
|
||||
- [ Crate srclang_derive](crates/srclang_derive/index.md)
|
||||
- [ node](crates/srclang_derive/attr.node.md)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div style="display:none;">
|
||||
# IDE
|
||||
#  IDE
|
||||
</div>
|
||||
|
||||
<div id="container">
|
||||
|
|
2
docs/theme/index.hbs
vendored
2
docs/theme/index.hbs
vendored
|
@ -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">
|
||||
|
|
81
ok.css
81
ok.css
|
@ -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,7 +2336,7 @@ h4 {
|
|||
}
|
||||
|
||||
li a strong {
|
||||
font-size: xx-small !important;
|
||||
font-size: small !important;
|
||||
}
|
||||
|
||||
.hljs {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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
|
@ -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,
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
|
@ -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,
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
|
@ -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,
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
|
@ -1,2 +1,2 @@
|
|||
commit: e44388fca2c935661036e5da47c3d02618fd463e
|
||||
version: e44388f
|
||||
commit: 48fbcef0da25c64f1d998b7c979c28a9f8ee49f3
|
||||
version: 48fbcef
|
||||
|
|
Loading…
Reference in a new issue