@@ -254,7 +254,9 @@ macro_rules! json_internal {
254
254
1 + json_internal!( @object_capacity ( ) ( $( $rest) * ) ( $( $rest) * ) )
255
255
} ;
256
256
257
- // Current entry followed by unexpected token. The actual parsing macro will print the error message.
257
+ // Current entry followed by unexpected token. The part that parses the values
258
+ // will trigger a reasonable error message; here, we just return 0
259
+ // so that there is not a duplicated error message.
258
260
( @object_capacity entry $unexpected: tt $( $rest: tt) * ) => {
259
261
0
260
262
} ;
@@ -299,22 +301,30 @@ macro_rules! json_internal {
299
301
json_internal!( @object_capacity entry)
300
302
} ;
301
303
302
- // Missing value for last entry. The actual parsing macro will print the error message.
304
+ // Missing value for last entry. The part that parses the values
305
+ // will trigger a reasonable error message; here, we just return 0
306
+ // so that there is not a duplicated error message.
303
307
( @object_capacity ( $( $key: tt) +) ( : ) $copy: tt) => {
304
308
0
305
309
} ;
306
310
307
- // Missing colon and value for last entry. The actual parsing macro will print the error message.
311
+ // Missing colon and value for last entry. The part that parses the values
312
+ // will trigger a reasonable error message; here, we just return 0
313
+ // so that there is not a duplicated error message.
308
314
( @object_capacity ( $( $key: tt) +) ( ) $copy: tt) => {
309
315
0
310
316
} ;
311
317
312
- // Misplaced colon. The actual parsing macro will print the error message.
318
+ // Misplaced colon. The part that parses the values
319
+ // will trigger a reasonable error message; here, we just return 0
320
+ // so that there is not a duplicated error message.
313
321
( @object_capacity ( ) ( : $( $rest: tt) * ) ( $colon: tt $( $copy: tt) * ) ) => {
314
322
0
315
323
} ;
316
324
317
- // Found a comma inside a key. The actual parsing macro will print the error message.
325
+ // Found a comma inside a key. The part that parses the values
326
+ // will trigger a reasonable error message; here, we just return 0
327
+ // so that there is not a duplicated error message.
318
328
( @object_capacity ( $( $key: tt) * ) ( , $( $rest: tt) * ) ( $comma: tt $( $copy: tt) * ) ) => {
319
329
0
320
330
} ;
@@ -326,8 +336,10 @@ macro_rules! json_internal {
326
336
// };
327
337
328
338
// Refuse to absorb colon token into key expression.
339
+ // The part that parses the values will trigger a reasonable error message;
340
+ // here, we just return 0 so that there is not a duplicated error message.
329
341
( @object_capacity ( $( $key: tt) * ) ( : $( $unexpected: tt) +) $copy: tt) => {
330
- json_expect_expr_comma! ( $ ( $unexpected ) + )
342
+ 0
331
343
} ;
332
344
333
345
// Munch a token into the current key.
0 commit comments