> From: bill lam
>
> May be try this one,
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- Authors: Jsoftware -->
...
>
> Пнд, 17 Май 2010, Chris Burke писал(а):
> > The syntax coloring is defined in system/config/j.lang.
> >
> > Perhaps someone could take a look and see how it could be improved?
> >
Yes that works better. I've built upon the same idea to include number and
string support within explicit definitions too and included support for Note.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Authors: Jsoftware -->
<language id="j" _name="J" version="2.0" _section="Sources">
<metadata>
<property name="mimetypes">text/x-j;text/x-jsrc</property>
<property name="globs">*.ijs</property>
<property name="line-comment-start">NB\.</property>
</metadata>
<styles>
<style id="comment" _name="comment" />
<style id="string" _name="string" />
<style id="parens" _name="parens" />
<style id="control" _name="control" />
<style id="global" _name="global" />
<style id="local" _name="local" />
<style id="primitive" _name="primitive" />
<style id="number" _name="number" />
<style id="noundef" _name="noundef" />
</styles>
<definitions>
<context id="j">
<include>
<!-- problems/shortcomings
perhaps control should be done as keywords
not sure how to include suffix
primitives other than =: =.
matched vs unmatched parens coloring
marking matching paren might be nice but how to
do () and not {} and [] -->
<!-- NB. -->
<context id="comment" style-ref="comment" end-at-line-end="true">
<start>NB\.</start>
</context>
<!-- 'abc' -->
<context id="string" style-ref="string" end-at-line-end="true">
<start>L?'</start><end>'</end>
</context>
<!-- () -->
<context id="parens" style-ref="parens">
<match extended="true">[\(\)]</match>
</context>
<!-- explicit definition -->
<context id="expdef" style-inside="true">
<start>\%[(([1-4]|13)\s+:\s*0|adverb\s+define|conjunction\s+define|verb\s+define|monad\s+define|dyad\s+define)\%]</start>
<end>^\)\s*$</end>
<include>
<context id="comment1" style-ref="comment"
end-at-line-end="true">
<start>NB\.</start>
</context>
<context id="string1" style-ref="string"
end-at-line-end="true">
<start>L?'</start><end>'</end>
</context>
<context id="number1" style-ref="number">
<match extended="true">\%[[_0-9][_0-9\.a-zA-Z]*\%]</match>
</context>
<context id="control" style-ref="control">
<match extended="true">
\%[(assert\.|break\.|continue\.|for\.|do\.|end\.|if\.|
else\.|elseif\.|return\.|select\.|case\.|fcase\.|
throw\.|try\.|catch\.|catchd\.|catcht\.|while\.|whilst\.|
for_[a-zA-Z][a-zA-Z0-9_]*\.|
goto_[a-zA-Z][a-zA-Z0-9_]*\.|
label_[a-zA-Z][a-zA-Z0-9_]*\.)
</match>
</context>
</include>
</context>
<!-- explicit definition -->
<context id="noundef" style-ref="noundef" style-inside="true">
<start>\%[(0\s+:\s*0|noun\s+define)\s*$</start>
<end>^\)\s*$</end>
</context>
<!-- Note or multiline comment -->
<context id="note" style-ref="comment" style-inside="true">
<start>\%[(Note(\'|\s)).*$</start>
<end>^\)\s*$</end>
</context>
<context id="number" style-ref="number">
<match extended="true">\%[[_0-9][_0-9\.a-zA-Z]*\%]</match>
</context>
<!-- =: -->
<context style-ref="global">
<match extended="true">=\:</match>
</context>
<!-- =. -->
<context style-ref="local">
<match extended="true">=\.</match>
</context>
</include>
</context>
</definitions>
</language>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm