mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-22 05:34:41 +01:00
split up files a bit
This commit is contained in:
parent
9510d9254c
commit
ba0da33509
|
@ -2,49 +2,9 @@ use crate::parser::{syntax_kind::SyntaxKind::*, CompletedMarker, Parser};
|
||||||
|
|
||||||
use self::{collection::collection, instruction::instr, lit::literal};
|
use self::{collection::collection, instruction::instr, lit::literal};
|
||||||
|
|
||||||
|
mod collection;
|
||||||
mod instruction;
|
mod instruction;
|
||||||
mod lit;
|
mod lit;
|
||||||
mod collection {
|
|
||||||
use enumset::enum_set;
|
|
||||||
|
|
||||||
use crate::parser::{
|
|
||||||
syntax_kind::{SyntaxKind::*, TokenSet},
|
|
||||||
CompletedMarker, Parser,
|
|
||||||
};
|
|
||||||
|
|
||||||
use self::{attr_set::attr_set, matrix::matrix, vec::vec};
|
|
||||||
|
|
||||||
const COLLECTION_START: TokenSet = enum_set!(MAT_KW | L_BRACK | L_BRACE);
|
|
||||||
|
|
||||||
pub fn collection(p: &mut Parser) -> Option<CompletedMarker> {
|
|
||||||
if !COLLECTION_START.contains(p.current()) {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(match p.current() {
|
|
||||||
MAT_KW => matrix(p),
|
|
||||||
L_BRACK => vec(p),
|
|
||||||
L_BRACE => attr_set(p),
|
|
||||||
_ => unreachable!(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
mod matrix;
|
|
||||||
mod vec {
|
|
||||||
use crate::parser::{CompletedMarker, Parser};
|
|
||||||
|
|
||||||
pub fn vec(p: &mut Parser) -> CompletedMarker {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mod attr_set {
|
|
||||||
use crate::parser::{CompletedMarker, Parser};
|
|
||||||
|
|
||||||
pub fn attr_set(p: &mut Parser) -> CompletedMarker {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn expression(p: &mut Parser) -> Option<CompletedMarker> {
|
pub fn expression(p: &mut Parser) -> Option<CompletedMarker> {
|
||||||
let expr = p.start("expr");
|
let expr = p.start("expr");
|
||||||
|
|
27
crates/lang/src/parser/grammar/expression/collection.rs
Normal file
27
crates/lang/src/parser/grammar/expression/collection.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
use enumset::enum_set;
|
||||||
|
|
||||||
|
use crate::parser::{
|
||||||
|
syntax_kind::{SyntaxKind::*, TokenSet},
|
||||||
|
CompletedMarker, Parser,
|
||||||
|
};
|
||||||
|
|
||||||
|
use self::{attr_set::attr_set, matrix::matrix, vec::vec};
|
||||||
|
|
||||||
|
mod attr_set;
|
||||||
|
mod matrix;
|
||||||
|
mod vec;
|
||||||
|
|
||||||
|
const COLLECTION_START: TokenSet = enum_set!(MAT_KW | L_BRACK | L_BRACE);
|
||||||
|
|
||||||
|
pub fn collection(p: &mut Parser) -> Option<CompletedMarker> {
|
||||||
|
if !COLLECTION_START.contains(p.current()) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(match p.current() {
|
||||||
|
MAT_KW => matrix(p),
|
||||||
|
L_BRACK => vec(p),
|
||||||
|
L_BRACE => attr_set(p),
|
||||||
|
_ => unreachable!(),
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
use crate::parser::{CompletedMarker, Parser};
|
||||||
|
|
||||||
|
pub fn attr_set(p: &mut Parser) -> CompletedMarker {
|
||||||
|
todo!()
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
use crate::parser::{CompletedMarker, Parser};
|
||||||
|
|
||||||
|
pub fn vec(p: &mut Parser) -> CompletedMarker {
|
||||||
|
todo!()
|
||||||
|
}
|
Loading…
Reference in a new issue