r-lib/tree-sitter-r

`$` and `@` should not allow arbitrary expressions on the RHS

DavisVaughan opened this issue · 1 comments

Only strings and symbols
https://github.com/wch/r-source/blob/36008873fb8ca2af3bdaaff418dbade5f7bce118/src/main/gram.y#L512-L515

foo${hi}

gives

(program ($ lhs: (identifier) rhs: ({ body: (identifier))))

but really that should probably error

Having arbitrary expressions was the easiest way to support foo$bar$baz or foo$bar()$baz[[1]]$bam, but it still might be worth clamping those down a bit.