Lines Matching +full:helper +full:- +full:string +full:- +full:parser
2 // Use of this source code is governed by a BSD-style license that can be
12 #include <string>
33 // This parser guarantees O(n) time through the input string. Iteration happens
35 // conversion from byte to JSON token happens without advancing the parser in
36 // GetNextToken/ParseToken, that is tokenization operates on the current parser
40 // internally. Invariant: on entry of a Consume function, the parser is wound
49 // Parses the input string according to the set options and returns the
58 // Returns the human-friendly error message.
59 std::string GetErrorMessage() const;
86 // A helper class used for parsing strings. One optimization performed is to
87 // create base::Value with a StringPiece to avoid unnecessary std::string
88 // copies. This is not possible if the input string needs to be decoded from
89 // UTF-16 to UTF-8, or if an escape sequence causes characters to be skipped.
96 // |pos| is the beginning of an input string, excluding the |"|.
103 // Appends the Unicode code point |point| to the string, either by
104 // increasing the |length_| of the string if the string has not been
108 // Converts the builder from its default StringPiece to a full std::string,
113 // Returns the builder as a string, invalidating all state. This allows
114 // the internal string buffer representation to be destructively moved
116 std::string DestructiveAsString();
119 // The beginning of the input string.
122 // Number of bytes in |pos_| that make up the string being built.
125 // The copied string representation. Will be unset until Convert() is
127 base::Optional<std::string> string_;
138 // than |count| bytes remain, and advances the parser position by |count|.
148 // This does not advance the parser for non-whitespace or comment chars.
151 // Consumes whitespace characters and comments until the next non-that is
154 // Helper function that consumes a comment, assuming that the parser is
165 // Assuming that the parser is currently wound to '{', this parses a JSON
169 // Assuming that the parser is wound to '[', this parses a JSON list into a
176 // Assuming that the parser is wound to a double quote, this parses a string,
177 // decoding any escape sequences and converts UTF-16 to UTF-8. Returns true on
181 // Helper function for ConsumeStringRaw() that consumes the next four or 10
182 // bytes (parser is wound to the first character of a HEX sequence, with the
187 // Assuming that the parser is wound to the start of a valid JSON number,
190 // Helper that reads characters that are ints. Returns true if a number was
195 // parser is wound to the first character of any of those.
198 // Helper function that returns true if the byte squence |match| can be
199 // consumed at the current parser position. Returns false if there are fewer
200 // than |match|-length bytes or if the sequence does not match, and the
201 // parser state is unchanged.
211 static std::string FormatErrorMessage(int line, int column,
212 const std::string& description);
220 // The input stream being parsed. Note: Not guaranteed to NUL-terminated.
223 // The index in the input stream to which the parser is wound.
226 // The number of times the parser has recursed (current stack depth).
229 // The line number that the parser is at currently.
254 // Used when decoding and an invalid utf-8 sequence is encountered.