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

Method parseInteger

parser.go:566–583  ·  view source on GitHub ↗

parseInteger parses a decimal integer.

()

Source from the content-addressed store, hash-verified

564
565// parseInteger parses a decimal integer.
566func (p *parser) parseInteger() (int, error) {
567 i := p.i
568 start := i
569 for i < len(p.s) && '0' <= p.s[i] && p.s[i] <= '9' {
570 i++
571 }
572 if i == start {
573 return 0, errors.New("expected integer, but didn't find it")
574 }
575 p.i = i
576
577 val, err := strconv.Atoi(p.s[start:i])
578 if err != nil {
579 return 0, err
580 }
581
582 return val, nil
583}
584
585// parseNth parses the argument for :nth-child (normally of the form an+b).
586func (p *parser) parseNth() (a, b int, err error) {

Callers 1

parseNthMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected