Choose Highlighting options for GeSHi support

The GeSHi Syntax-highlighter provides the syntax highlighting on Rosetta Code and now supports J.

There are a couple of J features that GeSHi doesn’t currently handle well and the options for handling them each have their pros and cons. One of those features is the control word construct controlword_myjvarname. . For example for_i. or goto_myname. .

The maintainer of GeSHi suggested I should seek guidance from the J community as to which of the following two methods fits best with J and best meets our needs. If you have a preference for one of the two methods please register it either here or on the forum. (Method B is currently being used on Rosetta Code).

Method A

Control keywords specified in the KEYWORDS[1] section of the J GeSHi file as in J Dictionary except for_varname. which is handled as special case using REGEXPS

Method B

Control keywords specified in the KEYWORDS[1] section of the J GeSHi file without a trailing fullstop. Use PARSER_CONTROL regex to specify that KEYWORDS[1] must have a trailing fullstop, or in the case of "for" a trailing fullstop or a trailing underscore followed by a valid name and a full stop.

Method A

Method B

option_a.png

option_b.png

Comments

I vote for Method A. The period is part of the word. Henry Rich


I have a strong preference for Method A. If any technique is devised to highlight variable names that result from extended keywords, it should not break the coloration of the entire keyword from first character through final inflection. -- Tracy Harms


I like Method B better, except for the cautions indicated (trailing dot not highlighted, etc). The ideal for me would be a hybrid, where for_ and the trailing . were one style (maybe bold), and the pronoun was another (maybe italic?). The reason is that the pronoun is "something different" from the rest of the control word, but is still part and parcel of the control word. Of course, in the cases of goto_xyz. and label_xyz. the xyz isn't a pronoun (or even a J name), so that's another degree of inconsistency and argues for Method A (where everything is treated equally).

-- DanBron 2010-02-19 15:15:19


My vote is for Method A. Control words are just inflected names and as such are just a class of primitives. "A primary may also be an inflected name" (dict1). The inflection is part of the word for primitives so Control words shouldn't be treated differently from other primitives. I have some sympathy for the idea of highlighting the variable name separately but for me the other concerns take precedence. -- RicSherlock 2010-02-20 00:07:04

Guides/Syntax Coloring/GeSHi Options (last edited 2010-02-20 00:07:04 by RicSherlock)