Opened 5 years ago

Closed 7 months ago

#5644 closed defect (fixed)

OMEdit (nearly) deletes comments

Reported by: massimo ceraolo Owned by: Adrian Pop
Priority: normal Milestone: 2.0.0
Component: Parser Version:
Keywords: Cc: Martin Sjölund

Description (last modified by massimo ceraolo)

Consider the enclosed TestCInterface.mo.
to the following:
1) open "Extfun"
2) open the annotation
3) before end add:

// some text

4) click on save.

=> the text

// some text

disappears.

5) open TestCInterface

=> indeed text

// some text

has been moved outside "ExtFun"

Attachments (3)

TestCInterface.mo (1.1 KB ) - added by massimo ceraolo 5 years ago.
P.mo (130 bytes ) - added by Adeel Asghar 5 years ago.
script.mos (71 bytes ) - added by Adeel Asghar 5 years ago.

Download all attachments as: .zip

Change History (9)

by massimo ceraolo, 5 years ago

Attachment: TestCInterface.mo added

comment:1 by massimo ceraolo, 5 years ago

Summary: OMEdit (nearly) deletes a commentOMEdit (nearly) deletes comments

comment:2 by massimo ceraolo, 5 years ago

Description: modified (diff)

comment:3 by massimo ceraolo, 5 years ago

Description: modified (diff)

by Adeel Asghar, 5 years ago

Attachment: P.mo added

by Adeel Asghar, 5 years ago

Attachment: script.mos added

comment:4 by Adeel Asghar, 5 years ago

Cc: Martin Sjölund added
Component: OMEditParser
Owner: changed from Adeel Asghar to Adrian Pop
Status: newassigned

I made a simplified example. Use the file P.mo and run the script script.mos. It will output the contents as,

package P
  model M
    Real x;
    Real y;

    external \"C\" ;
  end M;

  // some texting
  // some text
end P;

instead of

package P
  model M
    Real x;
    Real y;
    
    external "C";
    // some texting
  end M;

  // some text
end P;

Seems like something off with the parser.

comment:5 by Martin Sjölund, 5 years ago

That's because comments are put where elements can be put. No element can come after external, so the comment is added after it. The Absyn structure cannot represent this case.

comment:6 by massimo ceraolo, 7 months ago

Resolution: fixed
Status: assignedclosed

This issue must have been solved some time ago

Note: See TracTickets for help on using tickets.