Nested functions problems

Issue #36 on hold
Daniel Roziecki
created an issue

I have code with deeply nested functions.

This code below is ok:

procedure test();
  procedure test_2();
    procedure test_3();  
    begin
    end;
  begin
  end;
begin
end;

But one more level and you plugin show error:

procedure test();
  procedure test_2();
    procedure test_3();  
      procedure test_4();  <-- error here
      begin
      end;
    begin
    end;
  begin
  end;
begin
end;

My Boss love deeply nested functions, and I have code with much more levels.

Regards

Daniel Roziecki

Comments (3)

  1. Geo B repo owner

    Currently, routine nesting is limited to 3 levels due to parser performance reasons. Some rework needed to support unlimited nesting. I though there is no much point in more levels.

  2. Daniel Roziecki reporter
    function compile_section;
      function parse_list:prog_ref;
       {tworzy reprezentację listy instrukcji}
    
          procedure parse_statement(var l:prog_ref);
          {dodaje do listy pojedyńczą instrukcję}
    
              var e,s1,s2:prog_ref;
                  no:integer;
                  pr:proc_ref;
    
              function parse_params(pcount:smallint):prog_ref; forward;
    
              function parse_expression:prog_ref;
              {rozpoznaje wyrażenie}
    
                 var op:prog_stmt;
    
                 function parse_elementary:prog_ref;
    

    Give me 10 levels, should be enough. I will refactor rest. If I could I would remove whole this code, but I can't.

    Maybe it could be plugin's parameter?

  3. Log in to comment