Details
- Reviewers
rriddle nicolasvasilache makslevental
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
My mistake. I thought that parseKeyword only included reserved words as defined by TOK_KEYWORD, but it includes bare identifiers as well. I'll make sure that works for my needs and then abandon this patch if so.
Yeah, likely chose the wrong name a long time ago, but there is a separation between the lexer and what's exposed in the public API (we try not to expose many "lexer" specific things, like what is a keyword or bare identifier -> they are all keywords)
Ah yes, now I see why parseKeyword isn't sufficient. I would like to have the bare_identifier be arbitrary, similar to how AffineMap allows for an arbitrary variable name.
The use case is for a polynomial dialect. I would like to have an attribute polynomial like #poly.polynomial<1 + x**1024> (note I can't use caret for the exponentiation op because it's handled specially in the lexer), but without requiring the specific variable name x. I suppose that not forcing the user to use x is a nice-to-have, but that's the discrepancy here.
What do you mean by arbitrary? There are several overloads, one takes a StringRef (i.e. an expected keyword), and one takes a StringRef * that parses any keyword.
one takes a StringRef * that parses any keyword.
That was the trick, thanks! Abandoning this revision