Outlang for S-expressions
Dario Teixeira <[email protected]> Sun, 1 Jun 2014 03:08:20 -0700 (PDT)
| Newsgroups | gmane.comp.gnu.source-highlight.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, I'm the developer of Camlhighlight [1], a small library that uses GNU Source-highlight to provide syntax highlighting facilities for Ocsigen applications.=A0 (Ocsigen is a web programming framework for the OCaml language [2,3]). The method I'm using to parse Source-highlight's output is a bit of a hack, but it's simple and it works perfectly.=A0 Essentially, I've defined a new outlang that outputs S-expressions (as in LISP), which are trivial to convert into OCaml data structures.=A0 However, this approach requires that users install the new outlang file into their /usr/share/source-highlight directory (perhaps Source-highlight also supports a home-local installation -- I haven't checked). Anyway, since this approach is generic enough and may be useful to other libraries/applications that rely on Source-highlight, would it possible for the S-expression outlang to ship with the library by default?=A0 It's contents are really trivial, requiring only special care to escape the backslash and the double commas: =3D=3D=3D=3D=3D=3D sexp.outlang =3D=3D=3D=3D=3D=3D onestyle "($style \"$text\")" translations "\\"=A0=A0=A0 "\\\\" "\""=A0=A0=A0 "\\\"" end =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D What do you think? Thanks in advance for your time! Kind regards, Dario Teixeira [1] http://camlhighlight.forge.ocamlcore.org/ [2] http://ocsigen.org/ [3] http://ocaml.org/