PGE/Util.pir - useful rules for working with PGE grammars
This module defines a number of useful rules for various parsing tasks using PGE.
Throws an exception at the current point in the match. If message doesn't end with a newline, also produces the line number and offset of the match.
Emits the list of messages to stderr.
Return the line number and offset of the of the line corresponding to offset
pos in the string targeted by
pos isn't supplied,
then use the
from value of
match as the offset.
For this function the line number for the first line in the string is treated as '0'.
Split the string where the regex matches, returning an array. Optionally limit the number of splits.
Returns a unique integer on every call.
Returns a PIR string for a given string contents.
NOTE: this does NOT securely escape strings.
Constructs a PIR key using the strings passed as arguments.