I am using Pest.rs for parsing. I need to parse identifiers but reject them if they happen to be a reserved keyword. For example, bat
is a valid identifier name but this
is not since that has a specific meaning. My simplified grammar is as below.
keyword = {"this" | "function"}
identifier = {ASCII+}
valid_identifier = { !keyword ~ identifier }
This works but it also rejects identifier names like thisBat
. So basically it checks if that the prefix is not a keyword
, but I want to check against the full identifier
.