@@ -501,6 +501,10 @@ package body JSON is
501501 StackPointer := StackPointer + 1 ;
502502 ParserStack(StackPointer).State := ST_KEY;
503503 ParserStack(StackPointer).Index := IndexWriter;
504+ when ' }' =>
505+ if (VERBOSE = TRUE ) then jsonStringAppend(StringBuffer, StringWriter, " Found: Empty object" & LF); end if ;
506+ StackPointer := StackPointer - 1 ;
507+ ParserStack(StackPointer).State := ST_CLOSED;
504508 when others =>
505509 Result.Error := errorMessage(" Parsing Object(" & printPos(Debug_Row, Debug_Column) & " ): Char '" & CurrentChar & " ' is not allowed." );
506510 exit loopi;
@@ -533,6 +537,10 @@ package body JSON is
533537 StackPointer := StackPointer + 1 ;
534538 ParserStack(StackPointer).State := ST_LIST;
535539 ParserStack(StackPointer).Index := IndexWriter;
540+ when ' ]' =>
541+ if (VERBOSE = TRUE ) then jsonStringAppend(StringBuffer, StringWriter, " Found: Empty list" & LF); end if ;
542+ StackPointer := StackPointer - 1 ;
543+ ParserStack(StackPointer).State := ST_CLOSED;
536544 when ' @' =>
537545 -- consume the opening quote
538546 read (CurrentLine, CurrentChar, IsString);
@@ -1083,9 +1091,18 @@ package body JSON is
10831091 when ST_STRING =>
10841092 case CurrentChar is
10851093 when ' "' => -- a single quote to restore the syntax highlighting FSM in Notepad++ "
1086- if (VERBOSE = TRUE ) then jsonStringAppend(StringBuffer, StringWriter, " Found: StringEnd - Setting End to " & INTEGER 'image (ContentWriter) & LF); end if ;
1087- Result.Index (IndexWriter).StringEnd := ContentWriter;
1088- ParserStack(StackPointer).State := ST_STRING_END;
1094+ if (ContentWriter = 0 ) then
1095+ if (VERBOSE = TRUE ) then jsonStringAppend(StringBuffer, StringWriter, " Found: StringEnd - Setting End to " & INTEGER 'image (ContentWriter) & LF); end if ;
1096+ Result.Index (IndexWriter).StringEnd := ContentWriter;
1097+ ParserStack(StackPointer).State := ST_STRING_END;
1098+ elsif ((ContentWriter > 0 ) and (Result.Content(ContentWriter) /= ' \' )) then
1099+ if (VERBOSE = TRUE ) then jsonStringAppend(StringBuffer, StringWriter, " Found: StringEnd - Setting End to " & INTEGER 'image (ContentWriter) & LF); end if ;
1100+ Result.Index (IndexWriter).StringEnd := ContentWriter;
1101+ ParserStack(StackPointer).State := ST_STRING_END;
1102+ else
1103+ ContentWriter := ContentWriter + 1 ;
1104+ Result.Content(ContentWriter) := CurrentChar;
1105+ end if ;
10891106 when others =>
10901107 ContentWriter := ContentWriter + 1 ;
10911108 Result.Content(ContentWriter) := CurrentChar;
@@ -1138,7 +1155,7 @@ package body JSON is
11381155 when ' .' =>
11391156 ContentWriter := ContentWriter + 1 ;
11401157 Result.Content(ContentWriter) := CurrentChar;
1141- when '-' =>
1158+ when '-' | ' + ' =>
11421159 ContentWriter := ContentWriter + 1 ;
11431160 Result.Content(ContentWriter) := CurrentChar;
11441161 when ' e' | ' E' =>
@@ -1380,7 +1397,7 @@ package body JSON is
13801397 elsif ((StackPointer /= 1 ) or (ParserStack(StackPointer).State /= ST_CLOSED)) then
13811398 case ParserStack(StackPointer).State is
13821399 when ST_FALSE_END | ST_NULL_END | ST_TRUE_END => null ;
1383- when ST_STRING_END | ST_NUMBER_END => null ;
1400+ when ST_STRING_END | ST_NUMBER | ST_NUMBER_END => null ;
13841401 when ST_CLOSED => null ;
13851402 when others =>
13861403 printParserStack(ParserStack(0 to StackPointer), StringBuffer, StringWriter);
0 commit comments