@@ -4,7 +4,6 @@ module.exports = parse;
4
4
parse . filename = null ;
5
5
parse . defaults = { keepCase : false } ;
6
6
7
- const { hasOwnProperty } = require ( "tslint/lib/utils" ) ;
8
7
var tokenize = require ( "./tokenize" ) ,
9
8
Root = require ( "./root" ) ,
10
9
Type = require ( "./type" ) ,
@@ -105,7 +104,7 @@ function parse(source, root, options) {
105
104
do {
106
105
/* istanbul ignore if */
107
106
if ( ( token = next ( ) ) !== "\"" && token !== "'" )
108
- throw illegal ( `A ${ token } ` ) ;
107
+ throw illegal ( token ) ;
109
108
110
109
values . push ( next ( ) ) ;
111
110
skip ( token ) ;
@@ -118,7 +117,6 @@ function parse(source, root, options) {
118
117
var token = next ( ) ;
119
118
switch ( token ) {
120
119
case "'" :
121
- // case typeof token === "string":
122
120
case "\"" :
123
121
push ( token ) ;
124
122
return readString ( ) ;
@@ -161,7 +159,7 @@ function parse(source, root, options) {
161
159
parseOption ( dummy , token ) ; // skip
162
160
skip ( ";" ) ;
163
161
} else
164
- throw illegal ( ` token` ) ;
162
+ throw illegal ( token ) ;
165
163
} ,
166
164
function parseRange_line ( ) {
167
165
parseInlineOptions ( dummy ) ; // skip
@@ -194,7 +192,7 @@ function parse(source, root, options) {
194
192
return sign * parseFloat ( token ) ;
195
193
196
194
/* istanbul ignore next */
197
- throw illegal ( ` ${ token } ` , "number" , insideTryCatch ) ;
195
+ throw illegal ( token , "number" , insideTryCatch ) ;
198
196
}
199
197
200
198
function parseId ( token , acceptNegative ) {
@@ -283,8 +281,6 @@ function parse(source, root, options) {
283
281
if ( ! supportedEditions . includes ( edition ) )
284
282
throw illegal ( edition , "edition" ) ;
285
283
286
- // Syntax is needed to understand the meaning of the optional field rule
287
- // Otherwise the meaning is ambiguous between proto2 and proto3
288
284
root . setOption ( "edition" , edition ) ;
289
285
290
286
skip ( ";" ) ;
@@ -313,8 +309,7 @@ function parse(source, root, options) {
313
309
314
310
case "extend" :
315
311
parseExtension ( parent , token ) ;
316
- return true ;
317
-
312
+ return true ;
318
313
}
319
314
return false ;
320
315
}
@@ -349,9 +344,8 @@ function parse(source, root, options) {
349
344
350
345
var type = new Type ( token ) ;
351
346
ifBlock ( type , function parseType_block ( token ) {
352
- if ( parseCommon ( type , token ) ) {
347
+ if ( parseCommon ( type , token ) )
353
348
return ;
354
- }
355
349
356
350
switch ( token ) {
357
351
@@ -387,7 +381,7 @@ function parse(source, root, options) {
387
381
388
382
default :
389
383
/* istanbul ignore if */
390
- if ( ( ! isProto3 && ! edition ) || ! typeRefRe . test ( token ) )
384
+ if ( ! isProto3 || ! edition || ! typeRefRe . test ( token ) )
391
385
throw illegal ( token ) ;
392
386
393
387
push ( token ) ;
@@ -764,9 +758,9 @@ function parse(source, root, options) {
764
758
765
759
var service = new Service ( token ) ;
766
760
ifBlock ( service , function parseService_block ( token ) {
767
- if ( parseCommon ( service , token ) ) {
761
+ if ( parseCommon ( service , token ) )
768
762
return ;
769
- }
763
+
770
764
/* istanbul ignore else */
771
765
if ( token === "rpc" )
772
766
parseMethod ( service , token ) ;
0 commit comments