@@ -6,6 +6,7 @@ pub enum TopLevel<'a> {
66 Class ( Class < ' a > ) ,
77 Import ( Import < ' a > ) ,
88 Module ( Module < ' a > ) ,
9+ Predicate ( Predicate < ' a > ) ,
910}
1011
1112impl fmt:: Display for TopLevel < ' _ > {
@@ -14,6 +15,7 @@ impl fmt::Display for TopLevel<'_> {
1415 TopLevel :: Import ( imp) => write ! ( f, "{}" , imp) ,
1516 TopLevel :: Class ( cls) => write ! ( f, "{}" , cls) ,
1617 TopLevel :: Module ( m) => write ! ( f, "{}" , m) ,
18+ TopLevel :: Predicate ( pred) => write ! ( f, "{}" , pred) ,
1719 }
1820 }
1921}
@@ -68,10 +70,12 @@ impl fmt::Display for Class<'_> {
6870 qldoc: None ,
6971 name: self . name,
7072 overridden: false ,
73+ is_private: false ,
7174 is_final: false ,
7275 return_type: None ,
7376 formal_parameters: vec![ ] ,
7477 body: charpred. clone( ) ,
78+ overlay: None ,
7579 }
7680 ) ?;
7781 }
@@ -150,6 +154,7 @@ pub enum Expression<'a> {
150154 expr : Box < Expression < ' a > > ,
151155 second_expr : Option < Box < Expression < ' a > > > ,
152156 } ,
157+ Negation ( Box < Expression < ' a > > ) ,
153158}
154159
155160impl fmt:: Display for Expression < ' _ > {
@@ -231,26 +236,46 @@ impl fmt::Display for Expression<'_> {
231236 }
232237 write ! ( f, ")" )
233238 }
239+ Expression :: Negation ( e) => write ! ( f, "not ({})" , e) ,
234240 }
235241 }
236242}
237243
244+ #[ derive( Clone , Eq , PartialEq , Hash ) ]
245+ pub enum OverlayAnnotation {
246+ Local ,
247+ DiscardEntity ,
248+ }
249+
238250#[ derive( Clone , Eq , PartialEq , Hash ) ]
239251pub struct Predicate < ' a > {
240252 pub qldoc : Option < String > ,
241253 pub name : & ' a str ,
242254 pub overridden : bool ,
255+ pub is_private : bool ,
243256 pub is_final : bool ,
244257 pub return_type : Option < Type < ' a > > ,
245258 pub formal_parameters : Vec < FormalParameter < ' a > > ,
246259 pub body : Expression < ' a > ,
260+ pub overlay : Option < OverlayAnnotation > ,
247261}
248262
249263impl fmt:: Display for Predicate < ' _ > {
250264 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
251265 if let Some ( qldoc) = & self . qldoc {
252266 write ! ( f, "/** {} */" , qldoc) ?;
253267 }
268+ if let Some ( overlay_annotation) = & self . overlay {
269+ write ! ( f, "overlay[" ) ?;
270+ match overlay_annotation {
271+ OverlayAnnotation :: Local => write ! ( f, "local" ) ?,
272+ OverlayAnnotation :: DiscardEntity => write ! ( f, "discard_entity" ) ?,
273+ }
274+ write ! ( f, "] " ) ?;
275+ }
276+ if self . is_private {
277+ write ! ( f, "private " ) ?;
278+ }
254279 if self . is_final {
255280 write ! ( f, "final " ) ?;
256281 }
0 commit comments