// checkValid verifies that data is valid JSON-encoded data. // scan is passed in for use by checkValid to avoid an allocation. func checkValid(data []byte, scan *scanner) error { … } // nextValue splits data after the next whole JSON value, // returning that value and the bytes that follow it as separate slices. // scan is passed in for use by nextValue to avoid an allocation. func nextValue(data []byte, scan *scanner) (value, rest []byte, err error) { … } type SyntaxError … func (e *SyntaxError) Error() string { … } type scanner … const scanContinue … const scanBeginLiteral … const scanBeginObject … const scanObjectKey … const scanObjectValue … const scanEndObject … const scanBeginArray … const scanArrayValue … const scanEndArray … const scanSkipSpace … const scanEnd … const scanError … const parseObjectKey … const parseObjectValue … const parseArrayValue … // reset prepares the scanner for use. // It must be called before calling s.step. func (s *scanner) reset() { … } // eof tells the scanner that the end of input has been reached. // It returns a scan status just as s.step does. func (s *scanner) eof() int { … } // pushParseState pushes a new parse state p onto the parse stack. func (s *scanner) pushParseState(p int) { … } // popParseState pops a parse state (already obtained) off the stack // and updates s.step accordingly. func (s *scanner) popParseState() { … } func isSpace(c byte) bool { … } // stateBeginValueOrEmpty is the state after reading `[`. func stateBeginValueOrEmpty(s *scanner, c byte) int { … } // stateBeginValue is the state at the beginning of the input. func stateBeginValue(s *scanner, c byte) int { … } // stateBeginStringOrEmpty is the state after reading `{`. func stateBeginStringOrEmpty(s *scanner, c byte) int { … } // stateBeginString is the state after reading `{"key": value,`. func stateBeginString(s *scanner, c byte) int { … } // stateEndValue is the state after completing a value, // such as after reading `{}` or `true` or `["x"`. func stateEndValue(s *scanner, c byte) int { … } // stateEndTop is the state after finishing the top-level value, // such as after reading `{}` or `[1,2,3]`. // Only space characters should be seen now. func stateEndTop(s *scanner, c byte) int { … } // stateInString is the state after reading `"`. func stateInString(s *scanner, c byte) int { … } // stateInStringEsc is the state after reading `"\` during a quoted string. func stateInStringEsc(s *scanner, c byte) int { … } // stateInStringEscU is the state after reading `"\u` during a quoted string. func stateInStringEscU(s *scanner, c byte) int { … } // stateInStringEscU1 is the state after reading `"\u1` during a quoted string. func stateInStringEscU1(s *scanner, c byte) int { … } // stateInStringEscU12 is the state after reading `"\u12` during a quoted string. func stateInStringEscU12(s *scanner, c byte) int { … } // stateInStringEscU123 is the state after reading `"\u123` during a quoted string. func stateInStringEscU123(s *scanner, c byte) int { … } // stateNeg is the state after reading `-` during a number. func stateNeg(s *scanner, c byte) int { … } // state1 is the state after reading a non-zero integer during a number, // such as after reading `1` or `100` but not `0`. func state1(s *scanner, c byte) int { … } // state0 is the state after reading `0` during a number. func state0(s *scanner, c byte) int { … } // stateDot is the state after reading the integer and decimal point in a number, // such as after reading `1.`. func stateDot(s *scanner, c byte) int { … } // stateDot0 is the state after reading the integer, decimal point, and subsequent // digits of a number, such as after reading `3.14`. func stateDot0(s *scanner, c byte) int { … } // stateE is the state after reading the mantissa and e in a number, // such as after reading `314e` or `0.314e`. func stateE(s *scanner, c byte) int { … } // stateESign is the state after reading the mantissa, e, and sign in a number, // such as after reading `314e-` or `0.314e+`. func stateESign(s *scanner, c byte) int { … } // stateE0 is the state after reading the mantissa, e, optional sign, // and at least one digit of the exponent in a number, // such as after reading `314e-2` or `0.314e+1` or `3.14e0`. func stateE0(s *scanner, c byte) int { … } // stateT is the state after reading `t`. func stateT(s *scanner, c byte) int { … } // stateTr is the state after reading `tr`. func stateTr(s *scanner, c byte) int { … } // stateTru is the state after reading `tru`. func stateTru(s *scanner, c byte) int { … } // stateF is the state after reading `f`. func stateF(s *scanner, c byte) int { … } // stateFa is the state after reading `fa`. func stateFa(s *scanner, c byte) int { … } // stateFal is the state after reading `fal`. func stateFal(s *scanner, c byte) int { … } // stateFals is the state after reading `fals`. func stateFals(s *scanner, c byte) int { … } // stateN is the state after reading `n`. func stateN(s *scanner, c byte) int { … } // stateNu is the state after reading `nu`. func stateNu(s *scanner, c byte) int { … } // stateNul is the state after reading `nul`. func stateNul(s *scanner, c byte) int { … } // stateError is the state after reaching a syntax error, // such as after reading `[1}` or `5.1.2`. func stateError(s *scanner, c byte) int { … } // error records an error and switches to the error state. func (s *scanner) error(c byte, context string) int { … } // quoteChar formats c as a quoted character literal func quoteChar(c byte) string { … } // undo causes the scanner to return scanCode from the next state transition. // This gives callers a simple 1-byte undo mechanism. func (s *scanner) undo(scanCode int) { … } // stateRedo helps implement the scanner's 1-byte undo. func stateRedo(s *scanner, c byte) int { … }