Page 1 of 1

Syntax highlighting for Matlab

Posted: Tue Feb 24, 2004 9:18 pm
by 59977
Matlab uses the same character as string separator as for the transpose operator. This causes a problem with syntax highlighting. For example:

r = [sin(phi)' cos(phi)'];

will cause the characters between the apostrophes to be colored as strings. The only way around this seems to be turn off string coloration alltogether.

My proposal is to allow sequences of characters to trigger string coloration. For example (' and ,' would indicate the start of a string but )' would not. This way I think it would be possible to distinguish the two uses of the apostrophe.

Perhaps the more generic case....

Posted: Tue Feb 24, 2004 10:36 pm
by flyingboz
Extend the syntax highlighting definition to allow for
the use of regular expression matching in the identification
of keywords.

Textpad already has an excellent RE engine, it would just need
to be integrated and used w/ the syntax highlighting.

Also, as an aside - VIM allows for the use of such constructs as

def[ine] to match keyword abbreviations in languages where such is allowed. Very useful if you are following someone who is less or more
lazy than yourself.

Posted: Wed Feb 25, 2004 12:50 am
by CyberSlug
Try this:

Code: Select all

[Syntax]
CommentStartAlt = )'
Configure the Comments2 color to be the same as the Brackets color.

Posted: Wed Feb 25, 2004 3:36 pm
by 59977
Full regular expression matching for syntax highlighting would of course be the optimal solution, but integrating the RE engine would probably be rather complicated.

flyingboz:
Thanks for the tip, but it only partially solves the problem. For instance:

r=[x' y'];

is still affected.

Posted: Wed Feb 25, 2004 5:33 pm
by s_reynisson
Pls vote here http://textpad.com/forum/viewtopic.php?t=3846
59977 wrote:Full regular expression matching for syntax highlighting would of course be the optimal solution, but integrating the RE engine would probably be rather complicated.