From 7be336721280075deff24831dc7e50809ef68561 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 6 Feb 2023 19:23:49 +0200 Subject: feat: placeholder for tagged() in pagespec Sponsored-by: author --- src/pagespec.lalrpop | 1 + src/pagespec.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/pagespec.lalrpop b/src/pagespec.lalrpop index ccee2c4..191ff47 100644 --- a/src/pagespec.lalrpop +++ b/src/pagespec.lalrpop @@ -11,6 +11,7 @@ Term: Box = { Glob => Box::new(Expr::Glob(<>)), "link" "(" ")" => Box::new(Expr::LinksHereFunc(<>)), "page" "(" ")" => Box::new(Expr::PageFunc(<>)), + "tagged" "(" ")" => Box::new(Expr::TaggedFunc(<>)), "!" => Box::new(Expr::Negate(t)), "(" ")" => e, } diff --git a/src/pagespec.rs b/src/pagespec.rs index 7af2acd..8d12440 100644 --- a/src/pagespec.rs +++ b/src/pagespec.rs @@ -66,6 +66,7 @@ pub enum Expr { Glob(String), LinksHereFunc(String), PageFunc(String), + TaggedFunc(String), Negate(Box), Op(Box, OpCode, Box), } @@ -77,6 +78,7 @@ impl Expr { Self::Glob(glob) => glob_matches(glob, path), Self::LinksHereFunc(glob) => links_here(site, container, path, glob), Self::PageFunc(glob) => page_matches(site, container, glob, path), // FIXME: check its page + Self::TaggedFunc(glob) => tagged(site, container, glob, path), Self::Negate(expr) => !expr.matches(site, container, path), Self::Op(left, op, right) => match op { OpCode::And => { @@ -169,6 +171,11 @@ fn links_here(site: &Site, container: &Path, path: &str, _glob: &str) -> bool { false } +fn tagged(_site: &Site, container: &Path, path: &str, _glob: &str) -> bool { + trace!("tagged: container={} path={:?}", container.display(), path); + false +} + fn page_matches(site: &Site, container: &Path, glob: &str, path: &str) -> bool { if glob_matches(glob, path) { let full_path = container.join(path); -- cgit v1.2.1