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

Content added Content deleted
Line 502: Line 502:
* Modules that are not part of the standard library are not colorised, ''IMHO'' this is not very uniform and relevant. In editors with ocaml syntax-highlight, all modules are highlighted. (modules from the standard lib have a link to the doc, please keep this feature)
* Modules that are not part of the standard library are not colorised, ''IMHO'' this is not very uniform and relevant. In editors with ocaml syntax-highlight, all modules are highlighted. (modules from the standard lib have a link to the doc, please keep this feature)
** (identifiers (identifiers to values (often called variables) and identifiers to functions) have the first letter lower case or an underscore)
** (identifiers (identifiers to values (often called variables) and identifiers to functions) have the first letter lower case or an underscore)
** module names and constructors start with an upper-case letter (they are capitalised)
** a name that starts with an upper-case letter is a module name or a constructor (they are capitalised)
<blockquote>
<blockquote>
we can make the difference between a module name and a constructor when it's followed by a dot it's a module name (maybe I'm wrong, but I can't find an example of a constructor followed by a dot)
we can make the difference between a module name and a constructor when it's followed by a dot it's a module name (maybe I'm wrong, but I can't find an example of a constructor followed by a dot)
<lang ocaml>Unix.sleep (* module *)
<lang ocaml>Unix.sleep (* module *)
Some "text" (* a constructor *)</lang>
Some "text" (* a constructor *)</lang>
when there is no dot after it but the keyword <code>open</code> before it, it is a module name:
<lang ocaml>open Unix</lang>
we can also open a submodule:
<lang ocaml>open ExtString.String (* both modules ExtString and String should have the same color *)</lang>
there can be any depth:
<lang ocaml>open M1.M2.M3.M4.M5.M6.M7.M8</lang>
</blockquote>
</blockquote>