@@ -22,49 +22,41 @@ impl EGraph {
2222 }
2323 }
2424
25- /// define($self, expr, name, cost)
26- /// --
27- ///
2825 /// Define a new named value.
29- #[ args( cost = "None" ) ]
26+ #[ pyo3(
27+ text_signature = "($self, name, expr, cost=None)" ,
28+ signature = "(name, expr, cost=None)"
29+ ) ]
3030 fn define ( & mut self , name : String , expr : WrappedExpr , cost : Option < usize > ) -> EggResult < ( ) > {
3131 self . egraph . define ( name. into ( ) , expr. into ( ) , cost) ?;
3232 Ok ( ( ) )
3333 }
3434
35- /// declare_function($self, decl)
36- /// --
37- ///
3835 /// Declare a new function definition.
36+ #[ pyo3( text_signature = "($self, decl)" ) ]
3937 fn declare_function ( & mut self , decl : WrappedFunctionDecl ) -> EggResult < ( ) > {
4038 self . egraph . declare_function ( & decl. into ( ) ) ?;
4139 Ok ( ( ) )
4240 }
4341
44- /// declare_sort($self, name)
45- /// --
46- ///
4742 /// Declare a new sort with the given name.
43+ #[ pyo3( text_signature = "($self, name)" ) ]
4844 fn declare_sort ( & mut self , name : & str ) -> EggResult < ( ) > {
4945 self . egraph . declare_sort ( name) ?;
5046 Ok ( { } )
5147 }
5248
53- /// declare_constructor($self, variant, sort)
54- /// --
55- ///
5649 /// Declare a new datatype constructor.
50+ #[ pyo3( text_signature = "($self, variant, sort)" ) ]
5751 fn declare_constructor ( & mut self , variant : WrappedVariant , sort : & str ) -> EggResult < ( ) > {
5852 self . egraph . declare_constructor ( variant. into ( ) , sort) ?;
5953 Ok ( { } )
6054 }
6155
62- /// parse_and_run_program($self, input)
63- /// --
64- ///
6556 /// Parse the input string as a program and run it on the EGraph.
6657 /// Returns a list of strings representing the output.
6758 /// An EggSmolError is raised if there is problem parsing or executing.
59+ #[ pyo3( text_signature = "($self, input)" ) ]
6860 fn parse_and_run_program ( & mut self , input : & str ) -> EggResult < Vec < String > > {
6961 let res = self . egraph . parse_and_run_program ( input) ?;
7062 Ok ( res)
0 commit comments