Here the Initial part is used in both Identifier and Subsequent. As far as I understand, currently the only way to do this in plex's lexer! is by duplicating Initial part, something like:
In the simplified example above the repetition of [a-z] is not too bad, but in the actual use case the syntax is much more complex and the repetition is a real problem.
Ideally I should be able to give this regex [a-z] a name and use it in other regex patterns. Maybe something like:
lexer! {
...
let initial = "[a-z]"
let subsequent = "..."
r"$initial($initial|[$subsequent])*" => ...
}
Is this currently possible with plex? If not I think this would be a useful addition to it.
Suppose I have this lexical syntax for a token:
Here the
Initial
part is used in bothIdentifier
andSubsequent
. As far as I understand, currently the only way to do this in plex'slexer!
is by duplicatingInitial
part, something like:In the simplified example above the repetition of
[a-z]
is not too bad, but in the actual use case the syntax is much more complex and the repetition is a real problem.Ideally I should be able to give this regex
[a-z]
a name and use it in other regex patterns. Maybe something like:Is this currently possible with plex? If not I think this would be a useful addition to it.