Permalink
Browse files

add an error message for unterminated items

  • Loading branch information...
demerphq committed May 16, 2012
1 parent 953a8e1 commit f59ad1cba864d57e2315b86725486ecc63c7a92e
Showing with 4 additions and 1 deletion.
  1. +4 −1 Undump.xs
View
@@ -694,7 +694,7 @@ SV* _undump(pTHX_ const char **parse_start, const char const *parse_end, char ob
if (want_key) {
DONE_KEY_SIMPLE_break;
} else {
- ERROR(depth,token,token_start,parse_ptr,parse_end,"got a bareword where it was not expect (DD does not do that)");
+ ERROR(depth,token,token_start,parse_ptr,parse_end,"got a bareword where it was not expected");
}
if (got) {
ERROR(depth,token,token_start,parse_ptr,parse_end,"Multiple objects in stream?");
@@ -803,6 +803,9 @@ SV* _undump(pTHX_ const char **parse_start, const char const *parse_end, char ob
} /* while */
if ( parse_ptr < parse_end ) {
PANIC(depth,token,token_start,parse_ptr,parse_end,"fallen off the loop with text left");
+ } else if (!got) {
+ ERRORf1(depth,token,token_start,parse_ptr,parse_end,
+ "unterminated %s constructor", obj_char == '{' ? "HASH" : obj_char == '[' ? "ARRAY" : "UNKNOWN");
} else {
*parse_start= parse_ptr;
return got;

0 comments on commit f59ad1c

Please sign in to comment.