#1414 LexMatlab: Block Comments Not Supported [Patch Incl.]

Bug
closed-fixed
Scintilla (793)
5
2013-04-12
2012-10-24
No

Currently, LexMatlab.cpp has no support for MATLAB/Octave style block comments:
%{ comment for MATLAB and Octave %}
#{ Octave only #}

Attached is a patch to fix the latest version from the repository, but not exactly as to the specification of MATLAB/Octave (MATLAB and Octave both require the %} be on a new line, with only leading whitespace, while Octave also allows trailing whitespace - as is, the patch treats it like C style comments). I'm not sure if this is the intended method to fix it, but it seems to work fine.

Thanks!

Discussion

  • Neil Hodgson

    Neil Hodgson - 2012-10-24
    • assigned_to: nobody --> nyamatongwe
     
  • Neil Hodgson

    Neil Hodgson - 2012-10-24

    I won't be looking at this until the new year.

     
  • Neil Hodgson

    Neil Hodgson - 2012-12-30

    This does not appear to initialise the inBlockComment variable if lexing starts with a line inside the comment.

     
    • lostbard

      lostbard - 2013-03-31

      Is anyone looking at the block comment bug for matlab/octave?

      I tried the patch here on the 3.3.0 sources and see the following:
      1. It doesnt support nested multiline comments
      2. seems to not recognise the commented block lines very well when typing into the editor (mainly due to the inBlockComment variable starting as false, no matter what state it should have been)

       
      • Neil Hodgson

        Neil Hodgson - 2013-04-01

        There was no reply to my last message so its unlikely that anyone is working on this.

         
  • lostbard

    lostbard - 2013-04-03

    New LexMat.cxx file attached - let me know if you prefer a diff file.

    Changes:
    - added block comment (and nested block comments) implementation
    - added '...' continuation string displayed as a comment
    - removed unused IsAWord functions
    - added some comments in the code

     
  • Neil Hodgson

    Neil Hodgson - 2013-04-03

    The comment examples provided above appear to leak onto their following lines. Perhaps I'm not understanding the format here. An example file that includes a variety of constructs may make understanding and testing easier.

    The transpose variable is worrying. Generally a variable that lives between loops needs to either be reinitialised at line start or end (a variable with line lifetime) or be initialised from linestate or seek back before the loop starts (a variable with (potentially) multi-line lifetime).

     
  • lostbard

    lostbard - 2013-04-03

    What do you meean by leaking onto following lines? Is there any way I can see this?
    I have attached a matlab file I was using to do a quick check that formatting 'looked' ok.

    I didnt like the transpose, but left it alone as it was already in the code.

     
  • Neil Hodgson

    Neil Hodgson - 2013-04-03

    I wasn't understanding that %} can't be at the end of a line that starts with %{ like the second line of the initial report. In this image, I'd expect the contents of the block comment to be in green and the 'if' not be recognised as a keyword. Perhaps the block comments are only supposed to be for commenting out code.

    Matlab code

    OK about transpose - I saw the new comment and assumed the variable was new too.

     
  • Neil Hodgson

    Neil Hodgson - 2013-04-03

    Sorry, I was looking at the wrong version.

     
  • lostbard

    lostbard - 2013-04-03

    No problems :)

     
  • Neil Hodgson

    Neil Hodgson - 2013-04-09
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2013-04-12
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks