import "github.com/mailru/easyjson/jlexer"
Package jlexer contains a JSON lexer implementation.
It is expected that it is mostly used with generated parser code, so the interface is tuned for a parser that knows what kind of data is expected.
bytestostr.go error.go lexer.go
type Lexer struct { Data []byte // Input data given to the lexer. UseMultipleErrors bool // If we want to use multiple errors. // contains filtered or unexported fields }
Lexer is a JSON lexer: it iterates over JSON tokens in a byte slice.
Bool reads a true or false boolean keyword.
Bytes reads a string literal and base64 decodes it into a byte slice.
Consumed reads all remaining bytes from the input, publishing an error if there is anything but whitespace remaining.
Delim consumes a token and verifies that it is the given delimiter.
FetchToken scans the input for the next token.
func (r *Lexer) GetNonFatalErrors() []*LexerError
Interface fetches an interface{} analogous to the 'encoding/json' package.
IsDelim returns true if there was no scanning error and next token is the given delimiter.
IsNull returns true if the next token is a null keyword.
IsStart returns whether the lexer is positioned at the start of an input string.
JsonNumber fetches and json.Number from 'encoding/json' package. Both int, float or string, contains them are valid values
Null verifies that the next token is null and consumes it.
Ok returns true if no error (including io.EOF) was encountered during scanning.
Raw fetches the next item recursively as a data slice
Skip skips a single token.
SkipRecursive skips next array or object completely, or just skips a single token if not an array/object.
Note: no syntax validation is performed on the skipped data.
String reads a string literal.
StringIntern reads a string literal, and performs string interning on it.
UnsafeBytes returns the byte slice if the token is a string literal.
UnsafeFieldName returns current member name string token
UnsafeString returns the string value if the token is a string literal.
Warning: returned string may point to the input buffer, so the string should not outlive the input buffer. Intended pattern of usage is as an argument to a switch statement.
WantColon requires a colon to be present before fetching next token.
WantComma requires a comma to be present before fetching next token.
LexerError implements the error interface and represents all possible errors that can be generated during parsing the JSON data.
func (l *LexerError) Error() string
Package jlexer imports 13 packages (graph) and is imported by 1277 packages. Updated 2020-10-08. Refresh now. Tools for package owners.