move toy widgets from shell into lib

This commit is contained in:
Michael Sippel 2023-01-01 16:12:20 +01:00
parent 883cd01f99
commit 97000cab7a
Signed by: senvas
GPG key ID: F96CF119C34B64A6
8 changed files with 108 additions and 34 deletions

93
shell/gram2 Normal file
View file

@ -0,0 +1,93 @@
ShellTerm :=
| Lit : "«String»" | "«Path»~«Sep Char '/'»~«Seq Char»~«TerminatedArray AsciiChar~Byte 0»"
| Var : $«ProcessArgument~~«PositionalInt 10 BigEndian»»
| Sub : $(«Process»)
$PATH:Sequence Path
:SeparatedSequence Char '/'
:Sequence Sequence Char
:
:SeparatedSequence Char ':'
:Sequence Char
&OsString~
~List Char~Vec Byte
Seq
Vec
Sep
read :: Sep -> Seq
read (Sep xs) d ->
deco :: Style -> Seq ->
ShellTerm::eval t:ShellTerm -> String {
match t {
ShellTerm::Lit "s:«String»" -> {
}
ShellTerm::Var var:$
}
}
$PATH : Sequence Path ~ SeparatedSequence Char ':'
ShellTerm::eval := «» -> «»
«Path» :> «»
Path := [ PathSegment ] ~ List
[Char]
:separator '/'
:
a: Int x b: Int
( a b )
// Process is a Structure Type
Process := {
env : Symbol -> ShellTerm
exe : Path
args : [ShellTerm]
stdin : Pipe
}
// OsString is an Abstraction Type
[OsString] := [Sequence AsciiChar] ~ [Sequence Byte] ~ [TerminatedSequence Byte 0] ~ [Pointer Byte] ~ [MachineWord]
execve := {
Process
~ { env : Symbol, exe: Path~, }
->
}
precedence of operators: '~' < ':' < '[ ]' < '{ }'
<Ls> := [ < ]
Process exe=/bin/ls : Process := {
args : [ProcessArgument] ~ []
}
:> «PosixShellScript ~ String» { ... }
:> «TerminalView» { ... }
»ProcessId«~»MachineInt«~»MachineWord«~»Register«
«ProcessId»~«MachineInt»~«MachineWord»~«Register»
Pipe::read = {
fd: const ( FileDescriptor ~ MachineInt ~ Register ~ EAX )
buf: ( Array Byte ~ )
} ->
stdout := «ProcessId» -> «FileDescriptor»~«MachineInt»~«Register»~«EAX»
poorly-written shell scripts often do not handle filenames with spaces.

10
shell/grammar Normal file
View file

@ -0,0 +1,10 @@
ls :: [files]:<Set Path>
[options]:<Set String>
: (view ls) (template
(decorate files EnumSet)
((λx.xx) a) = aa
-> (process files.to_seq.(map |x|{ }) )

View file

@ -1,28 +0,0 @@
use {
std::{
sync::{Arc, RwLock}
}
nested::{
core::TypeTerm,
}
};
struct ExprEditor {
editor: Arc<RwLock<dyn TerminalTreeEditor>>,
type_tag: TypeTerm
}
impl TreeNav for ExprEditor {
}
impl TerminalEditor for ExprEditor {
fn get_term_view(&self) -> OuterViewPort<dyn TerminalView> {
}
fn handle_terminal_event(&mut self, event: &TerminalEvent) -> TerminalEditorResult {
}
}

View file

@ -1,11 +1,10 @@
extern crate portable_pty; extern crate portable_pty;
mod ascii_box;
mod monstera;
//mod process;
mod pty; mod pty;
// TODO rewrite process & command with incubator rules
//mod process;
//mod command; //mod command;
mod plot;
use { use {
cgmath::{Point2, Vector2}, cgmath::{Point2, Vector2},

View file

@ -21,7 +21,7 @@ use {
}; };
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
/*
pub struct ProcessArg { pub struct ProcessArg {
editor: editor:
PTYListEditor<CharEditor>, PTYListEditor<CharEditor>,
@ -274,4 +274,4 @@ impl Diagnostics for ProcessLauncher {
} }
impl Nested for ProcessLauncher {} impl Nested for ProcessLauncher {}
*/