• Home
  • Raw
  • Download

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>
21 #include "third_party/abseil-cpp/absl/types/optional.h"
34 // This parser guarantees O(n) time through the input string. Iteration happens
36 // conversion from byte to JSON token happens without advancing the parser in
37 // GetNextToken/ParseToken, that is tokenization operates on the current parser
41 // internally. Invariant: on entry of a Consume function, the parser is wound
62 // String versions of parse error codes.
80 // Parses the input string according to the set options and returns the
89 // Returns the human-friendly error message.
90 std::string GetErrorMessage() const;
117 // A helper class used for parsing strings. One optimization performed is to
118 // create base::Value with a StringPiece to avoid unnecessary std::string
119 // copies. This is not possible if the input string needs to be decoded from
120 // UTF-16 to UTF-8, or if an escape sequence causes characters to be skipped.
127 // |pos| is the beginning of an input string, excluding the |"|.
134 // Appends the Unicode code point |point| to the string, either by
135 // increasing the |length_| of the string if the string has not been
139 // Converts the builder from its default StringPiece to a full std::string,
144 // Returns the builder as a string, invalidating all state. This allows
145 // the internal string buffer representation to be destructively moved
147 std::string DestructiveAsString();
150 // The beginning of the input string.
153 // Number of bytes in |pos_| that make up the string being built.
156 // The copied string representation. Will be unset until Convert() is
158 absl::optional<std::string> string_;
169 // than |count| bytes remain, and advances the parser position by |count|.
179 // This does not advance the parser for non-whitespace or comment chars.
182 // Consumes whitespace characters and comments until the next non-that is
185 // Helper function that consumes a comment, assuming that the parser is
196 // Assuming that the parser is currently wound to '{', this parses a JSON
200 // Assuming that the parser is wound to '[', this parses a JSON list into a
207 // Assuming that the parser is wound to a double quote, this parses a string,
208 // decoding any escape sequences and converts UTF-16 to UTF-8. Returns true on
212 // Helper function for ConsumeStringRaw() that consumes the next four or 10
213 // bytes (parser is wound to the first character of a HEX sequence, with the
218 // Assuming that the parser is wound to the start of a valid JSON number,
221 // Helper that reads characters that are ints. Returns true if a number was
226 // parser is wound to the first character of any of those.
229 // Helper function that returns true if the byte squence |match| can be
230 // consumed at the current parser position. Returns false if there are fewer
231 // than |match|-length bytes or if the sequence does not match, and the
232 // parser state is unchanged.
242 static std::string FormatErrorMessage(int line, int column,
243 const std::string& description);
251 // The input stream being parsed. Note: Not guaranteed to NUL-terminated.
254 // The index in the input stream to which the parser is wound.
257 // The number of times the parser has recursed (current stack depth).
260 // The line number that the parser is at currently.
281 // Used when decoding and an invalid utf-8 sequence is encountered.