oak_prolog/ast/
mod.rs

1pub type PrologToken = crate::kind::PrologSyntaxKind;
2
3#[derive(Debug, Clone)]
4pub struct SourceFile {
5    pub clauses: Vec<Clause>,
6}
7
8#[derive(Debug, Clone)]
9pub enum Clause {
10    Rule(Rule),
11    Fact(Fact),
12    Query(Query),
13    Directive(Directive),
14}
15
16#[derive(Debug, Clone)]
17pub struct Rule {
18    pub head: Term,
19    pub body: Term,
20}
21
22#[derive(Debug, Clone)]
23pub struct Fact {
24    pub term: Term,
25}
26
27#[derive(Debug, Clone)]
28pub struct Query {
29    pub term: Term,
30}
31
32#[derive(Debug, Clone)]
33pub struct Directive {
34    pub term: Term,
35}
36
37#[derive(Debug, Clone)]
38pub enum Term {
39    Atom(String),
40    Variable(String),
41    Number(String),
42    String(String),
43    Compound { functor: String, args: Vec<Term> },
44    List(Vec<Term>),
45}