ropensci / bibtex

bibtex parser for R
https://docs.ropensci.org/bibtex/
36 stars 12 forks source link

Support reading from arbitrary connections. #1

Open romainfrancois opened 10 years ago

romainfrancois commented 10 years ago

From an email exchange with Kurt:

romain writes:

Le 2013-07-29 21:06, Kurt Hornik a écrit :

Romain Francois writes:

Hello, I've seen that you've released a new version of bibtex. Thanks and oops for the missing fclose.

Sure---was reported by someone on Windows who could not file.remove the .bib he had just read in ...

There was a tweet from Gavin Simpson: https://twitter.com/ucfagls/status/360621762578354176

" Anyone aware of a bibtex parser for #rstats that doesn't need to read from files? Looking to parse strings pulled from a web API "

I guess it would not be too hard to give read.bib the ability to read from a character vector rather than from a file. I might have a go at this.

Great. Ideally, this would work from arbitrary connections

Best -k

Maybe I need a fresh look at connections, but last time I tried to use them in C(++), I could not find an api.

Some is exposed via R_ext/Connections.h (with a note that code should test for R_CONNECTIONS_VERSION).

(Seems that this is currently not used in any CRAN package ...)

Best -k

One way is to call back an R function to get some more characters to feed in to the lexer, but this would not be very efficient.

Romain