Learn R Programming

R.utils (version 2.12.2)

SmartComments: Abstract class SmartComments

Description

Package: R.utils
Class SmartComments

Object
~~|
~~+--SmartComments

Directly known subclasses:
LComments, VComments

public abstract static class SmartComments
extends Object

Abstract class SmartComments.

Usage

SmartComments(letter=NA, ...)

Arguments

letter

A single character.

...

Not used.

Fields and Methods

Methods:

compilePreprocess a vector of code lines.
convertCommentConverts a single smart comment to R code.
parseParses one single smart comment.
resetResets a SmartComments compiler.
validateValidates the compiled lines.

Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

Author

Henrik Bengtsson

Details

A "smart" source-code comment is an R comment, which start with a '#', but is followed by a single letter, then a single symbol and a second '#' and then an option character string, and there must not be any code before the comment on the same line. In summary, a smart comment line has format: <white spaces>#<letter><symbol># <some text>.

Example code with two smart comments (VComments):


   x <- 2
   #V1# threshold=-1
   #Vc# A v-comment log message
   cat("Hello world")
 

which after compilation becomes


   x <- 2
   verbose <- Verbose(threshold=-1)
   if (verbose) { cat(verbose, "A v-comment log message"); }
   cat("Hello world")
 

See Also

VComments.