in midst of refactor

This commit is contained in:
2024-04-29 21:46:42 +02:00
parent ed0d64d52e
commit aa3f7e99ab
221 changed files with 5431 additions and 685 deletions

55
orchid-api/src/parser.rs Normal file
View File

@@ -0,0 +1,55 @@
use orchid_api_derive::{Coding, Hierarchy};
use orchid_api_traits::Request;
use crate::intern::TStr;
use crate::proto::{ExtHostReq, HostExtReq};
use crate::system::SysId;
use crate::tree::TokenTree;
#[derive(Clone, Debug, Coding, Hierarchy)]
#[extends(HostExtReq)]
#[extendable]
pub enum ParserReq {
MkLexer(MkLexer),
Lex(Lex),
}
pub type LexerId = u16;
#[derive(Clone, Debug, Coding, Hierarchy)]
#[extends(ParserReq, HostExtReq)]
pub struct MkLexer(pub SysId, pub TStr);
impl Request for MkLexer {
type Response = LexerId;
}
#[derive(Clone, Debug, Coding, Hierarchy)]
#[extends(ParserReq, HostExtReq)]
pub struct Lex {
pub parser: LexerId,
pub next: char,
pub pos: u32,
}
impl Request for Lex {
type Response = Option<LexResult>;
}
#[derive(Clone, Debug, Coding)]
pub struct LexResult {
pub consumed: u32,
pub data: TokenTree,
}
#[derive(Clone, Debug, Coding, Hierarchy)]
#[extends(ExtHostReq)]
pub struct SubLex {
pub lexer: LexerId,
pub pos: u32,
}
impl Request for SubLex {
type Response = SubLex;
}
pub struct ParseLine {
}