dgkf / R

An experimental reimagining of R
https://dgkf.github.io/R
GNU General Public License v3.0
136 stars 5 forks source link

It should not be possible to use keywords as identifiers #217

Open sebffischer opened 1 month ago

sebffischer commented 1 month ago

The following code runs, but should not.

function = 1
fn = 1
if = 1

I believe the best way to fix this is to just encode this in the grammar. I.e. exclude the keywords from being an identifier: https://github.com/dgkf/R/blob/5c13c4950991c821aa5fd2255751d3eabc3316a1/src/grammar/grammar.pest#L189-L192

We have to pay attention to the localizations.