The idea is that you create a bunch of chompers that validate the underlying
characters. Then getChompedString extracts the underlying String efficiently.
Note: Maybe it is helpful to see how you can use getOffset
and getSource to implement this function:
Sometimes parsers like
int
orvariable
cannot do exactly what you need. The "chomping" family of functions is meant for that case!Remarks
Maybe you need to parse valid PHP variables like
$x
and$txt
:The idea is that you create a bunch of chompers that validate the underlying characters. Then
getChompedString
extracts the underlyingString
efficiently.Note: Maybe it is helpful to see how you can use getOffset and getSource to implement this function: