use std::cell::{Cell}; use l0::ast::{Atom, Term, TopLevel, Var}; grammar; pub TopLevel: TopLevel = { "?-" "." => TopLevel::Query(t), "." => TopLevel::Fact(t), }; Atom : Atom = { r"[a-z][a-z0-9_]*" => <>.trim().to_string(), }; Var : Var = { r"[A-Z][a-z0-9_]*" => <>.trim().to_string(), }; BoxedTerm : Box = { => Box::new(t), }; Term : Term = { "(" ",")*> ")" => { let mut ts = ts; ts.push(t); Term::Clause(Cell::new(0), a, ts) }, => Term::Atom(Cell::new(0), <>), => Term::Var(Cell::new(0), <>), };