MCPcopy Create free account
hub / github.com/andybalholm/cascadia / parseInteger

Method parseInteger

parser.go:613–630  ·  view source on GitHub ↗

parseInteger parses a decimal integer.

()

Source from the content-addressed store, hash-verified

611
612// parseInteger parses a decimal integer.
613func (p *parser) parseInteger() (int, error) {
614 i := p.i
615 start := i
616 for i < len(p.s) && '0' <= p.s[i] && p.s[i] <= '9' {
617 i++
618 }
619 if i == start {
620 return 0, errors.New("expected integer, but didn't find it")
621 }
622 p.i = i
623
624 val, err := strconv.Atoi(p.s[start:i])
625 if err != nil {
626 return 0, err
627 }
628
629 return val, nil
630}
631
632// parseNth parses the argument for :nth-child (normally of the form an+b).
633func (p *parser) parseNth() (a, b int, err error) {

Callers 1

parseNthMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected