From: Jeremy W. <jwa...@wa...> - 2001-01-22 22:09:16
|
The following patch fixes two issues in the Perl syntax highlighting. The first is bug #124217, namely, context like $s =~ /["'`]/; was incorrectly interpreted as starting a string literal. The second was the inability to recognize embedded POD that didn't start with =head1 (which is only the first line of a section and may not include items). There are still several outstanding issues in the modes/perl.xml file. The most obvious is the limited support of checking for regexps. I would be happy to add more support, but I need support of a feature in the core of jEdit to complete it. In perl you can use the construct m#...# to build a match (and similar expressions for replacements, translations, quoting, etc.). The character immediately following the 'm' is used as the delimiter and the first, non-escaped character afterwards that matches is the end of the regexp. So you can say m!...!, m"...", etc. Perl also supports "smart" block characters for this, like m(...), m[...], and m{...}. To build support for these constructs in the modes/perl.xml I would need matching support in the BEGIN and END of the SPAN tag, perhaps through regualr expression, e.g.: <SPAN TYPE="LITERAL2" DELEGATE="REGEXP" NO_LINE_BREAK="TRUE" > <BEGIN>m([^\w\s])</BEGIN> <END>$1</END> </SPAN> The special "block" characters can be handled manually. Although, while I'm at it I would throw in a request for multiple <BEGIN> and <END> blocks and/or RegExp support for multiple matching, just to make writing the file easier. For example: <SPAN TYPE="LITERAL2" DELEGATE="REGEXP" NO_LINE_BREAK="TRUE" > <BEGIN>(s|tr|y)([^\w\s])</BEGIN> <END>$2[egimoscdUC]+</END> </SPAN> I apologize in advance if this list isn't the place to post patches, but something on the jEdit page said this was the place for modes contributions. A final, minor point that perhaps someone has made before: xml is supposed to use lowercase names for elements and attributes, not uppercase ones. -- Jeremy Wadsack Wadsack-Allen Digital Group 21c21 < <!-- TYPE is LABEL so that =head1 and =cut are highlighted as so --> --- > <!-- TYPE is LABEL so that =\w+ and =cut are highlighted as so --> 25a26,57 > <SPAN TYPE="LABEL" AT_LINE_START="TRUE" DELEGATE="POD"> > <BEGIN>=head2</BEGIN> > <END>=cut</END> > </SPAN> > <SPAN TYPE="LABEL" AT_LINE_START="TRUE" DELEGATE="POD"> > <BEGIN>=item</BEGIN> > <END>=cut</END> > </SPAN> > <SPAN TYPE="LABEL" AT_LINE_START="TRUE" DELEGATE="POD"> > <BEGIN>=over</BEGIN> > <END>=cut</END> > </SPAN> > <SPAN TYPE="LABEL" AT_LINE_START="TRUE" DELEGATE="POD"> > <BEGIN>=back</BEGIN> > <END>=cut</END> > </SPAN> > <SPAN TYPE="LABEL" AT_LINE_START="TRUE" DELEGATE="POD"> > <BEGIN>=pod</BEGIN> > <END>=cut</END> > </SPAN> > <SPAN TYPE="LABEL" AT_LINE_START="TRUE" DELEGATE="POD"> > <BEGIN>=for</BEGIN> > <END>=cut</END> > </SPAN> > <SPAN TYPE="LABEL" AT_LINE_START="TRUE" DELEGATE="POD"> > <BEGIN>=begin</BEGIN> > <END>=cut</END> > </SPAN> > <SPAN TYPE="LABEL" AT_LINE_START="TRUE" DELEGATE="POD"> > <BEGIN>=end</BEGIN> > <END>=cut</END> > </SPAN> 49a82,87 > <!-- RegExps --> > <SPAN TYPE="LITERAL2" DELEGATE="REGEXP" NO_LINE_BREAK="TRUE" > > <BEGIN>/</BEGIN> > <END>/</END> > </SPAN> > 524a563,590 > <RULES SET="REGEXP" DEFAULT="LITERAL2" ESCAPE="\"> > <!-- whitespace: (space and tab) --> > <WHITESPACE> </WHITESPACE> > <WHITESPACE> </WHITESPACE> > > <!-- Variables --> > <SPAN TYPE="KEYWORD2" NO_LINE_BREAK="TRUE" DELEGATE="VARIABLE"> > <BEGIN>${</BEGIN> > <END>}</END> > </SPAN> > > <MARK_FOLLOWING TYPE="KEYWORD2">$#</MARK_FOLLOWING> > <MARK_FOLLOWING TYPE="KEYWORD2">$</MARK_FOLLOWING> > > <SPAN TYPE="KEYWORD2" NO_LINE_BREAK="TRUE" DELEGATE="VARIABLE"> > <BEGIN>@{</BEGIN> > <END>}</END> > </SPAN> > > <MARK_FOLLOWING TYPE="KEYWORD2">@</MARK_FOLLOWING> > > <SPAN TYPE="KEYWORD2" NO_LINE_BREAK="TRUE" DELEGATE="VARIABLE"> > <BEGIN>%{</BEGIN> > <END>}</END> > </SPAN> > > <MARK_FOLLOWING TYPE="KEYWORD2">%</MARK_FOLLOWING> > </RULES> |