Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: base/json/json_parser.h

Issue 1571633002: Pass Manifest JSON paser error line and column number to console. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/json/json_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_JSON_JSON_PARSER_H_ 5 #ifndef BASE_JSON_JSON_PARSER_H_
6 #define BASE_JSON_JSON_PARSER_H_ 6 #define BASE_JSON_JSON_PARSER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Parses the input string according to the set options and returns the 51 // Parses the input string according to the set options and returns the
52 // result as a Value owned by the caller. 52 // result as a Value owned by the caller.
53 Value* Parse(const StringPiece& input); 53 Value* Parse(const StringPiece& input);
54 54
55 // Returns the error code. 55 // Returns the error code.
56 JSONReader::JsonParseError error_code() const; 56 JSONReader::JsonParseError error_code() const;
57 57
58 // Returns the human-friendly error message. 58 // Returns the human-friendly error message.
59 std::string GetErrorMessage() const; 59 std::string GetErrorMessage() const;
60 60
61 // Returns the error line number if parse error happened. Otherwise always
62 // returns 0.
63 int error_line() const;
64
65 // Returns the error column number if parse error happened. Otherwise always
66 // returns 0.
67 int error_column() const;
68
61 private: 69 private:
62 enum Token { 70 enum Token {
63 T_OBJECT_BEGIN, // { 71 T_OBJECT_BEGIN, // {
64 T_OBJECT_END, // } 72 T_OBJECT_END, // }
65 T_ARRAY_BEGIN, // [ 73 T_ARRAY_BEGIN, // [
66 T_ARRAY_END, // ] 74 T_ARRAY_END, // ]
67 T_STRING, 75 T_STRING,
68 T_NUMBER, 76 T_NUMBER,
69 T_BOOL_TRUE, // true 77 T_BOOL_TRUE, // true
70 T_BOOL_FALSE, // false 78 T_BOOL_FALSE, // false
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers); 256 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers);
249 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages); 257 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages);
250 258
251 DISALLOW_COPY_AND_ASSIGN(JSONParser); 259 DISALLOW_COPY_AND_ASSIGN(JSONParser);
252 }; 260 };
253 261
254 } // namespace internal 262 } // namespace internal
255 } // namespace base 263 } // namespace base
256 264
257 #endif // BASE_JSON_JSON_PARSER_H_ 265 #endif // BASE_JSON_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | base/json/json_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698