Documentation ¶
Overview ¶
Package rangeutil provides services for conversion and iteration of range specifications for use with iNamik/go_lexer
Currently, a 'range specifiction' is defined as a string of unicode characters, with the ability to specify a range of chararacters by using a '-' between two characters. Think of it as a simplified version of standard regex bracket expression.
Here are some examples:
Digit "0123456789" // With no range specifiers Digit "0-9" // With range specifiers Hex Digit "0-9a-zA-F" // Allowing for upper and lower case Decimal "-.0-9" // '-' At beginning means litteral '-'
NOTE: The current implentation of the range specification processer may allow a literal '-' anywhere that a range is not implied, but the only officially supported location for a literal '-' is at the beginning of the string.
NOTE: The full unicode character set should be supported
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IterateRangeSpec ¶
func IterateRangeSpec(rangeSpec string, callBack RangeIteratorCallback)
IterateRangeSpec processes a range specification, calling a callback function for each rune-range encountered
func RangeToBytes ¶
RangeToBytes converts a range specifier into a byte array suitable for the Match*Bytes calls of iNamik/go_lexer
func RangeToRunes ¶
RangeToRunes converts a range specifier into a rune array suitable for the Match*Runes calls of the iNamik/go_lexer
Types ¶
type RangeIteratorCallback ¶
RangeIteratorCallback defines the prototype for the IterateRangeSpec callback function. The function takes two rune parameters, 'low' and 'hi' (which can have the same value) and returns a boolean indicating if it is ok to continue processing the rangeSpec (true == ok, false == quit)