ByFuJi / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

MATLAB syntax highlighting treats all ' as starting strings #324

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Highlight as MATLAB code: [a', b']

What is the expected output?  What do you see instead?

I see highlighting showing a string ', b'. I expect to see both '  as postfix 
operators instead.

What version are you using?  On what browser?

Whatever StackOverflow is currently using, in Safari/iOS.

Please provide any additional information below.

One of the problems with parsing and syntax-highlighting MATLAB (and 
derivatives like Octave) is the multiple meanings of the ' character. See, 
e.g., Section 6.2 in 
http://www.hpl.hp.com/personal/Pramod_Joisha/Publications/CPDC-TR-9909-017.pdf 
for a discussion.

For purposes of syntax highlighting, I would assume that it should suffice to 
treat those ' as starting a string that match any one of these criteria:

* Starts the line
* Preceded by whitespace
* Preceded by an opening bracket of any kind

In particular, none of these start a string:

a', (a+b)', x.''

Original issue reported on code.google.com by ccreut...@googlemail.com on 29 Dec 2013 at 10:53

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Actually this is already correctly parsed by the MATLAB handler 
'lang-matlab.js'.

The problem is that Stack Overflow has yet to enable support for the MATLAB 
language by using this optional plugin, instead of relying on the default 
language handler.

There is already a thread on [meta.SO][1] about this, so make the request on 
their side, perhaps the moderators will finally fix it!

 [1]: http://meta.stackoverflow.com/q/123274/135945

Original comment by amroamro...@gmail.com on 22 Jan 2014 at 1:29