Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Strip ¶
Strip returns a copy of its input after removing all whitespace and comments.
Whitespace characters are: - tabs (0x09) - newlines (0x0a) - carriage returns (0x0d) - spaces (0x20)
Comments begin with a hash ('#') and continue to the next newline character.
Backslashes may be used to prevent the removal of individual whitespace characters or comments (i.e. the backslash will be removed and the following whitespace character or comment will be kept).
Backslashes before characters not mentioned above have no special meaning and will be kept in the resulting string.
Types ¶
type Scanner ¶
type Scanner struct {
Input string // input to be scanned
// contains filtered or unexported fields
}
func (*Scanner) Consume ¶
Consume returns the string of characters that were scanned since the previous call to Consume (or the start of the input string)
func (*Scanner) Next ¶
Next returns the character at the current scan position.
Next does NOT modify the scan position.
func (*Scanner) Peek ¶
Peek returns the next rune from the input start, after the rune at the current scan position.
Peek does NOT modify the scan position.
func (*Scanner) Scan ¶
Scan moves the scan position to the next rune in the input string.
Scan must be called once before calling [Next] or [Peek]
[Next] and [Peek] should only be called after Scan returns true.
Once scan returns false, it will always return false.
func (*Scanner) SkipChar ¶
func (s *Scanner) SkipChar()
SkipChar moves the scan position and the start of the next consumable span to the next character in the input string