diff options
author | James Estevez <je@odnv.org> | 2014-02-16 23:10:29 -0800 |
---|---|---|
committer | James Estevez <je@odnv.org> | 2014-02-16 23:10:29 -0800 |
commit | ffe5d8b8d391dcff65d9b76d0dd510173485f2a1 (patch) | |
tree | 973c81b159c17b3f2093859a5b3298b4cb29ae05 /tests | |
parent | 76830a64b219cc2fd76b7ae7de12b717375a6793 (diff) | |
download | pygments-ffe5d8b8d391dcff65d9b76d0dd510173485f2a1.tar.gz |
Issue #412: Add built-in functions to SLexer
The R lexer does not recognize:
- any built-in functions,
- any data structures,
- all built-in constants,
- exponents on floating points with decimals, but no mantissa
This update to `math.py` adds a list of only those functions contained
within `package:base`, output from R with via the `builtins(TRUE)`
function. Keywords for Keyword.Constant, Keyword.Namespace, and
Keyword.Type were manually subsetted from the resulting list. This is
the approach used by the Mathematica and Numpy lexers.
The update to `test.R` adds a sample of the builtin functions, data
structures, and namespace functions, along with an example of a floating
point with a decimal, but no fractional part.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examplefiles/test.R | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/tests/examplefiles/test.R b/tests/examplefiles/test.R index 54325339..1dd8f64b 100644 --- a/tests/examplefiles/test.R +++ b/tests/examplefiles/test.R @@ -33,10 +33,11 @@ NA_foo_ <- NULL 123456.78901 123e3 123E3 -1.23e-3 -1.23e3 -1.23e-3 -## integer constants +6.02e23 +1.6e-35 +1.E12 +.1234 +## integers 123L 1.23L ## imaginary numbers @@ -80,7 +81,7 @@ repeat {1+1} ## Switch x <- 3 switch(x, 2+2, mean(1:10), rnorm(5)) -## Function, dot-dot-dot, return +## Function, dot-dot-dot, return, sum foo <- function(...) { return(sum(...)) } @@ -151,3 +152,34 @@ world!' ## Backtick strings `foo123 +!"bar'baz` <- 2 + 2 + +## Builtin funcitons +file.create() +gamma() +grep() +paste() +rbind() +rownames() +R.Version() +R.version.string() +sample() +sapply() +save.image() +seq() +setwd() +sin() + +## Data structures +servo <- matrix(1:25, nrow = 5) +numeric() +vector(servo) +data.frame() +list1 <- list(time = 1:40) +# multidimensional array +array(c(c(c(2,300,4),c(8,9,0)),c(c(5,60,0),c(66,7,847))), dim=c(3,2,2)) + +## Namespace +library(ggplot2) +require(plyr) +attach(cars) +source("test.R") |