nix-community / rnix-parser

A Nix parser written in Rust [maintainer=@oberblastmeister]
MIT License
364 stars 44 forks source link

Allow `TOKEN_OR` when expecting identifier #128

Closed darichey closed 2 years ago

darichey commented 2 years ago

Summary & Motivation

When expecting an identifier in expect_ident, allow either TOKEN_IDENT OR TOKEN_OR.

Also adds a getter for the token in the typed Ident.

Further context

Fixes #127

oberblastmeister commented 2 years ago

This is a good catch! It's not totally correct however, as this allows or by itself to be parsed as an expression. You shouldn't change expect_ident. You can instead inline it into parse_attr and add another case for TOKEN_OR.

darichey commented 2 years ago

Oh right, oops! Fixed