Documentation ¶
Index ¶
- Constants
- Variables
- func Line(s *Scanner)
- func LineTrimSpace(s *Scanner)
- func ParseFloat64(s string) float64
- func ParseInt(s string) int
- func Word(s *Scanner)
- type Func
- type NumberDef
- type Pos
- type QuotedDef
- type Reader
- type RuneClass
- type Scanner
- func (s *Scanner) End() bool
- func (s *Scanner) Keep()
- func (s *Scanner) KeepIf(c RuneClass)
- func (s *Scanner) Next()
- func (s *Scanner) Ok() bool
- func (s *Scanner) Scan(fn Func) string
- func (s *Scanner) ScanUntil(c RuneClass) string
- func (s *Scanner) ScanWhile(c RuneClass) string
- func (s *Scanner) SetBytes(src []byte)
- func (s *Scanner) SetName(name string)
- func (s *Scanner) SetReader(src io.Reader)
- func (s *Scanner) SetString(src string)
- func (s *Scanner) SkipIf(c RuneClass)
- func (s *Scanner) Start()
- func (s *Scanner) Token() string
- func (s *Scanner) TrimToken() string
Constants ¶
View Source
const EndCh = rune(-1)
Variables ¶
View Source
var ( Always = func(r rune) bool { return r != EndCh } IsCharAF = Or(IsUpperCharAF, IsLowerCharAF) IsCharAZ = Or(IsUpperCharAZ, IsLowerCharAZ) IsCurrency = func(r rune) bool { return unicode.Is(unicode.Sc, r) } IsDigit01 = Rune2('0', '1') IsDigit07 = RuneRange('0', '7') IsDigit09 = RuneRange('0', '9') IsDigit0F = Or(IsDigit09, IsLowerCharAF, IsUpperCharAF) IsEnd = Rune(EndCh) IsLowerCharAF = RuneRange('a', 'f') IsLowerCharAZ = RuneRange('a', 'z') IsNewline = Rune('\n') Never = func(r rune) bool { return false } IsUpperCharAF = RuneRange('A', 'F') IsUpperCharAZ = RuneRange('A', 'Z') )
View Source
var ( BinDef = NumberDef{ Digit: IsDigit01, } DecDef = NumberDef{ Digit: IsDigit09, DecSep: Rune('.'), Sign: Rune2('+', '-'), } FloatDef = NumberDef{ Digit: IsDigit09, DecSep: Rune('.'), Sign: Rune2('+', '-'), Exponent: Rune2('e', 'E'), } HexDef = NumberDef{ Digit: IsDigit0F, } IntDef = NumberDef{ Digit: IsDigit09, Sign: Rune2('+', '-'), } OctDef = NumberDef{ Digit: IsDigit07, } StringDef = QuotedDef{ Escape: Rune('\\'), } UIntDef = NumberDef{ Digit: IsDigit09, } UDecRef = NumberDef{ Digit: IsDigit09, DecSep: Rune('.'), } )
View Source
var ( Bin = NumberFunc(BinDef) Dec = NumberFunc(DecDef) Float = NumberFunc(FloatDef) Hex = NumberFunc(HexDef) Int = NumberFunc(IntDef) Oct = NumberFunc(OctDef) Remaining = WhileFunc(Always) String = QuotedFunc(StringDef) Whitespace = WhileFunc(unicode.IsSpace) UInt = NumberFunc(UIntDef) UDec = NumberFunc(UDecRef) )
View Source
var ErrNotTerminated = errors.New("not terminated")
Functions ¶
func LineTrimSpace ¶
func LineTrimSpace(s *Scanner)
func ParseFloat64 ¶
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewStringReader ¶
type RuneClass ¶
func OptionalClass ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.