Hi,

enclosed is an enscript states file for R scripts.

regards,
Thomas

Peter Dalgaard schrieb:
Dirk Eddelbuettel wrote:
On 15 July 2008 at 17:23, hadley wickham wrote:
| An alternative to enscript is highlight,
| http://www.andre-simon.de/doku/highlight/en/highlight.html, which does
| come with R highlighting built in.

Another alternative is GNU a2ps which has definitions for R source,
documentation and transcripts.  As it says the bottom of the page at
http://cran.r-project.org/other-software.html (with links)

GNU a2ps is a fairly versatile text-to-anything processor, useful for
       typsetting source code from a wide variety of programming
languages. s.ssh, rd.ssh and st.ssh are a2ps style sheets for S code, Rd documentation format, and S transscripts, respectively. (These will
       be included in the next a2ps release.)

and indeed, these files have been part of a2ps' upstream releases for a long time.

Dirk
Unfortunately, a2ps doesn't support Unicode (and afaics u2ps does not do indentation...).

--
Thomas Liebig
Fraunhofer-Institut für Intelligente Analyse- und
Informationssysteme (IAIS)

Schloss Birlinghoven, D-53754 Sankt Augustin, Germany
Email:  thomas.lie...@iais.fraunhofer.de
Phone:  +49 2241 142050
Fax:    +49 2241 142072

/**
 * Name: r
 * Description: CRAN-R programming language.
 * Author: Thomas Liebig <thomas.lie...@iais.fraunhofer.de>
 */

state r extends HighlightEntry
{
  /* Comments. */
  /#/ {
    comment_face (true);
    language_print ($0);
    call (eat_one_line);
    comment_face (false);
  }

  /* String constants. */
  /\"/ {
    string_face (true);
    language_print ($0);
    call (c_string);
    string_face (false);
  }

  /* Keywords. */
  
/\b(break|next|re(turn|peat)|i(n|f)|else|for|requires|while|LETTERS|l(ibrary|etters)|pi|NULL|FALSE|TRUE|NULL|NA)\b/
 {
    keyword_face (true);
    language_print ($0);
    keyword_face (false);
  }

  /* Types. */
  
/\b(character|rType|array|complex|double|function|integer|list|logical|matrix|numeric|vector|data.frame)\b/
 {
    type_face (true);
    language_print ($0);
    type_face (false);
  }

  /* Delimiter. */
  /(,|;|:|\(|\))/ {
    keyword_face (true);
    language_print ($0);
    keyword_face (false);
  }

}


/*
Local variables:
mode: c
End:
*/
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to