MLton

GNU Enscript converts ASCII files to PostScript, HTML, and other output languages, applying language sensitive highlighting (similar to Emacs’s font lock mode). Here are a few states files for highlighting Standard ML.

  • sml_simple.st — Provides highlighting of keywords, string and character constants, and (nested) comments.

  • sml_verbose.st — Supersedes the above, adding highlighting of numeric constants. Due to the limited parsing available, numeric record labels are highlighted as numeric constants, in all contexts. Likewise, a binding precedence separated from infix or infixr by a newline is highlighted as a numeric constant and a numeric record label selector separated from # by a newline is highlighted as a numeric constant.

  • sml_fancy.st — Supersedes the above, adding highlighting of type and constructor bindings, highlighting of explicit binding of type variables at val and fun declarations, and separate highlighting of core and modules level keywords. Due to the limited parsing available, it is assumed that the input is a syntactically correct, top-level declaration.

  • sml_gaudy.st — Supersedes the above, adding highlighting of type annotations, in both expressions and signatures. Due to the limited parsing available, it is assumed that the input is a syntactically correct, top-level declaration.

Install and use

  • Version 1.6.3 of GNU Enscript

    • Copy all files to /usr/share/enscript/hl/ or .enscript/ in your home directory.

    • Invoke enscript with --highlight=sml_simple (or --highlight=sml_verbose or --highlight=sml_fancy or --highlight=sml_gaudy).

  • Version 1.6.1 of GNU Enscript

    • Append sml_all.st to /usr/share/enscript/enscript.st

    • Invoke enscript with --pretty-print=sml_simple (or --pretty-print=sml_verbose or --pretty-print=sml_fancy or --pretty-print=sml_gaudy).

Feedback

Comments and suggestions should be directed to MatthewFluet.