@@ -8,10 +8,35 @@ use std::{fmt::Display, str::FromStr};
88
99use chumsky:: prelude:: Simple ;
1010
11- use parser:: Node ;
11+ use parser:: {
12+ Alias , Brief , Class , Divider , Field , Func , Module , Node , Param , Return , See , Tag , Type , Usage ,
13+ } ;
1214
1315use crate :: lexer:: TagType ;
1416
17+ pub trait Visitor {
18+ type R ;
19+ type S ;
20+ fn module ( & self , n : & Module , s : & Self :: S ) -> Self :: R ;
21+ fn divider ( & self , n : & Divider , s : & Self :: S ) -> Self :: R ;
22+ fn brief ( & self , n : & Brief , s : & Self :: S ) -> Self :: R ;
23+ fn tag ( & self , n : & Tag , s : & Self :: S ) -> Self :: R ;
24+ fn func ( & self , n : & Func , s : & Self :: S ) -> Self :: R ;
25+ fn params ( & self , n : & [ Param ] , s : & Self :: S ) -> Self :: R ;
26+ fn r#returns ( & self , n : & [ Return ] , s : & Self :: S ) -> Self :: R ;
27+ fn class ( & self , n : & Class , s : & Self :: S ) -> Self :: R ;
28+ fn fields ( & self , n : & [ Field ] , s : & Self :: S ) -> Self :: R ;
29+ fn alias ( & self , n : & Alias , s : & Self :: S ) -> Self :: R ;
30+ fn r#type ( & self , n : & Type , s : & Self :: S ) -> Self :: R ;
31+ fn toc ( & self , n : & str , nodes : & [ Node ] , s : & Self :: S ) -> Self :: R ;
32+ fn see ( & self , n : & See , s : & Self :: S ) -> Self :: R ;
33+ fn usage ( & self , n : & Usage , s : & Self :: S ) -> Self :: R ;
34+ }
35+
36+ pub trait Accept < T : Visitor > {
37+ fn accept ( & self , n : & T , s : & T :: S ) -> T :: R ;
38+ }
39+
1540pub trait Nodes {
1641 fn nodes ( & self ) -> & Vec < Node > ;
1742}
0 commit comments