Page 1 of 1

Syntax delimiters per keyword section

Posted: Thu Jan 27, 2005 3:47 pm
by ftaco96
I'd like to see TextPad be able to differentiate (for instance) JSP from javascript by recognizing the JSP delimiters <% and %>, highlighting them, and using them as a trigger to highlight only the JSP keywords in that section. Then it would follow that you'd have to be able to establish a precedence of one type of keyword over another. I would think you could have syntax file parameters like Keywords1StartDelim and Keywords1EndDelim, which could be blank if there's no good way to delimit the beginning of the syntax, as in the case of javascript.

As an example:
<script>
function blahBlah() {
var firstNum = 1234;
var secondNum = <%=Int2.toString() %>;
alert(firstNum.toString() + ":" + secondNum.toString());
}
</script>

Posted: Thu Jan 27, 2005 4:40 pm
by ftaco96
Then my select tag could look like this...

<select name='selMkt' class='select11px' style='width:115px' onChange='getCycNames();'>

instead of like this...

<select name='selMkt' class='select11px' style='width:115px' onChange='getCycNames();'>

Also when using PHP

Posted: Fri Jan 28, 2005 3:12 pm
by xjack
Another example is when php code is embedded in html. It would be nice to highlight the php according to one set of rules and to highlight the html to another set of rules.

Syntax delimiters

Posted: Wed Feb 02, 2005 10:04 pm
by ftaco96
Perhaps the syntax delimiters could even be a regular expression like this one for HTML:

Keywords1Start: <\[A-Za-z\]+

This would be great as long as you always put spaces between < and other variables in test statements.

Posted: Sat Feb 05, 2005 7:24 am
by Parasyte
I am highly interested in such a feature. It is nearly required for PHP with embedded HTML. (As it is now, it's probably best not using syntax highlighting for PHP files if it contains HTML outside of the PHP delimiters -- <?php [or <?] and ?>.)