fmt and parser for positive set in grammar_separated

also slice with limit, implemented slice for system, changed print for
slicing trace to not use unicode
This commit is contained in:
elvis
2025-10-20 17:04:00 +02:00
parent 4f3e57faed
commit 7d0345f246
8 changed files with 131 additions and 19 deletions

View File

@ -2,12 +2,9 @@ use std::rc::Rc;
use std::str::FromStr;
use lalrpop_util::ParseError;
// use assert::{relabel, grouping};
use rsprocess::{set, reaction, process, environment, system, label};
use rsprocess::element::IdType;
use rsprocess::element::{self, IdType};
use rsprocess::translator::Translator;
// use execution::presets;
// use rsprocess::graph;
use crate::custom_error;
grammar(translator: &mut Translator);
@ -197,6 +194,16 @@ pub Set: set::Set = {
.collect::<Vec<_>>())
};
pub PositiveSet: set::PositiveSet = {
<s: Separated_Empty<"{", PositiveLiteral, ",", "}">> =>
set::PositiveSet::from(s)
};
PositiveLiteral: (element::IdType, element::IdState) = {
"+" <t: Literal> => (translator.encode(t), element::IdState::Positive),
"-" <t: Literal> => (translator.encode(t), element::IdState::Negative),
}
// -----------------------------------------------------------------------------
// ReactionParser