Create a parser for variables. If we wanted to parse type variables in Elm, we could try something like this:
const typeVar: P.Parser<string> = P.variable({ start: Helpers.isLower, inner: (c: string) => Helpers.isAlphaNum(c) || c === "_", reserved: new Set(["let", "in", "case", "of"]),});
This is saying it must start with a lower-case character. After that, characters can be letters, numbers, or underscores. It is also saying that if you run into any of these reserved names, it is definitely not a variable.
Create a parser for variables. If we wanted to parse type variables in Elm, we could try something like this:
This is saying it must start with a lower-case character. After that, characters can be letters, numbers, or underscores. It is also saying that if you run into any of these reserved names, it is definitely not a variable.