Couple of questions regarding syntaxes:
I'm working on modifying the HTML syntax to support JSP. I've created the following definition for comments; JSP and HTML comments are similar. JSP comments look like <%-- comment --%>. I can use a simple regexp to search for <!-- or <%--, but is there a way to be smarter about how the comment ends? I'd like to make sure an illegal JSP comment gets highlighted as such:
WRONG: <%-- -->
... or maybe ... <%-- --> --%>
I've currently got the (not quite smart enough) pattern: { name = "Comments"; begin = "<[%!]--"; end = "--%?>"; foregroundColor = "red"; },
How is the "include" keyword supposed to work in a pattern? I've tried this: name = "Embedded Java"; backgroundColor = "#E5E5E5"; begin = "<%"; include = "Java"; end = "%>";
... but that only highlights the background of the excursion, not the text within. I've created a Java bundle with "Java" defined in Syntaxes/Java.plist.
On 6. Oct 2004, at 15:42, Brian Lalor wrote:
Couple of questions regarding syntaxes:
Great! :)
I can use a simple regexp to search for <!-- or <%--, but is there a way to be smarter about how the comment ends? I'd like to make sure an illegal JSP comment gets highlighted as such:
I would do two different rules. One for each type.
How is the "include" keyword supposed to work in a pattern? I've tried this: name = "Embedded Java"; backgroundColor = "#E5E5E5"; begin = "<%"; include = "Java"; end = "%>";
"include" can only be used within "patterns". So you'd do:
name = "Embedded Java"; backgroundColor = "#E5E5E5"; begin = "<%"; patterns = ( include = "Java"; ); end = "%>";
Kind regards Allan
On Oct 6, 2004, at 8:59 AM, Allan Odgaard wrote:
patterns = ( include = "Java"; );
Actually, I think you meant patterns = ( { include = "Java"; } );
:-)
I'm still not getting the foreground coloring like I expected. Just my plain old java mode has some keyword highlighting, but not when embedded in HTML.
On 6. Oct 2004, at 16:13, Brian Lalor wrote:
patterns = ( include = "Java"; );
Actually, I think you meant patterns = ( { include = "Java"; } );
Blush! :)
I'm still not getting the foreground coloring like I expected. Just my plain old java mode has some keyword highlighting, but not when embedded in HTML.
The include key only include the patterns. So you'll have to set the foreground for the rule. So that'd be (hopefully I get it right this time ;) ):
{ name = "Embedded Java"; begin = "<%"; end = "%>"; background = "#E5E5E5"; foreground = "#rrggbb"; patterns = ( { include = "Java"; } ); }
Kind regards Allan