Hi Ed, I don't know syntax coloring rules of jEdit, but I guess if the regex for argument xymnuv is matched before that for names, then this name (1 char) pattern is un-needed.
Пнд, 11 Апр 2011, Cox, Ed писал(а): > Thanks Bill, I definitely want to put it out on the wiki, but figured I'd put > it out here first in case there was any feedback. I will check out those > other cases for explicit definitions. It was the last feature I added so is > most likely to be the one missing something. > > I already found one correction that should be made. These lines: > <!-- Name (1 char) --> > <SEQ_REGEXP TYPE="OPERATOR" > AT_WORD_START="TRUE">([A-Z]|[abcdefghijklopqrstwz])</SEQ_REGEXP> > should be: > <!-- Name (1 char) --> > <SEQ_REGEXP TYPE="NULL" > AT_WORD_START="TRUE">([A-Z]|[abcdefghijklopqrstwz])</SEQ_REGEXP> > > -Ed > ________________________________________ > From: [email protected] [[email protected]] > On Behalf Of bill lam [[email protected]] > Sent: Monday, April 11, 2011 7:06 PM > To: [email protected] > Subject: Re: [Jprogramming] Syntax Highlighter for jEdit > > You may also want to add a screenshot and put the j.xml file in jwiki, > http://www.jsoftware.com/jwiki/Guides/Syntax%20Coloring > > explicit definition can also started with words such as "verb define" or > "Note" . control words must be contained inside explicit definitions. Your > xml may well already got them but I cannot test. > > Пнд, 11 Апр 2011, Cox, Ed писал(а): > > I was looking for good syntax highlighting for J and was not really > > satisfied > > with the editors that already have syntax support available for J. I like > > jEdit, > > and with a name like that it is a shame not to have syntax highlighting > > available > > for it - so I wrote my own. I am sharing it below for anyone to use. To > > use, > > do the following: > > > > 1) Copy & paste it to a text file and name it j.xml. > > 2) Locate the "modes" directory in the jEdit file structure & copy the file > > to it. > > 3) Edit the "catalog" file in the same directory and add this entry in the > > appropriate place: > > <MODE NAME="j" FILE="j.xml" > > FILE_NAME_GLOB="*.{ijs,ijp}"/> > > > > That should do it. Enjoy! > > > > Ed Cox > > Principal Data Analyst > > Medmined > > > > ----copy text below into j.xml file------------- > > <?xml version="1.0"?> > > <!DOCTYPE MODE SYSTEM "xmode.dtd"> > > <!-- jEdit mode for Language: J (evolved from APL; see www.jsoftware.com) > > by Ed Cox ([email protected]) > > If auto-indent behavior is not suitable for you, either modify the > > applicable code > > below, or turn off auto indent by changing the shortcut assigned for > > the ENTER key > > from "Insert new line and indent" to "Insert new line". Use the > > shortcuts section > > in the Global Options. > > > > To use, save this j.xml file to the modes subdirectory for jEdit and > > then add the > > entry below to the catalog file (in the same directory). Follow the > > pattern > > of what is already there: > > > > <MODE NAME="j" FILE="j.xml" > > FILE_NAME_GLOB="*.{ijs,ijp}"/> > > --> > > <MODE> > > <PROPS> > > <PROPERTY NAME="lineComment" VALUE="NB."/> > > <PROPERTY NAME="noTabs" VALUE="true"/> > > <PROPERTY NAME="wrap" VALUE="NONE"/> > > <PROPERTY NAME="folding" VALUE="indent"/> > > <PROPERTY NAME="indentSize" VALUE="2"/> > > <!-- Auto Indent --> > > <PROPERTY NAME="indentNextLines" > > > > VALUE="[a-zA-Z]\w*\s*=[\.:]\s*([0-4]|13)\s+:\s+0.*$|^\s*(select|try)\..*$|^.*\bdo\.\s*($|NB\..*$)"/> > > <PROPERTY NAME="unindentNextLines" > > > > VALUE="^\s*\)\s*($|NB.)|^\s*end\.\s*($|NB\..*$)|^\s*(elseif|f?case)\..*\bdo\.\s*($|NB\..*$)"/> > > <PROPERTY NAME="unindentThisLine" > > > > VALUE="^\s*\)\s*($|NB.)|^\s*end\.\s*($|NB\..*$)|^\s*(catch[dt]?|else|elseif|f?case)\..*($|NB\..*$)"/> > > <PROPERTY NAME="electricKeys" VALUE=")."/> > > > > <PROPERTY NAME="doubleBracketIndent" VALUE="false" /> > > <PROPERTY NAME="lineUpClosingBracket" VALUE="true" /> > > <!-- End Auto Indent --> > > </PROPS> > > <RULES IGNORE_CASE="FALSE"> > > <!-- Comments --> > > <EOL_SPAN TYPE="COMMENT1" AT_LINE_START="FALSE" > > AT_WORD_START="TRUE" > > AT_WHITESPACE_END="FALSE">NB.</EOL_SPAN> > > > > <!-- String Literals --> > > <SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE"> > > <BEGIN>'</BEGIN> > > <END>'</END> > > </SPAN> > > <!-- Copula --> > > <SEQ_REGEXP TYPE="LABEL">=[\.:]</SEQ_REGEXP> > > <!-- Show assignments as BOLD --> > > <SEQ_REGEXP TYPE="OPERATOR" > > AT_WORD_START="TRUE">[a-zA-Z]\w*(?=\s*=[\.:]\s*)</SEQ_REGEXP> > > <!-- Highlight explict definitions --> > > <SEQ_REGEXP TYPE="INVALID" > > AT_WORD_START="TRUE">([0-4]|13)\s+:\s*(0|.*?($|(?=\s*\bNB\.)))</SEQ_REGEXP> > > <!-- Control --> > > <SEQ_REGEXP TYPE="KEYWORD1" > > AT_WORD_START="TRUE">(assert|break|f?case|catch[dt]?|continue|do|else(if)?)\.</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD1" > > AT_WORD_START="TRUE">(end|for|if|return|select|throw|try|whil(e|st))\.</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD1" > > AT_WORD_START="TRUE">(for|goto|label)_[a-zA-Z]\w*\.</SEQ_REGEXP> > > <!-- Keywords --> > > <SEQ_REGEXP TYPE="MARKUP" > > AT_WORD_START="TRUE">(require|loadd?|scriptd?|jpath|jcwdpath|jhostpath|jsystemdefs)</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="MARKUP" > > AT_WORD_START="TRUE">co(class|create|current|destroy|erase|extend|fullname)</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="MARKUP" > > AT_WORD_START="TRUE">co(insert|names?|new|nl|path|reset)</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="MARKUP" > > AT_WORD_START="TRUE">(type|names|nameclass|nc|namelist|nl|erase|assert)</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="MARKUP" > > AT_WORD_START="TRUE">(getenv|setenv|exit|stdout|stdin|stderr|define|def)</SEQ_REGEXP> > > <!-- Constants --> > > <SEQ_REGEXP TYPE="COMMENT2" > > AT_WORD_START="TRUE">(CRLF|CR|LF|TAB|DEL|FF|noun|adverb|conjunction|verb|monad|dyad)\b</SEQ_REGEXP> > > <!-- Name (>1 char) --> > > <SEQ_REGEXP TYPE="NULL" > > AT_WORD_START="TRUE">[a-zA-Z]\w+</SEQ_REGEXP> > > <!-- Noun --> > > <SEQ_REGEXP TYPE="LITERAL2">a[\.:]</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="LITERAL2">_\.</SEQ_REGEXP> > > <!-- Conjunctions (2 char)--> > > <SEQ_REGEXP TYPE="KEYWORD2">[!&@;:\.]\.</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD2">[!&@^\.:]:</SEQ_REGEXP> > > <!-- Adverbs (2 char)--> > > <SEQ_REGEXP TYPE="KEYWORD4">[/\\]\.</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD4">[bfMt]\.</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD4">t:</SEQ_REGEXP> > > <!-- Verbs --> > > <SEQ_REGEXP TYPE="COMMENT3">\{::</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="COMMENT3">p\.\.</SEQ_REGEXP> > > <SEQ_REGEXP > > TYPE="COMMENT3">[-\"#\$%\*+,<>\?^{|}~]\.</SEQ_REGEXP> > > <SEQ_REGEXP > > TYPE="COMMENT3">[-\"#\$%\*+,;<>\?\[{|}~/\\]:</SEQ_REGEXP> > > <SEQ_REGEXP > > TYPE="COMMENT3">[-!#$%\*+,;<=>\?\[\]^{|]</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="COMMENT3">(_?\d|_):</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="COMMENT3">[AcCeEiIjLopr]\.</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="COMMENT3">[ipqsux]:</SEQ_REGEXP> > > <!-- Conjunctions --> > > <SEQ_REGEXP TYPE="KEYWORD2">&\.:</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD2">[dDHT]\.</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD2">[DLS]:</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD2">[\"&@`]</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD2">:</SEQ_REGEXP> > > <SEQ_REGEXP TYPE="KEYWORD2">\.</SEQ_REGEXP> > > <!-- Adverbs ( char)--> > > <SEQ_REGEXP TYPE="KEYWORD4">[/\\}~]</SEQ_REGEXP> > > <!-- Argument --> > > <SEQ_REGEXP TYPE="KEYWORD3" > > AT_WORD_START="TRUE">[xymnuv]\.?\b</SEQ_REGEXP> > > <!-- Number --> > > <SEQ_REGEXP TYPE="DIGIT" > > AT_WORD_START="TRUE">[_0-9][_0-9\.a-zA-Z]*</SEQ_REGEXP> > > <!-- Parenthesis --> > > <SEQ_REGEXP TYPE="INVALID">[()]</SEQ_REGEXP> > > <!-- Name (1 char) --> > > <SEQ_REGEXP TYPE="OPERATOR" > > AT_WORD_START="TRUE">([A-Z]|[abcdefghijklopqrstwz])</SEQ_REGEXP> > > > > </RULES> > > </MODE> > > <!-- Put the following in an ijs file to test the syntax highlighting. > > jVerb > > = < <. <: > >. >: _: + +. +: * *. *: - -. -: % %. %: ^ ^. $ $. $: ~. ~: | > > |. |: > > , ,. ,: ; ;: # #. #: ! /: \: [ [: ] { {. {: {:: }. }: ". ": ? ?. > > A. c. C. e. E. i. i: I. j. L. o. p. p: q: r. s: u: x: > > _9: _8: _7: _6: _5: _4: _3: _2: _1: 0: 1: 2: 3: 4: 5: 6: 7: 8: 9: > > > > jNoun > > a. a: _. > > > > jKeywords > > require load loadd script scriptd jpath jcwdpath jhostpath jsystemdefs > > coclass cocreate cocurrent codestroy coerase coextend cofullname > > coinsert coname conames conew conl copath coreset > > type names nameclass nc namelist nl erase assert > > getenv setenv exit stdout stdin stderr def define > > > > jConstants > > CRLF CR LF TAB DEL FF noun adverb conjunction verb monad dyad > > > > jConjuction > > ^: . .. .: : :. :: ;. !. !: " ` `: @ @. @: & &. &: &.: d. D. D: H. L: S: T. > > > > jAdverb > > ~ / \ /. \. } b. f. M. t. t: > > > > jArguments > > x y m n u v x. y. m. n. u. v. > > > > jKeywords > > assert. break. case. catch. catchd. catcht. continue. do. else. elseif. > > end. fcase. > > for. for_xyz. goto_abc. if. label_abc. return. select. throw. try. while. > > whilst. > > > > Parenthesis > > ( ) > > > > jComment > > NB. This is a comment. > > > > jLiteral > > 'This is quoted text' > > > > jNumbers > > 123 56.88 _99.9 7e6 _ __ 200j_200 2b111.111 1r2 > > > > jAssignment > > xyz=. abc=: > > > > jExplicit Definition > > 0 : 0 1 : 0 2 : 0 3 : 0 4 : 0 > > 4 : 'x + y' > > --> > > ----stop copy at the line above---------------- > > > > > > > > > > _________________________________________________ > > > > This message is for the designated recipient only and may contain > > privileged, proprietary > > or otherwise private information. If you have received it in error, please > > notify the sender > > immediately and delete the original. Any other use of the email by you is > > prohibited. > > > > Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - > > Norsk - Portuguese > > Svenska: www.carefusion.com/legal/email > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > -- > regards, > ==================================================== > GPG key 1024D/4434BAB3 2008-08-24 > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > _________________________________________________ > > This message is for the designated recipient only and may contain privileged, > proprietary > or otherwise private information. If you have received it in error, please > notify the sender > immediately and delete the original. Any other use of the email by you is > prohibited. > > Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - > Norsk - Portuguese > Svenska: www.carefusion.com/legal/email > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm -- regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
