@@ -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,13 @@ 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+ pragma: None ,
79+ overlay: None ,
7580 }
7681 ) ?;
7782 }
@@ -150,6 +155,7 @@ pub enum Expression<'a> {
150155 expr : Box < Expression < ' a > > ,
151156 second_expr : Option < Box < Expression < ' a > > > ,
152157 } ,
158+ Negation ( Box < Expression < ' a > > ) ,
153159}
154160
155161impl fmt:: Display for Expression < ' _ > {
@@ -231,26 +237,59 @@ impl fmt::Display for Expression<'_> {
231237 }
232238 write ! ( f, ")" )
233239 }
240+ Expression :: Negation ( e) => write ! ( f, "not ({})" , e) ,
234241 }
235242 }
236243}
237244
245+ #[ derive( Clone , Eq , PartialEq , Hash ) ]
246+ pub enum PragmaAnnotation {
247+ Nomagic ,
248+ }
249+
250+ #[ derive( Clone , Eq , PartialEq , Hash ) ]
251+ pub enum OverlayAnnotation {
252+ Local ,
253+ DiscardEntity ,
254+ }
255+
238256#[ derive( Clone , Eq , PartialEq , Hash ) ]
239257pub struct Predicate < ' a > {
240258 pub qldoc : Option < String > ,
241259 pub name : & ' a str ,
242260 pub overridden : bool ,
261+ pub is_private : bool ,
243262 pub is_final : bool ,
244263 pub return_type : Option < Type < ' a > > ,
245264 pub formal_parameters : Vec < FormalParameter < ' a > > ,
246265 pub body : Expression < ' a > ,
266+ pub pragma : Option < PragmaAnnotation > ,
267+ pub overlay : Option < OverlayAnnotation > ,
247268}
248269
249270impl fmt:: Display for Predicate < ' _ > {
250271 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
251272 if let Some ( qldoc) = & self . qldoc {
252273 write ! ( f, "/** {} */" , qldoc) ?;
253274 }
275+ if let Some ( overlay_annotation) = & self . overlay {
276+ write ! ( f, "overlay[" ) ?;
277+ match overlay_annotation {
278+ OverlayAnnotation :: Local => write ! ( f, "local" ) ?,
279+ OverlayAnnotation :: DiscardEntity => write ! ( f, "discard_entity" ) ?,
280+ }
281+ write ! ( f, "] " ) ?;
282+ }
283+ if let Some ( pragma) = & self . pragma {
284+ write ! ( f, "pragma[" ) ?;
285+ match pragma {
286+ PragmaAnnotation :: Nomagic => write ! ( f, "nomagic" ) ?,
287+ }
288+ write ! ( f, "] " ) ?;
289+ }
290+ if self . is_private {
291+ write ! ( f, "private " ) ?;
292+ }
254293 if self . is_final {
255294 write ! ( f, "final " ) ?;
256295 }
0 commit comments