From: <va...@us...> - 2014-06-11 04:03:36
|
Revision: 23589 http://sourceforge.net/p/jedit/svn/23589 Author: vanza Date: 2014-06-11 04:03:28 +0000 (Wed, 11 Jun 2014) Log Message: ----------- Scala mode enhancements. - s, f and raw string interpolators - XML highlighting Note XML highlighting cannot (at least in any way I can figure out) properly parse attributes. Modified Paths: -------------- jEdit/trunk/modes/scala.xml Modified: jEdit/trunk/modes/scala.xml =================================================================== --- jEdit/trunk/modes/scala.xml 2014-06-11 04:03:14 UTC (rev 23588) +++ jEdit/trunk/modes/scala.xml 2014-06-11 04:03:28 UTC (rev 23589) @@ -23,7 +23,7 @@ DIGIT_RE="(0[lL]?|[1-9]\d{0,9}(\d{0,9}[lL])?|0[xX]\p{XDigit}{1,8}(\p{XDigit}{0,8}[lL])?|0[0-7]{1,11}([0-7]{0,11}[lL])?|([0-9]+\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?|[0-9]+([eE][+-]?[0-9]+[fFdD]?|([eE][+-]?[0-9]+)?[fFdD]))"> <MARK_FOLLOWING TYPE="LABEL">@</MARK_FOLLOWING> <IMPORT DELEGATE="PRIMARY"/> - </RULES> + </RULES> <RULES SET="PRIMARY"> <!-- Silly comment --> @@ -52,10 +52,48 @@ <MARK_PREVIOUS TYPE="FUNCTION" MATCH_TYPE="OPERATOR">(</MARK_PREVIOUS> <SEQ TYPE="OPERATOR">)</SEQ> - <!-- XML literals; keep this in sync with the XML_LITERAL rule set! --> - <IMPORT DELEGATE="XML_SHARED"/> + <!-- XML literals; keep this in sync with the INLINE_XML rule set! --> + <SEQ_REGEXP HASH_CHAR="<" TYPE="LITERAL2"><[\w_].\s?/></SEQ_REGEXP> + <SPAN_REGEXP DELEGATE="INLINE_XML" HASH_CHAR="<" + TYPE="LITERAL2" NO_LINE_BREAK="FALSE"> + <BEGIN><([\w_][\d\w_\-:.]*?)(?:\s.*?)?></BEGIN> + <END></$1></END> + </SPAN_REGEXP> <!-- string and character literals --> + <SPAN TYPE="LITERAL1" NO_LINE_BREAK="FALSE" ESCAPE="FALSE" + DELEGATE="S_INTERP"> + <BEGIN>s"""</BEGIN> + <END>"""</END> + </SPAN> + <SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE" ESCAPE="\" + DELEGATE="S_INTERP"> + <BEGIN>s"</BEGIN> + <END>"</END> + </SPAN> + + <SPAN TYPE="LITERAL1" NO_LINE_BREAK="FALSE" ESCAPE="FALSE" + DELEGATE="RAW_INTERP"> + <BEGIN>raw"""</BEGIN> + <END>"""</END> + </SPAN> + <SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE" ESCAPE="\" + DELEGATE="RAW_INTERP"> + <BEGIN>raw"</BEGIN> + <END>"</END> + </SPAN> + + <SPAN TYPE="LITERAL1" NO_LINE_BREAK="FALSE" ESCAPE="FALSE" + DELEGATE="F_INTERP"> + <BEGIN>f"""</BEGIN> + <END>"""</END> + </SPAN> + <SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE" ESCAPE="\" + DELEGATE="F_INTERP"> + <BEGIN>f"</BEGIN> + <END>"</END> + </SPAN> + <SPAN TYPE="LITERAL1" NO_LINE_BREAK="FALSE" ESCAPE="FALSE"> <BEGIN>"""</BEGIN> <END>"""</END> @@ -101,9 +139,6 @@ <SEQ TYPE="OPERATOR">+</SEQ> <SEQ TYPE="OPERATOR">-</SEQ> - <!-- Function calls --> - <!-- <MARK_PREVIOUS TYPE="FUNCTION" MATCH_TYPE="OPERATOR">(</MARK_PREVIOUS> --> - <!-- Function declarations (overloaded for different spacing styles)--> <MARK_FOLLOWING TYPE="FUNCTION" MATCH_TYPE="KEYWORD1" AT_WORD_START="TRUE">def </MARK_FOLLOWING> <MARK_FOLLOWING TYPE="FUNCTION" MATCH_TYPE="KEYWORD1" AT_WORD_START="TRUE">def </MARK_FOLLOWING> @@ -271,50 +306,47 @@ <RULES SET="SCALADOC_PRE" DEFAULT="COMMENT3" /> - <RULES SET="XML_SHARED"> + <RULES SET="INLINE_XML" DEFAULT="LITERAL1"> <SPAN TYPE="COMMENT2"> - <BEGIN><!--</BEGIN> - <END>--></END> + <BEGIN><!- -</BEGIN> + <END>- -></END> </SPAN> - <SPAN TYPE="LITERAL3"> - <BEGIN><?</BEGIN> - <END>?></END> - </SPAN> - <SPAN MATCH_TYPE="LITERAL3" TYPE="COMMENT4"> <BEGIN><![CDATA[</BEGIN> <END>]]></END> </SPAN> + <SPAN TYPE="OPERATOR" DELEGATE="MAIN"> + <BEGIN>{</BEGIN> + <END>}</END> + </SPAN> + <SEQ_REGEXP HASH_CHAR="<" TYPE="LITERAL3"><([\d\w_\-:.]+)(\s+[\d\w_\-:.]+=('[^']*'|"[^"]*"))*\s*/\s*></SEQ_REGEXP> - <SPAN_REGEXP DELEGATE="XML_LITERAL" HASH_CHAR="<" MATCH_TYPE="LITERAL3" TYPE="NULL"> - <BEGIN><([\d\w_\-:.]+)(\s+[\d\w_\-:.]+=('[^']*'|"[^"]*"))*\s*></BEGIN> + <SEQ_REGEXP HASH_CHAR="<" TYPE="LITERAL2"><[\w_].\s?/></SEQ_REGEXP> + <SPAN_REGEXP DELEGATE="INLINE_XML" HASH_CHAR="<" + TYPE="LITERAL2" NO_LINE_BREAK="FALSE"> + <BEGIN><([\w_][\d\w_\-:.]*?)(?:\s.*?)?></BEGIN> <END></$1></END> </SPAN_REGEXP> </RULES> - <!-- TODO find a way to highlight attribute names as LABEL, attribute values as LITERAL1 --> - <RULES SET="XML_LITERAL" DEFAULT="COMMENT4"> - <PROPS> - <PROPERTY NAME="commentStart" VALUE="<!--" /> - <PROPERTY NAME="commentEnd" VALUE="-->" /> - <PROPERTY NAME="lineComment" VALUE="" /> - </PROPS> - - <IMPORT DELEGATE="XML_SHARED"/> - - <SPAN DELEGATE="MAIN"> - <BEGIN>{</BEGIN> + <RULES SET="RAW_INTERP" DEFAULT="LITERAL1"> + <SPAN TYPE="LITERAL4" NO_WORD_BREAK="FALSE" DELEGATE="MAIN"> + <BEGIN>${</BEGIN> <END>}</END> </SPAN> + <MARK_FOLLOWING TYPE="LITERAL4">$</MARK_FOLLOWING> + </RULES> - <SPAN TYPE="LABEL" NO_WORD_BREAK="TRUE"> - <BEGIN>&</BEGIN> - <END>;</END> - </SPAN> + <RULES SET="S_INTERP" DEFAULT="LITERAL1"> + <SEQ_REGEXP HASH_CHAR="\" TYPE="LITERAL3">\\.</SEQ_REGEXP> + <IMPORT DELEGATE="RAW_INTERP" /> + </RULES> - <SEQ_REGEXP HASH_CHAR="<" TYPE="INVALID"></[\d\w_\-:.]+></SEQ_REGEXP> <!-- unmatched closing tags --> + <RULES SET="F_INTERP" DEFAULT="LITERAL1"> + <SEQ_REGEXP HASH_CHAR="%" TYPE="LITERAL3">%[\d.]*[diouxXeEfFgGcrs]</SEQ_REGEXP> + <IMPORT DELEGATE="S_INTERP" /> </RULES> </MODE> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |