Make StringLiteral and NumberLiteral parameterized types to allow making it configurable whether to save the raw source. Probably something like
struct StringLiteral<T: Display, StringLiteralParser> {
pub source: T,
pub value: String
}
where StringLiteralParser is a custom trait that modularizes the parsing logic for string literals. This lets you construct a parser at compile time with the literal parsing logic you want.
Make
StringLiteralandNumberLiteralparameterized types to allow making it configurable whether to save the raw source. Probably something likewhere
StringLiteralParseris a custom trait that modularizes the parsing logic for string literals. This lets you construct a parser at compile time with the literal parsing logic you want.