Rosetta Code:Village Pump/Syntax highlighting: Difference between revisions

Content added Content deleted
(→‎Language tags: SML uses OCaml?)
Line 272: Line 272:
<lang list></lang>
<lang list></lang>
</div>
</div>

== OCaml for Standard ML? ==

It has been suggested to use the OCaml syntax highlighting for Standard ML, and some SML code has been changed to OCaml highlighting already. While the languages are similar, they have many differences in keywords and stuff, and I feel that Standard ML should have a separate highlighting scheme. For example, SML has "datatype" keyword and OCaml does not; logical operators are "andalso" and "orelse" instead of "&&" and "||"; pattern matching is "case ... of" instead of "match ... with"; the "fn" keyword; and lots of other stuff. If I have time I could try to translate the OCaml GeSHi language file into SML; but I am reluctant to do so as I do not own a copy of the Definition of Standard ML, and so I am not confident I will get everything. --[[Special:Contributions/76.91.63.71|76.91.63.71]] 08:22, 19 July 2009 (UTC)

:Sounds reasonable. Grepping around, I find that the list of keywords is this:
::<code>and abstype as case datatype else end eqtype exception do fn fun functor funsig handle if in include infix infixr lazy let local nonfix of op open overload raise rec sharing sig signature struct structure then type val where while with withtype orelse andalso</code>
:This list was extracted directly from the lexer's keyword table in the source to the SML/NJ implementation, so it should be complete and accurate. I've not categorized their meaning at all. —[[User:Dkf|Donal Fellows]] 13:46, 19 July 2009 (UTC)