@@ -703,10 +703,10 @@ protobuf.TextReader = class {
703703 const tags = new Map ( ) ;
704704 this . reset ( ) ;
705705 try {
706- this . start ( false ) ;
706+ this . start ( ) ;
707707 while ( ! this . end ( ) ) {
708708 const tag = this . tag ( ) ;
709- if ( this . token ( ) === '{' ) {
709+ if ( this . token ( ) === '{' || this . token ( ) === '<' ) {
710710 this . start ( ) ;
711711 tags . set ( tag , true ) ;
712712 while ( ! this . end ( ) ) {
@@ -734,13 +734,20 @@ protobuf.TextReader = class {
734734 this . _position = 0 ;
735735 this . _depth = 0 ;
736736 this . _arrayDepth = 0 ;
737+ this . _brackets = [ ] ;
737738 this . _token = '' ;
738739 this . next ( ) ;
739740 }
740741
741742 start ( ) {
742743 if ( this . _depth > 0 ) {
743- this . expect ( '{' ) ;
744+ if ( this . _token === '<' ) {
745+ this . expect ( '<' ) ;
746+ this . _brackets . push ( '>' ) ;
747+ } else {
748+ this . expect ( '{' ) ;
749+ this . _brackets . push ( '}' ) ;
750+ }
744751 }
745752 this . _depth ++ ;
746753 }
@@ -749,9 +756,13 @@ protobuf.TextReader = class {
749756 if ( this . _depth <= 0 ) {
750757 throw new protobuf . Error ( `Invalid depth ${ this . location ( ) } ` ) ;
751758 }
752- if ( this . _token === '}' ) {
753- this . expect ( '}' ) ;
754- this . match ( ';' ) ;
759+ const close = this . _brackets . length > 0 ? this . _brackets [ this . _brackets . length - 1 ] : '}' ;
760+ if ( this . _token === '}' || this . _token === '>' ) {
761+ this . expect ( close ) ;
762+ this . _brackets . pop ( ) ;
763+ if ( ! this . match ( ';' ) ) {
764+ this . match ( ',' ) ;
765+ }
755766 this . _depth -- ;
756767 return true ;
757768 }
@@ -768,7 +779,7 @@ protobuf.TextReader = class {
768779 tag ( ) {
769780 const name = this . _token ;
770781 this . next ( ) ;
771- if ( this . _token !== '[' && this . _token !== '{' ) {
782+ if ( this . _token !== '[' && this . _token !== '{' && this . _token !== '<' ) {
772783 this . expect ( ':' ) ;
773784 }
774785 return name ;
@@ -1054,15 +1065,18 @@ protobuf.TextReader = class {
10541065
10551066 skip ( ) {
10561067 switch ( this . _token ) {
1068+ case '<' :
10571069 case '{' : {
10581070 const depth = this . _depth ;
10591071 this . start ( ) ;
10601072 while ( ! this . end ( ) || depth < this . _depth ) {
1061- if ( this . _token === '{' ) {
1073+ if ( this . _token === '{' || this . _token === '<' ) {
10621074 this . start ( ) ;
1063- } else if ( this . _token !== '}' ) {
1075+ } else if ( this . _token !== '}' && this . _token !== '>' ) {
10641076 this . next ( ) ;
1065- this . match ( ';' ) ;
1077+ if ( ! this . match ( ';' ) ) {
1078+ this . match ( ',' ) ;
1079+ }
10661080 }
10671081 }
10681082 break ;
@@ -1158,6 +1172,8 @@ protobuf.TextReader = class {
11581172 switch ( c ) {
11591173 case '{' :
11601174 case '}' :
1175+ case '<' :
1176+ case '>' :
11611177 case ':' :
11621178 case ',' :
11631179 case ']' :
@@ -1354,7 +1370,9 @@ protobuf.TextReader = class {
13541370
13551371 semicolon ( ) {
13561372 if ( this . _arrayDepth === 0 ) {
1357- this . match ( ';' ) ;
1373+ if ( ! this . match ( ';' ) ) {
1374+ this . match ( ',' ) ;
1375+ }
13581376 }
13591377 }
13601378} ;
0 commit comments