[Rd] detect ->
g@bembecker @end|ng |rom gm@||@com
Mon Apr 13 10:23:21 CEST 2020
Indeed, this has come up in a few places, but as Gabor says, there is no
such thing as right hand assignment at any point after parsing is complete.
This means the only feasible way to detect it, which a few projects do I
believe, is process the code while it is still raw text, before it goes
into the parser, and have clever enough regular expressions.
The next question, then, is why are you trying to detect right assignment.
Doing so can be arguably useful fo linting, its true. Otherwise, though,
because its not really a "real thing" when the R code is being executed,
its not something thats generally meaningful to detect in most cases.
On Mon, Apr 13, 2020 at 12:52 AM Gábor Csárdi <csardi.gabor using gmail.com>
> That parser already flips -> to <- before creating the parse tree.
> On Mon, Apr 13, 2020 at 8:39 AM Adrian Dușa <dusa.adrian using gmail.com> wrote:
> > I searched and tried for hours, to no avail although it looks simple.
> > (function(x) substitute(x))(A <- B)
> > #A <- B
> > (function(x) substitute(x))(A -> B)
> > # B <- A
> > In the first example, A occurs on the LHS, but in the second example A
> is somehow evaluated as if it occured on the RHS, despite my understanding
> that substitute() returns the unevaluated parse tree.
> > Is there any way, or is it even possible to detect the right hand
> assignment, to determine whether A occurs on the LHS?
> > Thanks in advance for any hint,
> > Adrian
> > —
> > Adrian Dusa
> > University of Bucharest
> > Romanian Social Data Archive
> > Soseaua Panduri nr. 90-92
> > 050663 Bucharest sector 5
> > Romania
> > https://adriandusa.eu
> > ______________________________________________
> > R-devel using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> R-devel using r-project.org mailing list
[[alternative HTML version deleted]]
More information about the R-devel