File tree Expand file tree Collapse file tree 1 file changed +14
-19
lines changed Expand file tree Collapse file tree 1 file changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -554,26 +554,21 @@ class Parser {
554
554
case TokenKind . BLOCK_STRING :
555
555
return this . parseStringLiteral ( ) ;
556
556
case TokenKind . NAME :
557
- if ( token . value === 'true' || token . value === 'false' ) {
558
- this . _lexer . advance ( ) ;
559
- return {
560
- kind : Kind . BOOLEAN ,
561
- value : token . value === 'true' ,
562
- loc : this . loc ( token ) ,
563
- } ;
564
- } else if ( token . value === 'null' ) {
565
- this . _lexer . advance ( ) ;
566
- return {
567
- kind : Kind . NULL ,
568
- loc : this . loc ( token ) ,
569
- } ;
570
- }
571
557
this . _lexer . advance ( ) ;
572
- return {
573
- kind : Kind . ENUM ,
574
- value : ( ( token . value : any ) : string ) ,
575
- loc : this . loc ( token ) ,
576
- } ;
558
+ switch ( token . value ) {
559
+ case 'true' :
560
+ return { kind : Kind . BOOLEAN , value : true , loc : this . loc ( token ) } ;
561
+ case 'false' :
562
+ return { kind : Kind . BOOLEAN , value : false , loc : this . loc ( token ) } ;
563
+ case 'null' :
564
+ return { kind : Kind . NULL , loc : this . loc ( token ) } ;
565
+ default :
566
+ return {
567
+ kind : Kind . ENUM ,
568
+ value : ( ( token . value : any ) : string ) ,
569
+ loc : this . loc ( token ) ,
570
+ } ;
571
+ }
577
572
case TokenKind . DOLLAR :
578
573
if ( ! isConst ) {
579
574
return this . parseVariable ( ) ;
You can’t perform that action at this time.
0 commit comments