Closed oovm closed 2 years ago
How about support @position for all rule?
@position
The current string char and enum cannot mark positions.
For enum, just call position directly on all variants, the rust compiler will prompt which variants do not mark the position and report an error.
For string/char, position is also necessary, I want to report which escaped char fails and which identifier is undefined with position.
The hacking I am currently using is
@position Identifier = identifier:IDENTIFIER; @string @no_skip_ws IDENTIFIER = (XID_START | '_') {XID_CONTINUE};
But I think I can generate the Identifier directly
@position @string @no_skip_ws Identifier = (XID_START | '_') {XID_CONTINUE};
Leads to
pub struct Identifier { pub string: String, pub position: Range<usize> }
Sounds like a good idea, I'll see what I can do.
(Except for @char, those rules are meant to be special and very lightweight)
@char
How about support
@position
for all rule?The current string char and enum cannot mark positions.
For enum, just call position directly on all variants, the rust compiler will prompt which variants do not mark the position and report an error.
For string/char, position is also necessary, I want to report which escaped char fails and which identifier is undefined with position.
The hacking I am currently using is
But I think I can generate the Identifier directly
Leads to