##! # Generates EmEditor syntax files for R language according to the current system # # Usage: # emeditor_syntax_file("R.esy") # # @varsion 1.0 # @date 2010-08-03 # @author Masashi Nakanishi # @license GPL2 # @param file a connection, or a character string naming the file, to be passed to cat(). # @param exact logical. If TRUE predefined symbols are exactly identified (using regular expression) but the EmEditor may became too heavy. # @param color a vector of integer (length 4) indicating the colors in highlighting on EmEditor emeditor_syntax_file <- function(file, exact=TRUE, color=c(3L,4L,5L,6L)) { append <- is.character(file) & (nchar(file) > 0) cat(c( "; EmEditor syntax file for R language", ";", "; This file is automatically generated with the script", "; written by Masashi N. 2010-08-03", ";", "#Highlight=on", "#BeginTag=", "#EndTag=", "#CommentBegin=", "#CommentEnd=", "#LineComment1=#", "#LineComment2=", "#SingleQuote=on", "#DoubleQuote=on", "#ContinueQuote=on", "#Escape=\\", "#ScriptBegin=", "#ScriptEnd=", "#SpecialSyntax=off", "#HighlightBraces=on", "", paste("#Keyword color=", color[1], ",word=", ifelse(exact, "off", "on"), ",rightall=off,case=on,insidetag=off,regexp=", ifelse(exact, "on", "off"), ",rightall2=off", sep="") ), file=file, sep="\n") output_symbols_in_package <- function(env) { syms <- ls(env, all.names=TRUE) syms <- syms[grep("^\\.?[a-zA-Z\\.][a-zA-Z0-9\\.]*$", syms)] if (exact) { syms <- gsub("\\.", "\\\\\\.", syms) syms <- paste("(?