SCM

[#845] highlight function fails

Date:
2010-03-16 12:12
Priority:
3
State:
Open
Submitted by:
Richard Cotton (richierocks)
Assigned to:
Nobody (None)
Hardware:
None
Product:
None
Operating System:
Windows XP
Component:
None
Version:
None
Severity:
major
Resolution:
None
URL:
Summary:
highlight function fails

Detailed description
The highlight function throws an error from the external code.

To reproduce:

Create a file named, for instance "test.r", containing the following.

x <- 1:10 (plus a newline)

Load the highlight package, then call highlight on the file with

highlight(file="test.r", detective=simple_detective, renderer=renderer_html(document = TRUE))

This fails with the error

Error in highlight(file = "test.r", detective = simple_detective, renderer = renderer_html(document = TRUE)) :
type 31 is unimplemented in 'type2char'

where type2char can be found in the file src/main/util.c in R's source.

Using options(error=recover) to retrieve the values being passed to get_highlighted_text gives

Browse[1]> data
line1 col1 byte1 line2 col2 byte2 token id parent top_level token.desc
terminal text ftokens
1 1 0 0 1 1 1 263 1 4 0 SYMBOL TRUE x <span class="symbol">x</span>
2 1 2 2 1 4 4 265 3 13 0 LEFT_ASSIGN TRUE <- <span class="assignement"><-</span>
4 1 5 5 1 6 6 261 6 7 0 NUM_CONST TRUE 1 <span class="number">1</span>
6 1 6 6 1 7 7 58 8 12 0 ':' TRUE : <span class="keyword">:</span>
7 1 7 7 1 9 9 261 9 10 0 NUM_CONST TRUE 10 <span class="number">10</span>

Browse[1]> startline
[1] 1

Browse[1]> renderer$space()
[1] " "

Browse[1]> renderer$newline()
[1] "\n"

Browse[1]> showPrompts
[1] FALSE

Browse[1]> initial.spaces
[1] TRUE

I also tried using renderer_verbatim, and using different test files, but I got the same error.

Here is the output from sessionInfo()
R version 2.10.1 (2009-12-14)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] highlight_0.1-7 Rcpp_0.7.9 parser_0.0-9 codetools_0.2-2

Comments:

No Comments Have Been Posted

Attached Files:

Changes

No Changes Have Been Made to This Item

Thanks to:
Vienna University of Economics and Business Powered By FusionForge