Hello jahsql,
I don’t quite understand what you mean by
Second one - because it can’t understand that only one branch of “if” is executed.
Well, I understand what you are saying but I don’t see how a lexer should
know if parts of a code get executed or not. A lexer should tokenize
the code and color each token in regards to the defined rules.
That the lexer gets confused by your code doesn’t surprise me as you
have four open but only three closing tags.
And php/html lexer has increased complexity as the lexer needs to
satisfy php and html code together.
<div> <div> <!-- this should be highlighted --> <?php if($x==$y) { echo ‘<div id=“bug1”>’; /* bugged highlight to here */ echo ‘</div>’; else echo ‘<div id=“bug2”>’; echo ‘</div>’; } ?> </div> <!-- bugged highlight from here --> </div>Any suggestions/solutions?
Maybe I didn’t get the point but this are my two cents worth.
Cheers
Claudia