File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,10 @@ pub fn parse_subprogram_declaration_no_semi(
9898 Impure => {
9999 stream. expect_kind( Function ) ?;
100100 ( true , false )
101+ } ,
102+ Pure => {
103+ stream. expect_kind( Function ) ?;
104+ ( true , true )
101105 }
102106 )
103107 } ;
@@ -275,7 +279,26 @@ impure function foo return lib.foo.natural;
275279 } )
276280 ) ;
277281 }
278-
282+ #[ test]
283+ pub fn parses_pure_function_specification ( ) {
284+ let code = Code :: new (
285+ "\
286+ pure function foo return lib.foo.natural;
287+ " ,
288+ ) ;
289+ assert_eq ! (
290+ code. with_stream_no_diagnostics( parse_subprogram_declaration) ,
291+ SubprogramDeclaration :: Function ( FunctionSpecification {
292+ pure: true ,
293+ designator: code
294+ . s1( "foo" )
295+ . ident( )
296+ . map_into( SubprogramDesignator :: Identifier ) ,
297+ parameter_list: Vec :: new( ) ,
298+ return_type: code. s1( "lib.foo.natural" ) . selected_name( )
299+ } )
300+ ) ;
301+ }
279302 #[ test]
280303 pub fn parses_procedure_specification_with_parameters ( ) {
281304 let code = Code :: new (
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ pub enum Kind {
8888 New ,
8989 Array ,
9090 Protected ,
91+ Pure ,
9192 Impure ,
9293 Function ,
9394 Procedure ,
@@ -291,6 +292,7 @@ pub fn kind_str(kind: Kind) -> &'static str {
291292 New => & "new" ,
292293 Array => & "array" ,
293294 Protected => & "protected" ,
295+ Pure => & "pure" ,
294296 Impure => & "impure" ,
295297 Function => & "function" ,
296298 Procedure => & "procedure" ,
@@ -1250,6 +1252,7 @@ impl std::default::Default for Symbols {
12501252 ( "new" , New ) ,
12511253 ( "array" , Array ) ,
12521254 ( "protected" , Protected ) ,
1255+ ( "pure" , Pure ) ,
12531256 ( "impure" , Impure ) ,
12541257 ( "function" , Function ) ,
12551258 ( "procedure" , Procedure ) ,
You can’t perform that action at this time.
0 commit comments